Slackbot
05/04/2022, 4:46 PMChris Lee
05/04/2022, 4:47 PMJohn Bellini
05/04/2022, 4:55 PMChris Lee
05/04/2022, 4:58 PMjava {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
One can also set the JVM vendor (Adoptium, etc) to use if so desired. Note the toolchain JVM version is separate from the JVM used to execute Gradle. For all our Gradle builds, the Gradle JVM is 17 with the toolchain set per-project as required.JamesX
05/04/2022, 5:15 PMJamesX
05/04/2022, 5:16 PM--add-exports that I need for part of my build, and I'm now using toolchains, I can't seem to use those w/ the --release flag. Can I still suppress --release or is there something else I need to do to add some exports?Chris Lee
05/04/2022, 5:18 PM--release may not be required, as the toolchain explicitly sets the JVM version to use.JamesX
05/04/2022, 5:18 PMsourceCompatibility and targetCompatibility would suppress --release flag, but we can't use those anymore w/ toolchain.Chris Lee
05/04/2022, 5:20 PMVampire
05/04/2022, 5:20 PMsource- / targetCompatibility if you are using Java toolchains feature? One practially superseeds the other. You configure the toolchain that you would have set for compatibility.JamesX
05/04/2022, 5:21 PM--add-exports. This does not work with --release and using toolchains causes --release to be used.JamesX
05/04/2022, 5:21 PMsource/targetCompatibility was suppressing --release and allowing --add-exports to work.Vampire
05/04/2022, 5:22 PM--release I think. It is not necessary, as the correct Java version is used to execute the compiler, so --release would be superfluous, wouldn't it?
Besides why should add-exports not work with release?Vampire
05/04/2022, 5:22 PMVampire
05/04/2022, 5:23 PM--add-exports wouldn't make any senseJamesX
05/04/2022, 5:23 PMJamesX
05/04/2022, 5:24 PMChris Lee
05/04/2022, 5:25 PMJamesX
05/04/2022, 5:25 PM--add-exportsChris Lee
05/04/2022, 5:26 PM--release being part of the arguments, worth figuring out where that is coming from.JamesX
05/04/2022, 5:31 PMChris Lee
05/04/2022, 5:32 PMJamesX
05/04/2022, 5:32 PMChris Lee
05/04/2022, 5:33 PMJamesX
05/04/2022, 5:33 PMJamesX
05/04/2022, 5:33 PMVampire
05/04/2022, 5:49 PMChris Lee
05/04/2022, 5:53 PMif (!isSourceOrTargetConfigured) {
JavaLanguageVersion languageVersion = toolchain.getLanguageVersion();
if (languageVersion.canCompileOrRun(10)) {
spec.setRelease(languageVersion.asInt());
} else {
String version = languageVersion.toString();
spec.setSourceCompatibility(version);
spec.setTargetCompatibility(version);
}
}Chris Lee
05/04/2022, 5:53 PMChris Lee
05/04/2022, 5:53 PM