Skip to content

Commit fddc63e

Browse files
authored
Merge pull request #278 from Yubico/gradle-jdk
Don't prescribe which Java toolchain to use
2 parents 094f746 + 373678b commit fddc63e

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ jobs:
4444
- name: Compile libraries and tests
4545
run: ./gradlew clean testClasses
4646

47-
- name: Build archives
48-
run: ./gradlew assemble
49-
5047
- name: Set up JDK ${{ matrix.java }}
5148
uses: actions/setup-java@v3
5249
with:
@@ -56,6 +53,19 @@ jobs:
5653
- name: Run tests against JDK17-compiled code
5754
run: ./gradlew test --exclude-task compileJava
5855

56+
- name: Archive HTML test report on failure
57+
if: ${{ failure() }}
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: test-reports-java17-java${{ matrix.java }}-${{ matrix.distribution }}-html
61+
path: "*/build/reports/**"
62+
63+
- name: Build and test with JDK ${{ matrix.java }}
64+
run: ./gradlew clean test
65+
66+
- name: Build archives
67+
run: ./gradlew assemble
68+
5969
- name: Archive HTML test report
6070
if: ${{ always() }}
6171
uses: actions/upload-artifact@v3
@@ -71,6 +81,7 @@ jobs:
7181
path: "*/build/test-results/**/*.xml"
7282

7383
- name: Check binary reproducibility
84+
if: ${{ matrix.java != 8 }} # JDK 8 does not produce reproducible binaries
7485
run: |
7586
./gradlew clean primaryPublishJar
7687
find . -name '*.jar' | xargs sha256sum | tee checksums.sha256sum

buildSrc/src/main/kotlin/project-convention-java.gradle.kts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,15 @@ plugins {
22
java
33
}
44

5-
java {
6-
toolchain {
7-
// Java 8 binaries are not reproducible
8-
languageVersion.set(JavaLanguageVersion.of(11))
9-
}
10-
}
11-
125
tasks.withType(JavaCompile::class) {
136
options.compilerArgs.add("-Xlint:deprecation")
147
options.compilerArgs.add("-Xlint:unchecked")
158
options.encoding = "UTF-8"
16-
options.release.set(8)
17-
}
189

19-
tasks.withType(Test::class) {
20-
javaLauncher.set(javaToolchains.launcherFor {
21-
languageVersion.set(JavaLanguageVersion.of(8))
22-
})
10+
if (JavaVersion.current().isJava9Compatible) {
11+
options.release.set(8)
12+
} else {
13+
targetCompatibility = "1.8"
14+
sourceCompatibility = "1.8"
15+
}
2316
}

buildSrc/src/main/kotlin/project-convention-scala.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ tasks.withType(ScalaCompile::class) {
88
// See: https://github.com/gradle/gradle/pull/23198
99
// See: https://github.com/gradle/gradle/pull/23751
1010
scalaCompileOptions.additionalParameters = mutableListOf("-Wunused")
11-
javaLauncher.set(javaToolchains.launcherFor {
12-
languageVersion.set(JavaLanguageVersion.of(8))
13-
})
1411
}

0 commit comments

Comments
 (0)