Skip to content

Commit 2383b0a

Browse files
committed
Update build.gradle
1 parent 9a540b3 commit 2383b0a

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

lib/build.gradle

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,22 @@ dependencies {
4747
// Apply a specific Java toolchain to ease working on different environments.
4848
java {
4949
toolchain {
50-
languageVersion = JavaLanguageVersion.of(17)
50+
// Support Java 17 and 25
51+
languageVersion = JavaLanguageVersion.of(
52+
System.getenv('JAVA_VERSION')?.toInteger() ?: 25
53+
)
5154
}
55+
// Allow building with Java 17 or 25
56+
sourceCompatibility = JavaVersion.VERSION_17
57+
targetCompatibility = JavaVersion.VERSION_17
5258
}
5359

54-
// Enable Java 11 compatibility to support NextFlow.
55-
tasks {
56-
sourceCompatibility = '11'
57-
targetCompatibility = '11'
58-
}
59-
60-
compileJava {
61-
options.release.set(11)
60+
// Allow compiling with Java 25 if available
61+
tasks.withType(JavaCompile) {
62+
options.release.set(17)
63+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
64+
options.release.set(25)
65+
}
6266
}
6367

6468
test {

0 commit comments

Comments
 (0)