Files
spring-pulsar/gradle/java-conventions.gradle
Chris Bono 19957ac619 Add Java 21 support for running tests (#622)
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
2024-03-22 10:51:10 -05:00

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)
}
}
}
}
}