diff --git a/build.gradle.kts b/build.gradle.kts index 1842e03..8d8df9b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,6 +21,23 @@ plugins { alias(libs.plugins.vanniktech.mavenPublish) apply false } +// Some JVM dependencies are published as Java 21 bytecode. Keep the library's +// Java 17 compilation target, but use a compatible runtime for its JVM tests. +project(":lynglib") { + afterEvaluate { + val toolchains = extensions.getByType() + tasks.withType().configureEach { + javaLauncher.set(toolchains.launcherFor { + languageVersion.set(JavaLanguageVersion.of(21)) + }) + // An explicit jvmTest invocation should execute the suite rather than + // silently reusing the previous test task outputs or build-cache entry. + outputs.upToDateWhen { false } + outputs.cacheIf { false } + } + } +} + // Convenience alias to run the IntelliJ IDE with the Lyng plugin from the project root. // Usage: ./gradlew runIde // It simply delegates to :lyng-idea:runIde provided by the Gradle IntelliJ Plugin. diff --git a/gradle.properties b/gradle.properties index c4d6800..e0fc8ad 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,8 @@ # #Gradle -org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" +org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" --add-opens=java.base/java.lang=ALL-UNNAMED +org.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64 org.gradle.caching=true org.gradle.configuration-cache=true #Kotlin diff --git a/lynglib/build.gradle.kts b/lynglib/build.gradle.kts index ba1a659..505de24 100644 --- a/lynglib/build.gradle.kts +++ b/lynglib/build.gradle.kts @@ -47,7 +47,11 @@ buildkonfig { kotlin { jvmToolchain(17) - jvm() + jvm { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } + } androidTarget { publishLibraryVariants("release") @OptIn(ExperimentalKotlinGradlePluginApi::class) @@ -297,8 +301,8 @@ android { minSdk = libs.versions.android.minSdk.get().toInt() } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } } dependencies {