Skip to content

Commit

Permalink
Use "release" option to fix Java 8 binary compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
marianobarrios committed Jul 6, 2024
1 parent 8263cd5 commit 81b9130
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
# The target JDK is used to build, the latest one to run Gradle itself
java-version: |
${{ matrix.java-version }}
21
Expand Down
13 changes: 9 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,27 @@ plugins {
var javaToolchain = System.getenv('JAVA_TOOLCHAIN')

java {
// If running from CI, the tool chain will be present
if (javaToolchain != null) {
toolchain {
languageVersion = JavaLanguageVersion.of(javaToolchain)
}
}
}

println(javaToolchain)

compileJava {
sourceCompatibility = '8'
targetCompatibility = '8'
if (javaToolchain != "8") {
options.release = 8
}
options.compilerArgs.add('-Xlint')
}

compileTestJava {
sourceCompatibility = '8'
targetCompatibility = '8'
if (javaToolchain != "8") {
options.release = 8
}
options.compilerArgs.add('-Xlint')
}

Expand Down

0 comments on commit 81b9130

Please sign in to comment.