Skip to content

Commit

Permalink
fix: build against jvm21
Browse files Browse the repository at this point in the history
- fix: build against embedded jdk sources needs `--enable-preview`
  when built against jvm21

- fix: add `-Djava.security.manager=allow` to fix security manager
  tests under modern java

Fixes and closes google#7065

Signed-off-by: Sam Gammon <[email protected]>
  • Loading branch information
sgammon committed Mar 10, 2024
1 parent 8b9387e commit a78c61d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
29 changes: 28 additions & 1 deletion android/pom.xml
Original file line number Diff line number Diff line change
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 @@ -253,7 +254,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 @@ -357,6 +358,19 @@
<maven-javadoc-plugin.additionalJOptions>--no-module-directories</maven-javadoc-plugin.additionalJOptions>
</properties>
</profile>
<profile>
<!--
In order to build against JDK 19+, Javadoc needs to enable Java preview features, because JDK sources
themselves have code which defines/uses preview features.
-->
<id>javadocs-jdk19plus</id>
<activation>
<jdk>[19,]</jdk>
</activation>
<properties>
<maven-javadoc-plugin.additionalJOptions>--enable-preview</maven-javadoc-plugin.additionalJOptions>
</properties>
</profile>
<profile>
<id>open-jre-modules</id>
<activation>
Expand Down Expand Up @@ -462,5 +476,18 @@
</plugins>
</build>
</profile>
<profile>
<id>javac-for-jvm18plus</id>
<activation>
<!--
In order to build and run the tests against JDK 19+, 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>
1 change: 1 addition & 0 deletions guava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
<link>https://errorprone.info/api/latest/</link>
</links>
<overview>../overview.html</overview>
<additionalJOption>${maven-javadoc-plugin.additionalJOptions}</additionalJOption>
</configuration>
</plugin>
<plugin>
Expand Down
36 changes: 35 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
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 @@ -352,6 +360,19 @@
<maven-javadoc-plugin.additionalJOptions>--no-module-directories</maven-javadoc-plugin.additionalJOptions>
</properties>
</profile>
<profile>
<!--
In order to build against JDK 19+, Javadoc needs to enable Java preview features, because JDK sources
themselves have code which defines/uses preview features.
-->
<id>javadocs-jdk19plus</id>
<activation>
<jdk>[19,]</jdk>
</activation>
<properties>
<maven-javadoc-plugin.additionalJOptions>--enable-preview</maven-javadoc-plugin.additionalJOptions>
</properties>
</profile>
<profile>
<id>open-jre-modules</id>
<activation>
Expand Down Expand Up @@ -457,5 +478,18 @@
</plugins>
</build>
</profile>
<profile>
<id>javac-for-jvm18plus</id>
<activation>
<!--
In order to build and run the tests against JDK 19+, 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 a78c61d

Please sign in to comment.