From 90eac991de09d80e15c6b5fb44df951e2500e7e1 Mon Sep 17 00:00:00 2001 From: Guillermo Mazzola Date: Fri, 12 Jan 2024 15:27:34 +0100 Subject: [PATCH] Targeting `jvm-1.8` for plugin jar --- plugin/build.gradle.kts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index bdb4a80..9f9c40b 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -12,11 +12,14 @@ version = providers .exec { commandLine("git", "describe", "--tags", "--always") } .standardOutput.asText.get().trim().removePrefix("v") -java.toolchain.languageVersion = JavaLanguageVersion.of(libs.versions.java.get()) +// Stay at Java 8 to workaround the Gradle when compiling buildscripts and using our `inline` functions: +// `Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8` issue +// https://github.com/gmazzo/gradle-buildconfig-plugin/issues/120 +java.toolchain.languageVersion = JavaLanguageVersion.of(8) kotlin { compilerOptions { - freeCompilerArgs.add("-Xjvm-default=all",) + freeCompilerArgs.add("-Xjvm-default=all") } } @@ -61,6 +64,7 @@ tasks.withType { dependsOn("publishAllPublicationsToLocalRepository") workingDir = temporaryDir useJUnitPlatform() + javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(libs.versions.java.get()) } doLast { Thread.sleep(5000) } // allows GradleRunner to store JaCoCo data before computing task outputs }