From c17c77cde707ae422b1e65fe672b5eef82bf132c Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 15 May 2023 13:48:47 -0400 Subject: [PATCH 1/6] test: adding Java 7 check Using the same method as https://github.com/googleapis/google-http-java-client/pull/1847 to use surefire's jvm system property --- .github/sync-repo-settings.yaml | 1 + .github/workflows/ci-java7.yaml | 55 +++++++++++++++++++++++++++++++++ pom.xml | 4 ++- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci-java7.yaml diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 0ac178c7d..63bca6e48 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -8,6 +8,7 @@ branchProtectionRules: requiresCodeOwnerReviews: true requiresStrictStatusChecks: false requiredStatusCheckContexts: + - units (7) - units (8) - units (11) - windows diff --git a/.github/workflows/ci-java7.yaml b/.github/workflows/ci-java7.yaml new file mode 100644 index 000000000..fff39f96e --- /dev/null +++ b/.github/workflows/ci-java7.yaml @@ -0,0 +1,55 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Github action job to test core java library features on +# downstream client libraries before they are released. +on: + push: + branches: + - main + pull_request: +name: ci-java7 +jobs: + units: + name: "units (7)" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v1 + # setup-java v2 or higher does not have version 1.7 + with: + version: 1.7 + architecture: x64 + - run: | + java -version + # This value is used in "-Djvm=" later + echo "JAVA7_HOME=${JAVA_HOME}" >> $GITHUB_ENV + - uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + - name: Set up Maven + uses: stCarolas/setup-maven@v4.5 + with: + maven-version: 3.8.8 + - name: Build + shell: bash + run: | + # Leveraging surefire's jvm option, running the test on Java 7. + # Surefire plugin 2.22.2 is the last version for Java 7. Newer version would fail with + # "UnsupportedClassVersionError: org/apache/maven/surefire/booter/ForkedBooter" error. + mvn --batch-mode --show-version -ntp test \ + -Dclirr.skip=true -Denforcer.skip=true -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true -T 1C \ + -Dproject.surefire.version=2.22.2 \ + -Djvm=${JAVA7_HOME}/bin/java diff --git a/pom.xml b/pom.xml index 745897781..380520d0a 100644 --- a/pom.xml +++ b/pom.xml @@ -293,7 +293,7 @@ maven-surefire-plugin - 3.1.0 + ${project.surefire.version} -Xmx1024m sponge_log @@ -510,6 +510,8 @@ 3.2.1 4.0.3 2.5 + + 3.0.0-M7 false 2.10.1 From 448f135ab874e5ead9f64d0285615d3b8cf775ae Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 15 May 2023 15:28:25 -0400 Subject: [PATCH 2/6] Guava Android for Java 7 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 380520d0a..9b6dc81af 100644 --- a/pom.xml +++ b/pom.xml @@ -502,7 +502,7 @@ 3.0.2 2.8.6 3.23.0 - 31.1-jre + 31.1-android 2.0.14 1.1.4c 2.3-20090302111651 @@ -511,7 +511,7 @@ 4.0.3 2.5 - 3.0.0-M7 + 3.1.0 false 2.10.1 From 3452b00bd9120fc49a7ca770c63640966edc257a Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 15 May 2023 15:45:24 -0400 Subject: [PATCH 3/6] Guava 30.1.1-android --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9b6dc81af..d397018dc 100644 --- a/pom.xml +++ b/pom.xml @@ -502,7 +502,7 @@ 3.0.2 2.8.6 3.23.0 - 31.1-android + 30.1.1-android 2.0.14 1.1.4c 2.3-20090302111651 From 3232a19a4381fa6470419e47aab9be34754c41a8 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Wed, 17 May 2023 13:56:31 -0400 Subject: [PATCH 4/6] Java 8 to produce Java 7-compatible code --- .github/workflows/ci-java7.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-java7.yaml b/.github/workflows/ci-java7.yaml index fff39f96e..5b1d0507d 100644 --- a/.github/workflows/ci-java7.yaml +++ b/.github/workflows/ci-java7.yaml @@ -36,7 +36,7 @@ jobs: echo "JAVA7_HOME=${JAVA_HOME}" >> $GITHUB_ENV - uses: actions/setup-java@v3 with: - java-version: 17 + java-version: 8 distribution: temurin - name: Set up Maven uses: stCarolas/setup-maven@v4.5 From c1b087c2df17234dbe03836b71ea1d3669bd9348 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Wed, 17 May 2023 15:11:06 -0400 Subject: [PATCH 5/6] skip incompatible class --- .github/workflows/ci-java7.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-java7.yaml b/.github/workflows/ci-java7.yaml index 5b1d0507d..774de4673 100644 --- a/.github/workflows/ci-java7.yaml +++ b/.github/workflows/ci-java7.yaml @@ -48,8 +48,11 @@ jobs: # Leveraging surefire's jvm option, running the test on Java 7. # Surefire plugin 2.22.2 is the last version for Java 7. Newer version would fail with # "UnsupportedClassVersionError: org/apache/maven/surefire/booter/ForkedBooter" error. + # BatchRequestTest is not compatible for Java 7 because it touches Protobuf + # classes (not compatible with Java 7). mvn --batch-mode --show-version -ntp test \ -Dclirr.skip=true -Denforcer.skip=true -Dmaven.javadoc.skip=true \ -Dgcloud.download.skip=true -T 1C \ -Dproject.surefire.version=2.22.2 \ + -D="!com.google.api.client.googleapis.batch.BatchRequestTest" \ -Djvm=${JAVA7_HOME}/bin/java From 555fbab1ca607cce2e7dfceaa6a6308a5a71f20a Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Wed, 17 May 2023 15:24:05 -0400 Subject: [PATCH 6/6] install dependencies --- .github/workflows/ci-java7.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-java7.yaml b/.github/workflows/ci-java7.yaml index 774de4673..3c91ec344 100644 --- a/.github/workflows/ci-java7.yaml +++ b/.github/workflows/ci-java7.yaml @@ -42,6 +42,7 @@ jobs: uses: stCarolas/setup-maven@v4.5 with: maven-version: 3.8.8 + - run: .kokoro/install_dependencies.sh - name: Build shell: bash run: | @@ -54,5 +55,5 @@ jobs: -Dclirr.skip=true -Denforcer.skip=true -Dmaven.javadoc.skip=true \ -Dgcloud.download.skip=true -T 1C \ -Dproject.surefire.version=2.22.2 \ - -D="!com.google.api.client.googleapis.batch.BatchRequestTest" \ + -Dtest='!com.google.api.client.googleapis.batch.BatchRequestTest' \ -Djvm=${JAVA7_HOME}/bin/java