Skip to content

Commit

Permalink
build.gradle.kts: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jun 22, 2024
1 parent 2189b67 commit 3ecd25e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ checkstyle {
toolVersion = libs.versions.checkstyle.get()
}

val javaVersion = JavaVersion.current()

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -29,14 +31,14 @@ tasks.named<Jar>("jar") {

tasks.withType<JavaCompile>().all { // Java compile-time options:
options.compilerArgs.add("-Xdiags:verbose")
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_20)) {
if (javaVersion.isCompatibleWith(JavaVersion.VERSION_20)) {
// Suppress warnings that source value 8 is obsolete.
options.compilerArgs.add("-Xlint:-options")
}
options.compilerArgs.add("-Xlint:unchecked")
options.setDeprecation(true) // to provide detailed deprecation warnings
options.encoding = "UTF-8"
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_10)) {
if (javaVersion.isCompatibleWith(JavaVersion.VERSION_1_10)) {
options.release = 8
}
}
Expand Down

0 comments on commit 3ecd25e

Please sign in to comment.