Skip to content

Commit

Permalink
Working on different build options
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrail committed Sep 16, 2024
1 parent 4ae3aa8 commit 4ced4f5
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions buildSrc/src/main/groovy/rhino.java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'com.diffplug.spotless'
}

int testJavaVersion = 11
int testJavaVersion = -1
String jv = System.getenv("RHINO_TEST_JAVA_VERSION")
if (jv != null) {
testJavaVersion = Integer.parseInt(jv);
Expand All @@ -23,22 +23,19 @@ dependencies {
testImplementation "javax.xml.soap:javax.xml.soap-api:1.4.0"
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 11
options.compilerArgs = [
'-Xlint:deprecation,unchecked'
]
}

tasks.withType(Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(testJavaVersion)
if (testJavaVersion > 0) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(testJavaVersion)
}
}
}

Expand All @@ -50,9 +47,9 @@ spotless {
// There is no version of googleJavaFormat that works for Java 11 and 17,
// and different versions format differently. For now, only run spotless on Java 11.
// This will have to be changed when Java 11 support is removed.
if (JavaVersion.current() == JavaVersion.VERSION_11) {
if (JavaVersion.current() == JavaVersion.VERSION_21) {
java {
googleJavaFormat('1.10.0').aosp()
googleJavaFormat('1.17.0').aosp()
}
} else {
System.out.println("Not running Spotless: Java language version is " + JavaVersion.current())
Expand Down

0 comments on commit 4ced4f5

Please sign in to comment.