diff --git a/build.gradle.kts b/build.gradle.kts index 2d07237..cea3a18 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,6 +28,7 @@ architectury { } val javaVer: String = "8" +val sourceJavaVer: String = "16" val kotlinVer: String by rootProject val kotlinBaseVer = kotlinVer.substring(0..2) val mcBase: String = rootProject.architectury.minecraft.substring(0..3) @@ -152,9 +153,7 @@ allprojects { apply(plugin = "java") apply(plugin = "org.jetbrains.kotlin.jvm") apply(plugin = "architectury-plugin") - java { - sourceCompatibility = JavaVersion.VERSION_11 - } + val compiler = javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion.of(sourceJavaVer.toInt())) } dependencies { implementation(kotlin("stdlib-jdk8", kotlinVer)) implementation(kotlin("reflect", kotlinVer)) @@ -178,12 +177,15 @@ allprojects { with(options) { encoding = "UTF-8" isFork = true + release.set(javaVer.toInt()) + javaCompiler.set(compiler) // The following lines are required for Jabel: + sourceCompatibility = sourceJavaVer forkOptions.jvmArgs!!.addAll(listOf( "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" )) // Java 16+ support - compilerArgs.addAll(listOf("-Xplugin:jabel", "--release", javaVer)) + compilerArgs.addAll(listOf("-Xplugin:jabel")) } } withType(ProcessResources::class) {