Skip to content

Commit ff54182

Browse files
committed
javaVersion
1 parent 5ca751c commit ff54182

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ subprojects {
5151
apply plugin: 'java-library'
5252
apply plugin: 'org.inferred.processors'
5353

54-
sourceCompatibility = JavaVersion.VERSION_11
55-
targetCompatibility = JavaVersion.VERSION_11
56-
5754
tasks.withType(Checkstyle).configureEach {
5855
enabled = false
5956
}
@@ -71,7 +68,7 @@ subprojects {
7168
}
7269

7370
javaVersions {
74-
libraryTarget = 21
71+
libraryTarget = 17
7572
runtime = 21
7673
}
7774

palantir-java-format-spi/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ dependencies {
1111
testImplementation 'org.junit.jupiter:junit-jupiter'
1212
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
1313
}
14+
15+
tasks.withType(JavaCompile).named('compileJava') {
16+
sourceCompatibility = JavaVersion.VERSION_11
17+
targetCompatibility = JavaVersion.VERSION_11
18+
}
19+
20+
javaVersion {
21+
target = 21
22+
}

palantir-java-format/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ moduleJvmArgs {
4141
'jdk.compiler/com.sun.tools.javac.api')
4242
}
4343

44+
tasks.withType(JavaCompile).named('compileJava') {
45+
// By setting the source and target compatibility to 11, while still using a higher level
46+
// JDK for compilation, we can compile against the AST classes we need to support >11 source
47+
// features but still run on 11 JDKs (with the addition of checking the java version at runtime
48+
// and dynamically loading the correct formatter implementation)
49+
sourceCompatibility = JavaVersion.VERSION_11
50+
targetCompatibility = JavaVersion.VERSION_11
51+
}
52+
4453
// false positives due to org.junit.runners.* in the test cases
4554
tasks.named("checkJUnitDependencies") {
4655
enabled = false
@@ -51,3 +60,7 @@ tasks.named("test") {
5160
// https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution
5261
systemProperty 'junit.jupiter.execution.parallel.mode.default', 'concurrent'
5362
}
63+
64+
javaVersion {
65+
target = 21
66+
}

0 commit comments

Comments
 (0)