Set the java compiler --release arg when building on j9+.

Thanks to https://github.com/FabricMC/fabric-example-mod/pull/71 for this snippet.
This commit is contained in:
modmuss50 2020-11-10 19:58:58 +00:00
parent c932210082
commit c2f49c1532

View file

@ -64,8 +64,15 @@ allprojects {
apply plugin: "fabric-loom"
apply plugin: "net.minecrell.licenser"
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile).configureEach {
def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
} else {
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = JavaVersion.toVersion(targetVersion)
}
}
group = "net.fabricmc.fabric-api"