Target Java 16

This commit is contained in:
Username404 2021-10-26 12:50:35 +02:00
parent 4c7face8a1
commit 30f4fc2232
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 11 additions and 14 deletions

View File

@ -35,7 +35,8 @@ group = "fr.username404"
version = "0.3.4" version = "0.3.4"
val groupAndName = "${rootProject.group}.${rootProject.name.toLowerCase()}" val groupAndName = "${rootProject.group}.${rootProject.name.toLowerCase()}"
val javaVer: String = "8" val javaVer: String = "16"
val sourceJavaVer: String = javaVer
val kotlinVer: String by rootProject val kotlinVer: String by rootProject
val kotlinSplitVersion = kotlinVer.split('.') val kotlinSplitVersion = kotlinVer.split('.')
val serializationVer: String by rootProject val serializationVer: String by rootProject
@ -171,17 +172,15 @@ subprojects {
}) })
} }
val homeDir = System.getProperty("java.home") as String val homeDir = System.getProperty("java.home") as String
if (JavaVersion.current().isJava9Compatible) { val jmodsLocations = setOf(
val jmodsLocations = setOf( "$homeDir/jmods/java.base.jmod",
"$homeDir/jmods/java.base.jmod", "$homeDir/jmods/java.desktop.jmod",
"$homeDir/jmods/java.desktop.jmod", "$homeDir/jmods/java.instrument.jmod"
"$homeDir/jmods/java.instrument.jmod" )
) if (jmodsLocations.all { !file(it).exists() }) throw GradleException("Jmods appear to be missing, please make sure that jmods are installed.")
if (jmodsLocations.all { !file(it).exists() }) throw GradleException("Jmods appear to be missing, please make sure that jmods are installed.") else jmodsLocations.forEach {
else jmodsLocations.forEach { libraryjars(it)
libraryjars(it) }
}
} else libraryjars("$homeDir/lib/rt.jar")
// Note: dontpreverify() should NOT be used, it will cause errors at runtime // Note: dontpreverify() should NOT be used, it will cause errors at runtime
useuniqueclassmembernames() useuniqueclassmembernames()
optimizationpasses(4) optimizationpasses(4)
@ -220,7 +219,6 @@ allprojects {
dependencies { dependencies {
implementation(kotlin("stdlib-jdk8", kotlinVer)) implementation(kotlin("stdlib-jdk8", kotlinVer))
implementation(kotlin("reflect", kotlinVer)) implementation(kotlin("reflect", kotlinVer))
annotationProcessor("com.github.bsideup.jabel:jabel-javac-plugin:0.4.2")
} }
tasks { tasks {
withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) { withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
@ -244,7 +242,6 @@ allprojects {
release.set(javaVer.toInt()) release.set(javaVer.toInt())
sourceCompatibility = "11" sourceCompatibility = "11"
targetCompatibility = javaVer targetCompatibility = javaVer
compilerArgs.add("-Xplugin:jabel")
} }
} }
withType(ProcessResources::class) { withType(ProcessResources::class) {