From c58bc33b9005978880249b796c1dd593d9fb13ef Mon Sep 17 00:00:00 2001 From: Sam Berlin Date: Wed, 17 May 2023 11:21:56 -0700 Subject: [PATCH] A bunch of environment changes. * Bump minimum JRE to 11 (from 8). * Change testing matrix from {8,11,15,17} to {11,17,21-ea}. (Except the bazel build has trouble parsing "21-ea" as a java version, so s/21-ea/20 for bazel.) * Also test on macos (but only with jdk17). (Attempted to test on windows too, but there's issues right now.) * Cleanup the POMs a little bit (remove unused mailing list reference, fix CI link) * Bump bazel version to 6.2.0, otherwise the tests fail b/c they try to set a security manager (see https://github.com/bazelbuild/bazel/issues/14502, which was fixed in https://github.com/bazelbuild/bazel/commit/7556e1107b666d10b660470a571631463c7eb4ec, which was cherrypicked into the 6.2.0 release). This also required suppressing the "BanJNDI" errorprone check in the JNDI extension, which was also added to 6.2.0. (A future change should probably just remove the JNDI extension altogether.) PiperOrigin-RevId: 532849632 --- .github/actions/bazel-build/action.yml | 4 +- .github/actions/maven-test/action.yml | 2 +- .github/workflows/ci.yml | 33 ++++++++---- core/pom.xml | 8 --- .../google/inject/example/JndiProvider.java | 1 + .../google/inject/jndi/JndiIntegration.java | 1 + extensions/pom.xml | 7 +-- pom.xml | 51 +++---------------- 8 files changed, 39 insertions(+), 68 deletions(-) diff --git a/.github/actions/bazel-build/action.yml b/.github/actions/bazel-build/action.yml index fa17175728..357c3b9ea3 100644 --- a/.github/actions/bazel-build/action.yml +++ b/.github/actions/bazel-build/action.yml @@ -19,8 +19,8 @@ runs: restore-keys: | ${{ runner.os }}-bazel-build- - name: 'Bazel build' - # Cross compile for Java 8, see http://openjdk.java.net/jeps/247 - run: bazel build --javacopt="--release 8" //... + # Cross compile for Java 11, see http://openjdk.java.net/jeps/247 + run: bazel build --javacopt="--release 11" //... shell: bash - name: 'Install local snapshot' run: ./util/install-local-snapshot.sh diff --git a/.github/actions/maven-test/action.yml b/.github/actions/maven-test/action.yml index 3c83856827..bbba26508a 100644 --- a/.github/actions/maven-test/action.yml +++ b/.github/actions/maven-test/action.yml @@ -17,5 +17,5 @@ runs: restore-keys: | ${{ runner.os }}-maven- - name: Verify with Maven - run: mvn -B -P!standard-with-extra-repos verify --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true + run: mvn -B verify --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9cd933db8..b0c29d520a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven name: continuous-integration env: - USE_BAZEL_VERSION: '6.1.2' + USE_BAZEL_VERSION: '6.2.0' USE_JAVA_DISTRIBUTION: 'zulu' USE_JAVA_VERSION: '11' @@ -22,30 +22,45 @@ concurrency: cancel-in-progress: true jobs: - test: + maven-test: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] - java: [8, 11, 15, 17] + java: [11, 17, 21-ea] + # Additionally add macos & windows with a single recent JDK + include: + - os: macos-latest + java: 17 + # Windows has some line-ending issues right now. + #- os: windows-latest + # java: 17 fail-fast: false max-parallel: 4 - name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} - + name: Test using Maven with JDK ${{ matrix.java }} on ${{ matrix.os }} steps: - uses: actions/checkout@v2 - uses: ./.github/actions/maven-test + # Note: We can't fold this into the matrix because it changes the `steps`, + # and `steps` can't reference matrix vars. :-( bazel-test: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] - java: [8, 11, 15, 17] + # Bazel has issues with parsing "21-ea" as a java-version, so use 20 for now + java: [11, 17, 20] + # Additionally add macos & windows with a single recent JDK + include: + - os: macos-latest + java: 17 + # Windows has some line-ending & "//..."-escaping issues (for build //...) right now. + #- os: windows-latest + # java: 17 fail-fast: false max-parallel: 4 - name: Bazel Test JDK ${{ matrix.java }}, ${{ matrix.os }} - + name: Test using Bazel with JDK ${{ matrix.java }} on ${{ matrix.os }} steps: - uses: actions/checkout@v2 - uses: ./.github/actions/bazel-test @@ -67,7 +82,7 @@ jobs: publish: runs-on: ubuntu-latest - needs: [test, bazel-test, bazel-build, local-artifact-tests] + needs: [maven-test, bazel-test, bazel-build, local-artifact-tests] if: github.event_name == 'push' && github.repository == 'google/guice' && github.ref == 'refs/heads/master' name: Publish Javadoc and Snapshot diff --git a/core/pom.xml b/core/pom.xml index 047c2b78d0..8c078372ba 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -84,17 +84,9 @@ maven-remote-resources-plugin - - - org.codehaus.mojo - animal-sniffer-maven-plugin - org.apache.maven.plugins maven-compiler-plugin - 3.11.0 maven-surefire-plugin diff --git a/core/test/com/google/inject/example/JndiProvider.java b/core/test/com/google/inject/example/JndiProvider.java index fbb10693e5..1140e18abd 100644 --- a/core/test/com/google/inject/example/JndiProvider.java +++ b/core/test/com/google/inject/example/JndiProvider.java @@ -21,6 +21,7 @@ import javax.naming.Context; import javax.naming.NamingException; +@SuppressWarnings("BanJNDI") class JndiProvider implements Provider { @Inject Context context; diff --git a/extensions/jndi/src/com/google/inject/jndi/JndiIntegration.java b/extensions/jndi/src/com/google/inject/jndi/JndiIntegration.java index 31b7fd70e3..2aacbbcc9e 100644 --- a/extensions/jndi/src/com/google/inject/jndi/JndiIntegration.java +++ b/extensions/jndi/src/com/google/inject/jndi/JndiIntegration.java @@ -26,6 +26,7 @@ * * @author crazybob@google.com (Bob Lee) */ +@SuppressWarnings("BanJNDI") public class JndiIntegration { private JndiIntegration() {} diff --git a/extensions/pom.xml b/extensions/pom.xml index 8779338eb2..187d04f4b5 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -78,12 +78,9 @@ maven-remote-resources-plugin - - org.codehaus.mojo - animal-sniffer-maven-plugin + org.apache.maven.plugins + maven-compiler-plugin maven-compiler-plugin - 2.3.2 + 3.11.0 - 1.8 - 1.8 + 11 -parameters -parameters - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.16 - - - org.codehaus.mojo.signature - java18 - 1.0 - - - - java.lang.invoke.MethodHandle - - - - - check-java-1.8-compat - process-classes - - check - - - - maven-surefire-plugin 2.19.1 @@ -354,7 +321,7 @@ See the Apache License Version 2.0 for the specific language governing permissio https://github.com/google/guice ${project.artifactId} $(module) - JavaSE-1.8 + JavaSE-11 !com.google.inject.*,!javax.annotation,* <_exportcontents>!*.internal.*,$(module).*;version=${guice.api.version} <_consumer-policy>$(version;==;$(@)) @@ -404,7 +371,7 @@ See the Apache License Version 2.0 for the specific language governing permissio 3.2.0 html,syntax - 8 + 11 false true @@ -518,6 +485,4 @@ See the Apache License Version 2.0 for the specific language governing permissio - -