Skip to content

Commit 287c701

Browse files
sgammonGoogle Java Core Libraries
authored and
Google Java Core Libraries
committed
Modularize failureaccess.
This is the next piece of #7094, which is progress toward [modularization](#2970). I've modified this CL somewhat from the original version so that I can deploy a new version of `failureaccess` without needing to make any updates to `guava-parent` first. `failureaccess` does still use `guava-parent` (and I've bumped it to use the newest released version) for its configuration for Sonatype, Javadoc, etc. But I've inlined all the configuration that I need for the modularization. I did note a few differences from the original version: - This version includes `LICENSE` under `META-INF`, both in the main jar and in the sources jars. - This version uses a different configuration for Javadoc, I assume because my recent changes there didn't make it into 33.4.0. I also notice that _neither_ version contains `module-info.java` in its source jar. We could presumably fix that in the future if anyone is interested. (And while this isn't strictly related, I do notice that we could consider also releasing a modularized version of `listenablefuture` someday.) I have tested with: ``` $ JAVA_HOME=$HOME/.m2/jdks/jdk-17.0.13+11 ./mvnw clean install -Psonatype-oss-release -Dmaven.test.redirectTestOutputToFile=true -Dsurefire.printSummary=false -Drelease -f futures/failureaccess ``` (Some of those flags aren't necessary, but I found it easiest to copy what our release script does for "normal" releases.) I would use `deploy` instead of `install` for the real thing. Relates-To: elide-dev/jpms#1 Signed-off-by: Sam Gammon <sam@elide.dev> RELNOTES=Changed the `failureaccess` jar to be a modular jar. PiperOrigin-RevId: 726100871
1 parent 89a6d25 commit 287c701

File tree

2 files changed

+78
-5
lines changed

2 files changed

+78
-5
lines changed

futures/failureaccess/pom.xml

+60-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<parent>
66
<groupId>com.google.guava</groupId>
77
<artifactId>guava-parent</artifactId>
8-
<version>26.0-android</version>
8+
<version>33.4.0-android</version>
99
</parent>
1010
<artifactId>failureaccess</artifactId>
11-
<version>1.0.2</version>
12-
<packaging>bundle</packaging>
11+
<version>1.0.3</version>
12+
<packaging>jar</packaging>
1313
<name>Guava InternalFutureFailureAccess and InternalFutures</name>
1414
<description>
1515
Contains
@@ -22,14 +22,67 @@
2222
</description>
2323
<build>
2424
<plugins>
25+
<plugin>
26+
<artifactId>maven-compiler-plugin</artifactId>
27+
<executions>
28+
<execution>
29+
<id>default-compile</id>
30+
<goals>
31+
<goal>compile</goal>
32+
</goals>
33+
<configuration>
34+
<release>8</release>
35+
<excludes>
36+
<exclude>module-info.java</exclude>
37+
</excludes>
38+
<compilerArgs>
39+
<!--
40+
Make includes/excludes fully work:
41+
https://issues.apache.org/jira/browse/MCOMPILER-174
42+
(Compare what guava-gwt has to do for maven-javadoc-plugin.)
43+
-->
44+
<arg>-sourcepath</arg>
45+
<arg>doesnotexist</arg>
46+
</compilerArgs>
47+
</configuration>
48+
</execution>
49+
<execution>
50+
<id>compile-java9</id>
51+
<goals>
52+
<goal>compile</goal>
53+
</goals>
54+
<configuration>
55+
<release>9</release>
56+
<compileSourceRoots>
57+
<compileSourceRoot>${project.basedir}/src</compileSourceRoot>
58+
</compileSourceRoots>
59+
60+
<!-- JPMS needs access to the module sources to complete a modular Java build. -->
61+
<compilerArgs>
62+
<arg>-sourcepath</arg>
63+
<arg>${project.basedir}/src</arg>
64+
<arg>--add-reads=com.google.common=ALL-UNNAMED</arg>
65+
<!-- https://errorprone.info/docs/installation#maven -->
66+
<arg>-XDcompilePolicy=simple</arg>
67+
</compilerArgs>
68+
<multiReleaseOutput>true</multiReleaseOutput>
69+
</configuration>
70+
</execution>
71+
</executions>
72+
</plugin>
2573
<plugin>
2674
<artifactId>maven-jar-plugin</artifactId>
2775
<configuration>
2876
<archive>
77+
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
2978
<manifestEntries>
30-
<Automatic-Module-Name>com.google.common.util.concurrent.internal</Automatic-Module-Name>
79+
<Multi-Release>true</Multi-Release>
3180
</manifestEntries>
3281
</archive>
82+
<excludes>
83+
<exclude>/module-info.class</exclude>
84+
<exclude>META-INF/versions/9/com/google/common/util/concurrent/internal/*.class</exclude>
85+
</excludes>
3386
</configuration>
3487
</plugin>
3588
<plugin>
@@ -55,7 +108,9 @@
55108
</executions>
56109
<configuration>
57110
<instructions>
58-
<Export-Package>com.google.common.util.concurrent.internal</Export-Package>
111+
<!-- Silence a warning that claims that META-INF/versions/9/... is the "wrong directory" for our classes. -->
112+
<_fixupmessages>^Classes found in the wrong directory: .*</_fixupmessages>
113+
<Export-Package>com.google.common.util.concurrent.internal,!META-INF.*</Export-Package>
59114
<Bundle-DocURL>https://github.com/google/guava/</Bundle-DocURL>
60115
</instructions>
61116
</configuration>
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (C) 2024 The Guava Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
13+
*/
14+
15+
/** Guava: {@code Future} Internals. */
16+
module com.google.common.util.concurrent.internal {
17+
exports com.google.common.util.concurrent.internal;
18+
}

0 commit comments

Comments
 (0)