[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(
|
||||
jvmTarget: String
|
||||
) {
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.jvmTarget = jvmTarget
|
||||
}
|
||||
// Java 9 tasks are exceptions that are configured in configureJava9Compilation
|
||||
tasks
|
||||
.withType<KotlinCompile>()
|
||||
.matching { it.name != "compileJava9Kotlin" }
|
||||
.configureEach {
|
||||
kotlinOptions.jvmTarget = jvmTarget
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
sourceCompatibility = jvmTarget
|
||||
targetCompatibility = jvmTarget
|
||||
}
|
||||
tasks
|
||||
.withType<JavaCompile>()
|
||||
.matching { it.name != "compileJava9Java" }
|
||||
.configureEach {
|
||||
sourceCompatibility = jvmTarget
|
||||
targetCompatibility = jvmTarget
|
||||
}
|
||||
}
|
||||
|
||||
private fun Project.getToolchainCompilerFor(
|
||||
|
||||
Reference in New Issue
Block a user