Skip to content

Commit cc5724f

Browse files
authored
test: use Java 17 to produce Java 8-compatible bytecode (#1681)
* test: java 8 when running Java 8 test * Use Java 17 to produce Java 8-compatible bytecode
1 parent bc8a4ad commit cc5724f

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,30 +65,19 @@ jobs:
6565
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
6666
- uses: actions/setup-java@v3
6767
with:
68-
java-version: 11
68+
java-version: 17
6969
distribution: temurin
70-
- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
71-
- name: Compile with Java 11
70+
- name: Compile with Java 17 and run tests with Java 8
7271
shell: bash
7372
run: |
7473
set -x
7574
export JAVA_HOME=$JAVA11_HOME
7675
export PATH=${JAVA_HOME}/bin:$PATH
77-
# Why not compile? It's because the process needs to package jar so
78-
# that gapic-generator-java module can use testlib modules of gax.
76+
# Maven surefire plugin lets us to specify the JVM when running tests via
77+
# the "jvm" system property.
7978
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
80-
-DskipTests -Dfmt.skip
81-
- name: Run test with Java 8 for all modules except gapic-generator-java
82-
shell: bash
83-
run: |
84-
set -x
85-
export JAVA_HOME=$JAVA8_HOME
86-
export PATH=${JAVA_HOME}/bin:$PATH
87-
# useIncrementalCompilation=false to avoid recompiling classes
88-
# generated by Java 11 compiler above.
89-
mvn -B -ntp test --projects '!gapic-generator-java' \
90-
-Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false \
91-
-Dfmt.skip
79+
-Dfmt.skip \
80+
-Djvm="${JAVA8_HOME}/bin/java"
9281
9382
build-java8-gapic-generator-java:
9483
name: "build(8) for gapic-generator-java"

.kokoro/release/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build_file: "gapic-generator-java/.kokoro/trampoline.sh"
99
# Configure the docker image for kokoro-trampoline.
1010
env_vars: {
1111
key: "TRAMPOLINE_IMAGE"
12-
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
12+
value: "gcr.io/cloud-devrel-kokoro-resources/java17"
1313
}
1414

1515
before_action {

0 commit comments

Comments
 (0)