Skip to content

Commit 40485b9

Browse files
committed
Don't put two copies of every class into the Guava jar.
We need to compile Guava twice: - once to build the actual classes with `-source 8` (to maintain Java 8 compatibility) - once to build `module-info`, which requires `-source 9` and thus is incompatible with the "main" build I had been under the mistaken impression that the latter compile still needed to pass all the sources. As a result, we had the second compile build `module-info` _and_ all the classes. We then had configuration in `maven-jar-plugin` to ignore the other classes. But the `maven-jar-plugin` configuration doesn't help because we're using `maven-bundle-plugin` instead, at least for the `guava` itself. (I didn't look into `guava-testlib`, `guava-gwt`, or the tests of any module, though note that (IIRC) the only other one that's modularized (and thus might benefit from our module-related `maven-jar-plugin` configuration) is `guava-testlib`.) Luckily, it turns out that we _can_ compile `module-info` by itself. So now the build does that. (Also, bump `maven-jar-plugin` while in the area.) See #6614 (comment) RELNOTES=Removed the extra copy of each class from the Guava jar. The extra copies were an accidental addition from the modularization work in [Guava 33.4.5](https://github.com/google/guava/releases/tag/v33.4.5). PiperOrigin-RevId: 740019355
1 parent ceebee8 commit 40485b9

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

android/guava/pom.xml

+3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@
119119
<compileSourceRoots>
120120
<compileSourceRoot>${project.basedir}/src</compileSourceRoot>
121121
</compileSourceRoots>
122+
<includes>
123+
<include>module-info.java</include>
124+
</includes>
122125

123126
<!--
124127
JPMS needs access to the module sources to complete a modular Java build. We also need to override the

android/pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@
233233
</plugin>
234234
<plugin>
235235
<artifactId>maven-jar-plugin</artifactId>
236-
<version>3.4.0</version>
236+
<version>3.4.2</version>
237237
<configuration>
238+
<!-- Warning: Guava (at least the main module) uses maven-bundle-plugin, not maven-jar-plugin, so the configuration does not apply to it. That configuration may or may not apply to guava-testlib or other modules. -->
238239
<excludes>
239240
<!-- The root module (where applicable) is withheld because it is provided at `META-INF/versions/9/`. -->
240241
<exclude>/module-info.class</exclude>

guava/pom.xml

+3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@
119119
<compileSourceRoots>
120120
<compileSourceRoot>${project.basedir}/src</compileSourceRoot>
121121
</compileSourceRoots>
122+
<includes>
123+
<include>module-info.java</include>
124+
</includes>
122125

123126
<!--
124127
JPMS needs access to the module sources to complete a modular Java build. We also need to override the

pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,9 @@
234234
</plugin>
235235
<plugin>
236236
<artifactId>maven-jar-plugin</artifactId>
237-
<version>3.4.0</version>
237+
<version>3.4.2</version>
238238
<configuration>
239+
<!-- Warning: Guava (at least the main module) uses maven-bundle-plugin, not maven-jar-plugin, so the configuration does not apply to it. That configuration may or may not apply to guava-testlib or other modules. -->
239240
<excludes>
240241
<!-- The root module (where applicable) is withheld because it is provided at `META-INF/versions/9/`. -->
241242
<exclude>/module-info.class</exclude>

0 commit comments

Comments
 (0)