switch the Java toolchain to version 21

Switch the Java toolchain to version 21 - the version shipped with current AndroidStudio releases.
Disable Java 1.8 warnings - see discussion in PR #4735
This commit is contained in:
Thomas Kuehne
2025-04-25 23:00:01 +02:00
committed by José Rebelo
parent 87fd6b1596
commit 03e14edee4
3 changed files with 12 additions and 4 deletions

View File

@@ -35,9 +35,9 @@ artifacts {
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain.languageVersion = JavaLanguageVersion.of(17)
// setting sourceCompatibility and targetCompatibility isn't required because this module
// ships no complied code
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
tasks.named("distTar") {

View File

@@ -11,6 +11,11 @@ tasks.withType(Test).configureEach {
systemProperty "GB_LOGFILES_DIR", Files.createTempDirectory("gblog").toString()
}
// disable Java 1.8 warning
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xlint:-options"
}
def getVersionCode = { ->
try {
def commitCount = providers.exec {
@@ -68,7 +73,7 @@ def getGitHashShort = { ->
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
android {

View File

@@ -23,3 +23,6 @@ android.enableJetifier=false
# FIXME: This optimizes away some classes it should not - see #3853
android.enableR8.fullMode=false
# disable Java 1.8 warning
android.javaCompile.suppressSourceTargetDeprecationWarning=true