gradle: Build with JDK 21

Checkstyle was already requiring JDK 21 and now about libraries need it too

Use the kotlin extension method as it will also configure it for java code

Ref: https://kotlinlang.org/docs/gradle-configure-project.html#gradle-java-toolchains-support

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2026-04-21 11:17:26 +08:00
parent ff597f8e95
commit ad7f8ba9c3

View file

@ -20,13 +20,8 @@ val gitWorkingBranch = providers.exec {
commandLine("git", "rev-parse", "--abbrev-ref", "HEAD")
}.standardOutput.asText.map { it.trim() }
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
kotlin {
jvmToolchain(21)
compilerOptions {
// TODO: Drop annotation default target when it is stable
freeCompilerArgs.addAll(
@ -137,13 +132,6 @@ ksp {
// Custom dependency configuration for ktlint
val ktlint by configurations.creating
// https://checkstyle.org/#JRE_and_JDK
tasks.withType<Checkstyle>().configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
}
}
checkstyle {
configDirectory = rootProject.file("checkstyle")
isIgnoreFailures = false