diff --git a/buildSrc/src/main/kotlin/IdeaConfiguration.kt b/buildSrc/src/main/kotlin/IdeaConfiguration.kt index 1f3d43159..c9af48d9f 100644 --- a/buildSrc/src/main/kotlin/IdeaConfiguration.kt +++ b/buildSrc/src/main/kotlin/IdeaConfiguration.kt @@ -1,5 +1,7 @@ import java.util.concurrent.atomic.AtomicBoolean import org.gradle.api.Project +import org.gradle.api.provider.Property +import org.gradle.jvm.toolchain.JavaLanguageVersion enum class SupportedIJVersion { IJ_232, @@ -35,3 +37,6 @@ fun Project.supportedIJVersion(): SupportedIJVersion { ) } } + +fun Property.assign(version: Int) = + set(JavaLanguageVersion.of(version)) diff --git a/buildSrc/src/main/kotlin/jewel.gradle.kts b/buildSrc/src/main/kotlin/jewel.gradle.kts index 852b93be5..07cd2a2b3 100644 --- a/buildSrc/src/main/kotlin/jewel.gradle.kts +++ b/buildSrc/src/main/kotlin/jewel.gradle.kts @@ -15,8 +15,18 @@ version = when { else -> "1.0.0-SNAPSHOT" } +java { + toolchain { + vendor = JvmVendorSpec.JETBRAINS + languageVersion = 17 + } +} + kotlin { - jvmToolchain(17) + jvmToolchain { + vendor = JvmVendorSpec.JETBRAINS + languageVersion = 17 + } target { compilations.all { kotlinOptions { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 27313fbc8..fce403e45 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/standalone/build.gradle.kts b/samples/standalone/build.gradle.kts index 8f2063a42..4aba684e5 100644 --- a/samples/standalone/build.gradle.kts +++ b/samples/standalone/build.gradle.kts @@ -37,3 +37,17 @@ compose.desktop { } } } + +tasks { + withType { + // afterEvaluate is needed because the Compose Gradle Plugin + // register the task in the afterEvaluate block + afterEvaluate { + javaLauncher = project.javaToolchains.launcherFor { + languageVersion = 17 + vendor = JvmVendorSpec.JETBRAINS + } + setExecutable(javaLauncher.map { it.executablePath.asFile.absolutePath }.get()) + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index a80bcfc89..4cc74a646 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,6 +27,7 @@ dependencyResolutionManagement { plugins { id("com.gradle.enterprise") version "3.15.1" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" } include(