This commit adds a Gradle property 'testToolchain' that when set will configure the Java toolchain plugin accordingly. Additionally: ------------- * Replace the custom toolchain plugin with the vanilla one provided by Gradle * Move the Java conventions from Java plugin to Groovy script * [CI] Add Java 21 to check-samples.yml
27 lines
689 B
Groovy
27 lines
689 B
Groovy
def toolchainVersion() {
|
|
if (project.hasProperty('testToolchain')) {
|
|
return project.property('testToolchain').toString().toInteger()
|
|
}
|
|
return 17
|
|
}
|
|
|
|
project.afterEvaluate {
|
|
subprojects { subproject ->
|
|
afterEvaluate {
|
|
if (subproject.plugins.hasPlugin(JavaPlugin.class)) {
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(toolchainVersion())
|
|
}
|
|
}
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = "UTF-8"
|
|
options.compilerArgs.add("-parameters")
|
|
options.compilerArgs.addAll(["-Werror", "-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:rawtypes", "-Xlint:varargs"]);
|
|
options.release.set(17)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|