diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 68751fe39..aa81eb7c3 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,9 +1,19 @@ +import java.util.Properties + plugins { `kotlin-dsl` alias(libs.plugins.kotlinx.serialization) } +val properties = Properties() +project.file("../gradle.properties").inputStream().use { properties.load(it) } + +val jdkLevel = properties.getProperty("jdk.level") as String kotlin { + jvmToolchain { + languageVersion = JavaLanguageVersion.of(jdkLevel) + } + sourceSets { all { languageSettings { diff --git a/buildSrc/src/main/kotlin/jewel.gradle.kts b/buildSrc/src/main/kotlin/jewel.gradle.kts index 96c548f3a..702d39555 100644 --- a/buildSrc/src/main/kotlin/jewel.gradle.kts +++ b/buildSrc/src/main/kotlin/jewel.gradle.kts @@ -19,13 +19,6 @@ version = when { } val jdkLevel = project.property("jdk.level") as String -java { - toolchain { - languageVersion = JavaLanguageVersion.of(jdkLevel) - } - -} - kotlin { jvmToolchain { languageVersion = JavaLanguageVersion.of(jdkLevel) @@ -87,14 +80,3 @@ configurations.named("sarif") { artifact(sarifReport) { builtBy(tasks.lintKotlinMain) } } } - -fun Task.removeAssembleDependency() { - setDependsOn( - dependsOn.filter { - when { - it is Task && it.name == "assemble" -> false - else -> true - } - } - ) -} diff --git a/samples/standalone/build.gradle.kts b/samples/standalone/build.gradle.kts index 4fa8e48bf..d19b9e8be 100644 --- a/samples/standalone/build.gradle.kts +++ b/samples/standalone/build.gradle.kts @@ -21,14 +21,10 @@ dependencies { implementation(libs.intellijPlatform.icons) } -java { - toolchain { - vendor = JvmVendorSpec.JETBRAINS - } -} - +val jdkLevel = project.property("jdk.level") as String kotlin { jvmToolchain { + languageVersion = JavaLanguageVersion.of(jdkLevel) vendor = JvmVendorSpec.JETBRAINS } } @@ -56,7 +52,6 @@ compose.desktop { } } -val jdkLevel = project.property("jdk.level") as String tasks { withType { // afterEvaluate is needed because the Compose Gradle Plugin