Skip to content

Commit

Permalink
A bunch of environment changes.
Browse files Browse the repository at this point in the history
* 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 bazelbuild/bazel#14502, which was fixed in bazelbuild/bazel@7556e11, 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
  • Loading branch information
sameb authored and Guice Team committed May 17, 2023
1 parent ed5f5ae commit c58bc33
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .github/actions/bazel-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/maven-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 24 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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
Expand All @@ -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

Expand Down
8 changes: 0 additions & 8 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,9 @@
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
</plugin>
<!--
| Enable Java8 conformance checks
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
1 change: 1 addition & 0 deletions core/test/com/google/inject/example/JndiProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javax.naming.Context;
import javax.naming.NamingException;

@SuppressWarnings("BanJNDI")
class JndiProvider<T> implements Provider<T> {

@Inject Context context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*
* @author crazybob@google.com (Bob Lee)
*/
@SuppressWarnings("BanJNDI")
public class JndiIntegration {

private JndiIntegration() {}
Expand Down
7 changes: 2 additions & 5 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,9 @@
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
</plugin>
<!--
| Enable Java8 conformance checks
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<!--
| Add OSGi manifest: extensions are fragments that attach to the core
Expand Down
51 changes: 8 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ See the Apache License Version 2.0 for the specific language governing permissio
<name>Google Guice</name>

<description>
Guice is a lightweight dependency injection framework for Java 8 and above
Guice is a lightweight dependency injection framework for Java 11 and above
</description>

<url>https://github.com/google/guice</url>
Expand All @@ -51,13 +51,6 @@ See the Apache License Version 2.0 for the specific language governing permissio
<unsubscribe>http://groups.google.com/group/google-guice/subscribe</unsubscribe>
<post>http://groups.google.com/group/google-guice/post</post>
</mailingList>
<mailingList>
<name>Guice Developers List</name>
<archive>http://groups.google.com/group/google-guice-dev/topics</archive>
<subscribe>http://groups.google.com/group/google-guice-dev/subscribe</subscribe>
<unsubscribe>http://groups.google.com/group/google-guice-dev/subscribe</unsubscribe>
<post>http://groups.google.com/group/google-guice-dev/post</post>
</mailingList>
</mailingLists>

<scm>
Expand All @@ -72,8 +65,8 @@ See the Apache License Version 2.0 for the specific language governing permissio
</issueManagement>

<ciManagement>
<system>Travis</system>
<url>https://travis-ci.org/google/guice</url>
<system>GitHub Actions</system>
<url>https://github.com/google/guice/actions</url>
</ciManagement>

<licenses>
Expand Down Expand Up @@ -272,45 +265,19 @@ See the Apache License Version 2.0 for the specific language governing permissio
</executions>
</plugin>
<!--
| Make sure we only use Java8 methods
| Make sure we only use Java11 methods
-->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>11</release>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
<testCompilerArgument>-parameters</testCompilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.16</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
<ignores>
<!-- workaround https://github.com/mojohaus/animal-sniffer/issues/18 -->
<ignore>java.lang.invoke.MethodHandle</ignore>
</ignores>
</configuration>
<executions>
<execution>
<id>check-java-1.8-compat</id>
<phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
Expand Down Expand Up @@ -354,7 +321,7 @@ See the Apache License Version 2.0 for the specific language governing permissio
<Bundle-DocURL>https://github.com/google/guice</Bundle-DocURL>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-SymbolicName>$(module)</Bundle-SymbolicName>
<Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
<Bundle-RequiredExecutionEnvironment>JavaSE-11</Bundle-RequiredExecutionEnvironment>
<Import-Package>!com.google.inject.*,!javax.annotation,*</Import-Package>
<_exportcontents>!*.internal.*,$(module).*;version=${guice.api.version}</_exportcontents>
<_consumer-policy>$(version;==;$(@))</_consumer-policy>
Expand Down Expand Up @@ -404,7 +371,7 @@ See the Apache License Version 2.0 for the specific language governing permissio
<version>3.2.0</version>
<configuration>
<doclint>html,syntax</doclint>
<source>8</source>
<source>11</source>
<author>false</author>
<protected>true</protected>
<links>
Expand Down Expand Up @@ -518,6 +485,4 @@ See the Apache License Version 2.0 for the specific language governing permissio
</plugin>
</plugins>
</build>

<!-- TODO(cgruber): Update the google parent pom or migrate to sonatype's -->
</project>

0 comments on commit c58bc33

Please sign in to comment.