Support toolchain switching and JDK 21
Issue gh-12790 Issue gh-13811
This commit is contained in:
parent
0e8d04ab40
commit
f3a012eaa2
39
build.gradle
39
build.gradle
|
@ -123,16 +123,35 @@ updateDependenciesSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
def toolchainVersion() {
|
||||||
plugins.withType(JavaPlugin) {
|
if (project.hasProperty('testToolchain')) {
|
||||||
project.sourceCompatibility=JavaVersion.VERSION_17
|
return project.property('testToolchain').toString().toInteger()
|
||||||
}
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
options.compilerArgs.add("-parameters")
|
|
||||||
}
|
}
|
||||||
|
return 17
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
def toolchainVersion = toolchainVersion()
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
options.compilerArgs.add("-parameters")
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(toolchainVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(Test).configureEach {
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(toolchainVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
|
if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
|
||||||
|
@ -158,12 +177,6 @@ allprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
javaCompiler = javaToolchains.compilerFor {
|
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasProperty('buildScan')) {
|
if (hasProperty('buildScan')) {
|
||||||
|
|
Loading…
Reference in New Issue