Unify kotlinCompilerClasspath for all projects

This will prevent spawning second Kotlin daemon during compilation
except 'buildSrc' compilation. Original change was introduced in
2e515f3945 commit.
This commit is contained in:
Yahor Berdnikau
2022-05-05 13:59:44 +02:00
committed by Space
parent f016fd4766
commit af6f17c243
27 changed files with 13 additions and 29 deletions
@@ -22,6 +22,8 @@ dependencies {
} }
} }
project.applyFixForStdlib16()
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts") apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
project.configureJvmDefaultToolchain() project.configureJvmDefaultToolchain()
project.addEmbeddedConfigurations() project.addEmbeddedConfigurations()
@@ -99,7 +101,7 @@ fun Project.configureJavaBasePlugin() {
} }
fun Project.configureKotlinCompilationOptions() { fun Project.configureKotlinCompilationOptions() {
plugins.withType<KotlinBasePluginWrapper>() { plugins.withType<KotlinBasePluginWrapper> {
val commonCompilerArgs = listOfNotNull( val commonCompilerArgs = listOfNotNull(
"-opt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-progressive".takeIf { hasProperty("test.progressive.mode") } "-progressive".takeIf { hasProperty("test.progressive.mode") }
@@ -189,6 +191,16 @@ fun Project.configureKotlinCompilationOptions() {
} }
} }
// Still compile stdlib, reflect, kotlin.test and scripting runtimes
// with JVM target 1.6 to simplify migration from Kotlin 1.6 to 1.7.
fun Project.applyFixForStdlib16() {
plugins.withType<KotlinBasePluginWrapper>() {
dependencies {
"kotlinCompilerClasspath"(project(":libraries:tools:stdlib-compiler-classpath"))
}
}
}
fun Project.configureArtifacts() { fun Project.configureArtifacts() {
tasks.withType<Javadoc>().configureEach { tasks.withType<Javadoc>().configureEach {
enabled = false enabled = false
@@ -8,7 +8,6 @@ project.updateJvmTarget("1.6")
dependencies { dependencies {
api(kotlinStdlib()) api(kotlinStdlib())
testApi(project(":kotlin-test:kotlin-test-jvm")) testApi(project(":kotlin-test:kotlin-test-jvm"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
@@ -7,7 +7,6 @@ project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
dependencies { dependencies {
api(project(":core:compiler.common")) api(project(":core:compiler.common"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -9,7 +9,6 @@ dependencies {
api(project(":core:util.runtime")) api(project(":core:util.runtime"))
api(kotlinStdlib()) api(kotlinStdlib())
api(project(":kotlin-annotations-jvm")) api(project(":kotlin-annotations-jvm"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -13,7 +13,6 @@ dependencies {
api(project(":core:deserialization.common.jvm")) api(project(":core:deserialization.common.jvm"))
api(project(":core:util.runtime")) api(project(":core:util.runtime"))
api(commonDependency("javax.inject")) api(commonDependency("javax.inject"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
@@ -26,8 +26,6 @@ dependencies {
testApi(projectTests(":generators:test-generator")) testApi(projectTests(":generators:test-generator"))
testApi(intellijCore()) testApi(intellijCore())
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -10,7 +10,6 @@ dependencies {
api(project(":core:util.runtime")) api(project(":core:util.runtime"))
api(kotlinStdlib()) api(kotlinStdlib())
api(project(":kotlin-annotations-jvm")) api(project(":kotlin-annotations-jvm"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
@@ -9,7 +9,6 @@ dependencies {
api(project(":core:metadata.jvm")) api(project(":core:metadata.jvm"))
api(project(":core:deserialization.common")) api(project(":core:deserialization.common"))
implementation(project(":core:compiler.common.jvm")) implementation(project(":core:compiler.common.jvm"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
@@ -8,7 +8,6 @@ project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
dependencies { dependencies {
api(project(":core:compiler.common")) api(project(":core:compiler.common"))
api(project(":core:metadata")) api(project(":core:metadata"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -11,7 +11,6 @@ dependencies {
api(project(":core:util.runtime")) api(project(":core:util.runtime"))
api(project(":core:descriptors")) api(project(":core:descriptors"))
api(commonDependency("javax.inject")) api(commonDependency("javax.inject"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -7,7 +7,6 @@ project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
dependencies { dependencies {
api(project(":core:metadata")) api(project(":core:metadata"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -8,7 +8,6 @@ project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
dependencies { dependencies {
api(protobufLite()) api(protobufLite())
api(kotlinStdlib()) api(kotlinStdlib())
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -7,7 +7,6 @@ project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
dependencies { dependencies {
compileOnly(kotlinStdlib()) compileOnly(kotlinStdlib())
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
@@ -7,7 +7,6 @@ JvmToolchain.updateJvmTarget(project, "1.6")
dependencies { dependencies {
api kotlinStdlib("common") api kotlinStdlib("common")
testApi project(":kotlin-test:kotlin-test-annotations-common") testApi project(":kotlin-test:kotlin-test-annotations-common")
kotlinCompilerClasspath project(':libraries:tools:stdlib-compiler-classpath')
} }
jar { jar {
-1
View File
@@ -16,7 +16,6 @@ dependencies {
expectedBy project(':kotlin-test:kotlin-test-annotations-common') expectedBy project(':kotlin-test:kotlin-test-annotations-common')
api project(':kotlin-test:kotlin-test-jvm') api project(':kotlin-test:kotlin-test-jvm')
api('junit:junit:4.13.2') api('junit:junit:4.13.2')
kotlinCompilerClasspath(project(':libraries:tools:stdlib-compiler-classpath'))
} }
-1
View File
@@ -19,7 +19,6 @@ dependencies {
api(kotlinStdlib()) api(kotlinStdlib())
testApi(project(":kotlin-test:kotlin-test-junit")) testApi(project(":kotlin-test:kotlin-test-junit"))
testApi('junit:junit:4.13.2') testApi('junit:junit:4.13.2')
kotlinCompilerClasspath(project(':libraries:tools:stdlib-compiler-classpath'))
} }
jar { jar {
@@ -20,7 +20,6 @@ dependencies {
if (includeJava9) { if (includeJava9) {
java9CompileOnly('org.testng:testng:7.0.0') java9CompileOnly('org.testng:testng:7.0.0')
} }
kotlinCompilerClasspath project(':libraries:tools:stdlib-compiler-classpath')
} }
jar { jar {
-1
View File
@@ -29,7 +29,6 @@ dependencies {
compileOnly project(':core:descriptors.runtime') compileOnly project(':core:descriptors.runtime')
compileOnly project(':core:util.runtime') compileOnly project(':core:util.runtime')
compileOnly "org.jetbrains:annotations:13.0" compileOnly "org.jetbrains:annotations:13.0"
kotlinCompilerClasspath project(':libraries:tools:stdlib-compiler-classpath')
} }
if (includeJava9) { if (includeJava9) {
@@ -9,7 +9,6 @@ dependencies {
api(kotlinStdlib()) api(kotlinStdlib())
compileOnly(project(":kotlin-reflect-api")) compileOnly(project(":kotlin-reflect-api"))
testApi(commonDependency("junit")) testApi(commonDependency("junit"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
@@ -21,7 +21,6 @@ dependencies {
testRuntimeOnly("org.slf4j:slf4j-nop:1.7.36") testRuntimeOnly("org.slf4j:slf4j-nop:1.7.36")
testImplementation(kotlin("reflect")) testImplementation(kotlin("reflect"))
testImplementation(commonDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) testImplementation(commonDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
@@ -10,7 +10,6 @@ dependencies {
api(project(":kotlin-scripting-common")) api(project(":kotlin-scripting-common"))
testApi(commonDependency("junit")) testApi(commonDependency("junit"))
testImplementation(commonDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) testImplementation(commonDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -10,7 +10,6 @@ dependencies {
api(kotlinStdlib()) api(kotlinStdlib())
api(project(":kotlin-scripting-common")) api(project(":kotlin-scripting-common"))
testApi(commonDependency("junit")) testApi(commonDependency("junit"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-1
View File
@@ -44,7 +44,6 @@ configurations {
dependencies { dependencies {
api project(':kotlin-stdlib') api project(':kotlin-stdlib')
testApi project(':kotlin-test:kotlin-test-junit') testApi project(':kotlin-test:kotlin-test-junit')
kotlinCompilerClasspath project(':libraries:tools:stdlib-compiler-classpath')
} }
jar { jar {
@@ -20,7 +20,6 @@ val builtins by configurations.creating {
dependencies { dependencies {
compileOnly(project(":kotlin-stdlib")) compileOnly(project(":kotlin-stdlib"))
builtins(project(":core:builtins")) builtins(project(":core:builtins"))
kotlinCompilerClasspath(project(":libraries:tools:stdlib-compiler-classpath"))
} }
sourceSets { sourceSets {
-2
View File
@@ -63,8 +63,6 @@ dependencies {
testApi project(':kotlin-test:kotlin-test-junit') testApi project(':kotlin-test:kotlin-test-junit')
builtins project(':core:builtins') builtins project(':core:builtins')
kotlinCompilerClasspath project(':libraries:tools:stdlib-compiler-classpath')
} }
jar { jar {
@@ -16,7 +16,6 @@ sourceSets {
dependencies { dependencies {
compileOnly DependenciesKt.kotlinBuiltins(project) compileOnly DependenciesKt.kotlinBuiltins(project)
kotlinCompilerClasspath project(':libraries:tools:stdlib-compiler-classpath')
} }
configureSourcesJar() configureSourcesJar()
@@ -8,7 +8,6 @@ configurePublishing(project)
dependencies { dependencies {
compileOnly kotlinStdlib() compileOnly kotlinStdlib()
kotlinCompilerClasspath project(':libraries:tools:stdlib-compiler-classpath')
} }
sourceSets { sourceSets {