1 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2
3 evaluationDependsOn(":common-util")
4
5 description = "Kotlin Symbol Processing"
6
7 val intellijVersion: String by project
8 val kotlinBaseVersion: String by project
9
10 val libsForTesting by configurations.creating
11
<lambda>null12 tasks.withType<KotlinCompile> {
13 compilerOptions.freeCompilerArgs.add("-Xjvm-default=all-compatibility")
14 }
15
<lambda>null16 plugins {
17 kotlin("jvm")
18 id("org.jetbrains.intellij") version "0.6.4"
19 id("org.jetbrains.dokka") version ("1.7.20")
20 }
21
<lambda>null22 intellij {
23 version = intellijVersion
24 }
25
<lambda>null26 tasks {
27 val sourcesJar by creating(Jar::class) {
28 archiveClassifier.set("sources")
29 from(sourceSets.main.get().allSource)
30 from(project(":common-util").sourceSets.main.get().allSource)
31 }
32 }
33
includeJarsnull34 fun ModuleDependency.includeJars(vararg names: String) {
35 names.forEach {
36 artifact {
37 name = it
38 type = "jar"
39 extension = "jar"
40 }
41 }
42 }
43
44 // WARNING: remember to update the dependencies in symbol-processing as well.
<lambda>null45 dependencies {
46 implementation(kotlin("stdlib", kotlinBaseVersion))
47 implementation("org.jetbrains.kotlin:kotlin-compiler:$kotlinBaseVersion")
48
49 implementation(project(":api"))
50 implementation(project(":common-util"))
51
52 testImplementation(kotlin("stdlib", kotlinBaseVersion))
53 testImplementation("org.jetbrains.kotlin:kotlin-compiler:$kotlinBaseVersion")
54 testImplementation("org.jetbrains.kotlin:kotlin-compiler-internal-test-framework:$kotlinBaseVersion")
55 testImplementation("org.jetbrains.kotlin:kotlin-scripting-compiler:$kotlinBaseVersion")
56
57 testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
58 testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
59 testRuntimeOnly("org.junit.jupiter:junit-jupiter-params:5.8.2")
60 testRuntimeOnly("org.junit.platform:junit-platform-suite:1.8.2")
61
62 testImplementation(project(":api"))
63 testImplementation(project(":common-util"))
64 testImplementation(project(":test-utils"))
65
66 libsForTesting(kotlin("stdlib", kotlinBaseVersion))
67 libsForTesting(kotlin("test", kotlinBaseVersion))
68 libsForTesting(kotlin("script-runtime", kotlinBaseVersion))
69 }
70
<lambda>null71 tasks.register<Copy>("CopyLibsForTesting") {
72 from(configurations.get("libsForTesting"))
73 into("dist/kotlinc/lib")
74 val escaped = Regex.escape(kotlinBaseVersion)
75 rename("(.+)-$escaped\\.jar", "$1.jar")
76 }
77
Projectnull78 fun Project.javaPluginConvention(): JavaPluginConvention = the()
79 val JavaPluginConvention.testSourceSet: SourceSet
80 get() = sourceSets.getByName("test")
81 val Project.testSourceSet: SourceSet
82 get() = javaPluginConvention().testSourceSet
83
84 tasks.test {
85 dependsOn("CopyLibsForTesting")
86 maxHeapSize = "2g"
87
88 useJUnitPlatform()
89
90 systemProperty("idea.is.unit.test", "true")
91 systemProperty("idea.home.path", buildDir)
92 systemProperty("java.awt.headless", "true")
93 environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
94 environment("PROJECT_CLASSES_DIRS", testSourceSet.output.classesDirs.asPath)
95 environment("PROJECT_BUILD_DIR", buildDir)
96 testLogging {
97 events("passed", "skipped", "failed")
98 }
99
100 var tempTestDir: File? = null
101 doFirst {
102 tempTestDir = createTempDir()
103 systemProperty("java.io.tmpdir", tempTestDir.toString())
104 }
105
106 doLast {
107 tempTestDir?.let { delete(it) }
108 }
109 }
110
<lambda>null111 repositories {
112 maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/")
113 maven("https://www.jetbrains.com/intellij-repository/snapshots")
114 }
115
<lambda>null116 val dokkaJavadocJar by tasks.register<Jar>("dokkaJavadocJar") {
117 dependsOn(tasks.dokkaJavadoc)
118 from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
119 from(project(":common-util").tasks.dokkaJavadoc.flatMap { it.outputDirectory })
120 archiveClassifier.set("javadoc")
121 }
122