Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add module-info definition. #7673

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions android/guava-testlib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,45 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<compilerArgs combine.children="append" combine.self="append">
<arg>-XDignore.symbol.file</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>compile-java9</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src</compileSourceRoot>
</compileSourceRoots>

<!--
JPMS needs access to the module sources to complete a modular Java build. We also need to override
the base compiler settings (in the root `pom.xml`) to enable MRJAR output.
-->
<compilerArgs combine.self="override">
<arg>-sourcepath</arg>
<arg>${project.basedir}/src</arg>
<arg>--add-reads=com.google.common=ALL-UNNAMED</arg>
<arg>--add-reads=com.google.common.testlib=ALL-UNNAMED</arg>
<!-- https://errorprone.info/docs/installation#maven -->
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xlint:-removal</arg>
<arg>-Xlint:-options</arg>
</compilerArgs>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
Expand Down
46 changes: 39 additions & 7 deletions android/guava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.google.common</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<extensions>true</extensions>
Expand All @@ -86,9 +79,12 @@
</executions>
<configuration>
<instructions>
<!-- Silence a warning that claims that META-INF/versions/9/... is the "wrong directory" for our classes. -->
<_fixupmessages>^Classes found in the wrong directory: .*</_fixupmessages>
<Export-Package>
!com.google.common.base.internal,
!com.google.common.util.concurrent.internal,
!META-INF.*,
com.google.common.*
</Export-Package>
<Import-Package>
Expand All @@ -103,6 +99,42 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<compilerArgs combine.children="append" combine.self="append">
<arg>-XDignore.symbol.file</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>compile-java9</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src</compileSourceRoot>
</compileSourceRoots>

<!--
JPMS needs access to the module sources to complete a modular Java build. We also need to override the
base compile settings (in the root `pom.xml`) to enable MRJAR output.
-->
<compilerArgs combine.self="override">
<arg>-sourcepath</arg>
<arg>${project.basedir}/src</arg>
<arg>--add-reads=com.google.common=ALL-UNNAMED</arg>
<!-- https://errorprone.info/docs/installation#maven -->
<arg>-XDcompilePolicy=simple</arg>
</compilerArgs>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
Expand Down
55 changes: 45 additions & 10 deletions android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,7 @@
<target>1.8</target>
<encoding>UTF-8</encoding>
<parameters>true</parameters>
<compilerArgs>
<!--
Make includes/excludes fully work:
https://issues.apache.org/jira/browse/MCOMPILER-174

(Compare what guava-gwt has to do for maven-javadoc-plugin.)
-->
<arg>-sourcepath</arg>
<arg>doesnotexist</arg>
<compilerArgs combine.children="override">
<!-- https://errorprone.info/docs/installation#maven -->
<arg>-XDcompilePolicy=simple</arg>
<arg>--should-stop=ifError=FLOW</arg>
Expand Down Expand Up @@ -181,6 +173,7 @@
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
<arg>-Xlint:-removal,-options</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
Expand All @@ -192,6 +185,35 @@
<!-- Fork because we need args like add-exports. (But see the TODO above about .mvn/jvm.config.) -->
<fork>true</fork>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<source>1.8</source>
<target>1.8</target>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
<compilerArgs>
<!--
Make includes/excludes fully work:
https://issues.apache.org/jira/browse/MCOMPILER-174
(Compare what guava-gwt has to do for maven-javadoc-plugin.)
-->
<arg>-sourcepath</arg>
<arg>doesnotexist</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<configuration>
<compilerArgs>
<compilerArg>-Xlint:-removal</compilerArg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
Expand All @@ -211,7 +233,20 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.4.0</version>
<configuration>
<excludes>
<!-- The root module (where applicable) is withheld because it is provided at `META-INF/versions/9/`. -->
<exclude>/module-info.class</exclude>
<!-- Avoid duplicating compiled classes within the `META-INF/versions/9/` root. -->
<exclude>META-INF/versions/9/com/**/*.class</exclude>
</excludes>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down
23 changes: 14 additions & 9 deletions guava-gwt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,20 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<!-- Yes, we want to exclude ForceGuavaCompilation 4 times: -->
<!-- (And we might as well exclude DummyJavadocClass 3 times (though it would be harmless to include).) -->
<!-- 1. Don't compile it (since that requires a *non-test* dep on gwt-user. -->
<exclude>**/ForceGuavaCompilation*</exclude>
<exclude>**/DummyJavadocClass*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<excludes>
<!-- Yes, we want to exclude ForceGuavaCompilation 4 times: -->
<!-- (And we might as well exclude DummyJavadocClass 3 times (though it would be harmless to include).) -->
<!-- 1. Don't compile it (since that requires a *non-test* dep on gwt-user. -->
<exclude>**/ForceGuavaCompilation*</exclude>
<exclude>**/DummyJavadocClass*</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
39 changes: 39 additions & 0 deletions guava-testlib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,45 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<compilerArgs combine.children="append" combine.self="append">
<arg>-XDignore.symbol.file</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>compile-java9</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src</compileSourceRoot>
</compileSourceRoots>

<!--
JPMS needs access to the module sources to complete a modular Java build. We also need to override
the base compiler settings (in the root `pom.xml`) to enable MRJAR output.
-->
<compilerArgs combine.self="override">
<arg>-sourcepath</arg>
<arg>${project.basedir}/src</arg>
<arg>--add-reads=com.google.common=ALL-UNNAMED</arg>
<arg>--add-reads=com.google.common.testlib=ALL-UNNAMED</arg>
<!-- https://errorprone.info/docs/installation#maven -->
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xlint:-removal</arg>
<arg>-Xlint:-options</arg>
</compilerArgs>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
Expand Down
28 changes: 28 additions & 0 deletions guava-testlib/src/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2024 The Guava Authors
*
* 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.
*/

/** Guava Testlib */
module com.google.common.testlib {
requires java.logging;
requires com.google.common;
requires com.google.common.util.concurrent.internal;

exports com.google.common.collect.testing;
exports com.google.common.collect.testing.features;
exports com.google.common.collect.testing.google;
exports com.google.common.collect.testing.testers;
exports com.google.common.escape.testing;
exports com.google.common.testing;
exports com.google.common.util.concurrent.testing;
}
46 changes: 39 additions & 7 deletions guava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.google.common</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<extensions>true</extensions>
Expand All @@ -86,9 +79,12 @@
</executions>
<configuration>
<instructions>
<!-- Silence a warning that claims that META-INF/versions/9/... is the "wrong directory" for our classes. -->
<_fixupmessages>^Classes found in the wrong directory: .*</_fixupmessages>
<Export-Package>
!com.google.common.base.internal,
!com.google.common.util.concurrent.internal,
!META-INF.*,
com.google.common.*
</Export-Package>
<Import-Package>
Expand All @@ -103,6 +99,42 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<compilerArgs combine.children="append" combine.self="append">
<arg>-XDignore.symbol.file</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>compile-java9</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src</compileSourceRoot>
</compileSourceRoots>

<!--
JPMS needs access to the module sources to complete a modular Java build. We also need to override the
base compile settings (in the root `pom.xml`) to enable MRJAR output.
-->
<compilerArgs combine.self="override">
<arg>-sourcepath</arg>
<arg>${project.basedir}/src</arg>
<arg>--add-reads=com.google.common=ALL-UNNAMED</arg>
<!-- https://errorprone.info/docs/installation#maven -->
<arg>-XDcompilePolicy=simple</arg>
</compilerArgs>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
Expand Down
Loading
Loading