Skip to content

Conversation

@copybara-service
Copy link
Contributor

@copybara-service copybara-service bot commented Mar 24, 2025

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.

@copybara-service copybara-service bot force-pushed the test_740005364 branch 2 times, most recently from 98c3f0d to 06c82ef Compare March 24, 2025 18:27
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant