Skip to content

Commit

Permalink
Make build and tests work with Java 21, and enable CI for them.
Browse files Browse the repository at this point in the history
The main changes is that tests need `-Djava.security.manager=allow`.

Fixes and closes #7065

Helps with #6790

Fixes #6245 (at least the remaining parts that we actually care about)

Fixes #7087

Signed-off-by: Sam Gammon <sam@elide.ventures>
RELNOTES=n/a
PiperOrigin-RevId: 615151162
  • Loading branch information
sgammon authored and Google Java Core Libraries committed Mar 12, 2024
1 parent c6e91c4 commit f2b8c4f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 10 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
Expand Up @@ -20,11 +20,11 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
java: [ 8, 11, 17 ]
java: [ 8, 11, 17, 21 ]
root-pom: [ 'pom.xml', 'android/pom.xml' ]
include:
- os: windows-latest
java: 17
java: 21
root-pom: pom.xml
runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -68,11 +68,10 @@ jobs:
steps:
- name: 'Check out repository'
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: 'Set up JDK 11'
- name: 'Set up JDK 21'
uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0

with:
java-version: 11
java-version: 21
distribution: 'zulu'
server-id: sonatype-nexus-snapshots
server-username: CI_DEPLOY_USERNAME
Expand All @@ -94,11 +93,10 @@ jobs:
steps:
- name: 'Check out repository'
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: 'Set up JDK 11'
- name: 'Set up JDK 21'
uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0

with:
java-version: 11
java-version: 21
distribution: 'zulu'
cache: 'maven'
- name: 'Generate latest docs'
Expand Down
23 changes: 22 additions & 1 deletion android/pom.xml
Expand Up @@ -25,6 +25,7 @@
<project.build.outputTimestamp>2024-01-02T00:00:00Z</project.build.outputTimestamp>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.add.opens></test.add.opens>
<test.add.args></test.add.args>
<module.status>integration</module.status>
<variant.jvmEnvironment>android</variant.jvmEnvironment>
<variant.jvmEnvironmentVariantName>android</variant.jvmEnvironmentVariantName>
Expand Down Expand Up @@ -176,6 +177,13 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.23</version>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.6</version>
</dependency>
</dependencies>
<configuration>
<annotations>com.google.common.base.IgnoreJRERequirement,com.google.common.collect.IgnoreJRERequirement,com.google.common.hash.IgnoreJRERequirement,com.google.common.io.IgnoreJRERequirement,com.google.common.reflect.IgnoreJRERequirement,com.google.common.testing.IgnoreJRERequirement</annotations>
<checkTestClasses>true</checkTestClasses>
Expand Down Expand Up @@ -253,7 +261,7 @@
<runOrder>alphabetical</runOrder>
<!-- Set max heap for tests. -->
<!-- Catch dependencies on the default locale by setting it to hi-IN. -->
<argLine>-Xmx1536M -Duser.language=hi -Duser.country=IN ${test.add.opens}</argLine>
<argLine>-Xmx1536M -Duser.language=hi -Duser.country=IN ${test.add.args} ${test.add.opens}</argLine>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -462,5 +470,18 @@
</plugins>
</build>
</profile>
<profile>
<id>javac-for-jvm18plus</id>
<activation>
<!--
In order to build and run the tests against JDK 18+, we need to pass java.security.manager=allow, to make
the deprecated 'java.lang.SecurityManager' available for use.
-->
<jdk>[18,]</jdk>
</activation>
<properties>
<test.add.args>-Djava.security.manager=allow</test.add.args>
</properties>
</profile>
</profiles>
</project>
23 changes: 22 additions & 1 deletion pom.xml
Expand Up @@ -25,6 +25,7 @@
<project.build.outputTimestamp>2024-01-02T00:00:00Z</project.build.outputTimestamp>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.add.opens></test.add.opens>
<test.add.args></test.add.args>
<module.status>integration</module.status>
<variant.jvmEnvironment>standard-jvm</variant.jvmEnvironment>
<variant.jvmEnvironmentVariantName>jre</variant.jvmEnvironmentVariantName>
Expand Down Expand Up @@ -177,6 +178,13 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.23</version>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.6</version>
</dependency>
</dependencies>
<configuration>
<annotations>com.google.common.base.IgnoreJRERequirement,com.google.common.collect.IgnoreJRERequirement,com.google.common.hash.IgnoreJRERequirement,com.google.common.io.IgnoreJRERequirement,com.google.common.reflect.IgnoreJRERequirement,com.google.common.testing.IgnoreJRERequirement</annotations>
<checkTestClasses>true</checkTestClasses>
Expand Down Expand Up @@ -248,7 +256,7 @@
<runOrder>alphabetical</runOrder>
<!-- Set max heap for tests. -->
<!-- Catch dependencies on the default locale by setting it to hi-IN. -->
<argLine>-Xmx1536M -Duser.language=hi -Duser.country=IN ${test.add.opens}</argLine>
<argLine>-Xmx1536M -Duser.language=hi -Duser.country=IN ${test.add.args} ${test.add.opens}</argLine>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -457,5 +465,18 @@
</plugins>
</build>
</profile>
<profile>
<id>javac-for-jvm18plus</id>
<activation>
<!--
In order to build and run the tests against JDK 18+, we need to pass java.security.manager=allow, to make
the deprecated 'java.lang.SecurityManager' available for use.
-->
<jdk>[18,]</jdk>
</activation>
<properties>
<test.add.args>-Djava.security.manager=allow</test.add.args>
</properties>
</profile>
</profiles>
</project>

0 comments on commit f2b8c4f

Please sign in to comment.