[Build] Make JVM target settings logic less imperative
Previously actual value was dependent on the order of calls to `updateJvmTarget` and `configureJava9Compilation` in build script that may lead to inconsistencies
This commit is contained in:
committed by
Space
parent
2f230833ac
commit
f27f91b03a
@@ -143,14 +143,21 @@ fun JavaCompile.configureTaskToolchain(
|
|||||||
fun Project.updateJvmTarget(
|
fun Project.updateJvmTarget(
|
||||||
jvmTarget: String
|
jvmTarget: String
|
||||||
) {
|
) {
|
||||||
tasks.withType<KotlinCompile>().configureEach {
|
// Java 9 tasks are exceptions that are configured in configureJava9Compilation
|
||||||
kotlinOptions.jvmTarget = jvmTarget
|
tasks
|
||||||
}
|
.withType<KotlinCompile>()
|
||||||
|
.matching { it.name != "compileJava9Kotlin" }
|
||||||
|
.configureEach {
|
||||||
|
kotlinOptions.jvmTarget = jvmTarget
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile>().configureEach {
|
tasks
|
||||||
sourceCompatibility = jvmTarget
|
.withType<JavaCompile>()
|
||||||
targetCompatibility = jvmTarget
|
.matching { it.name != "compileJava9Java" }
|
||||||
}
|
.configureEach {
|
||||||
|
sourceCompatibility = jvmTarget
|
||||||
|
targetCompatibility = jvmTarget
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Project.getToolchainCompilerFor(
|
private fun Project.getToolchainCompilerFor(
|
||||||
|
|||||||
Reference in New Issue
Block a user