Skip to content

Commit

Permalink
test: use Java 17 to produce Java 8-compatible bytecode (#1681)
Browse files Browse the repository at this point in the history
* test: java 8 when running Java 8 test

* Use Java 17 to produce Java 8-compatible bytecode
  • Loading branch information
suztomo committed May 15, 2023
1 parent bc8a4ad commit cc5724f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
23 changes: 6 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,19 @@ jobs:
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: temurin
- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- name: Compile with Java 11
- name: Compile with Java 17 and run tests with Java 8
shell: bash
run: |
set -x
export JAVA_HOME=$JAVA11_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# Why not compile? It's because the process needs to package jar so
# that gapic-generator-java module can use testlib modules of gax.
# Maven surefire plugin lets us to specify the JVM when running tests via
# the "jvm" system property.
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-DskipTests -Dfmt.skip
- name: Run test with Java 8 for all modules except gapic-generator-java
shell: bash
run: |
set -x
export JAVA_HOME=$JAVA8_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# useIncrementalCompilation=false to avoid recompiling classes
# generated by Java 11 compiler above.
mvn -B -ntp test --projects '!gapic-generator-java' \
-Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false \
-Dfmt.skip
-Dfmt.skip \
-Djvm="${JAVA8_HOME}/bin/java"
build-java8-gapic-generator-java:
name: "build(8) for gapic-generator-java"
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/release/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build_file: "gapic-generator-java/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
value: "gcr.io/cloud-devrel-kokoro-resources/java17"
}

before_action {
Expand Down

0 comments on commit cc5724f

Please sign in to comment.