From 7c4a6b234212d43d74fc149b6af0d71b85d30cfe Mon Sep 17 00:00:00 2001 From: Sam Gammon Date: Fri, 8 Mar 2024 12:43:34 -0800 Subject: [PATCH] feat(jpms): add `module-info` definition for guava MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This changeset adds full support for modular Java builds in Guava, and in libraries which depend on Guava. The Guava JAR for JRE now structures as a Multi-Release JAR, with a module definition situated in `META-INF/versions/9/`. Guava remains compatible with JDK 8. - feat: add `module-info.java` to `guava` module - chore: update `guava` to build MRJAR - chore: adjust dev version → `1.0-HEAD-[jre|android]-SNAPSHOT` - chore: upgrade maven compiler plugin → `3.12.1` Fixes and closes google/guava#2970 Relates-To: elide-dev/jpms#1 Signed-off-by: Sam Gammon --- android/guava-bom/pom.xml | 2 +- android/guava-testlib/pom.xml | 2 +- android/guava-tests/pom.xml | 2 +- android/guava/pom.xml | 2 +- android/pom.xml | 2 +- guava-bom/pom.xml | 2 +- guava-gwt/pom.xml | 2 +- guava-testlib/pom.xml | 2 +- guava-tests/pom.xml | 2 +- guava/pom.xml | 44 +++++++++++++++++++++++++++++++++-- guava/src/module-info.java | 44 +++++++++++++++++++++++++++++++++++ pom.xml | 14 +++-------- 12 files changed, 98 insertions(+), 22 deletions(-) create mode 100644 guava/src/module-info.java diff --git a/android/guava-bom/pom.xml b/android/guava-bom/pom.xml index 8fde93d1a75a..e6a5d9f132ac 100644 --- a/android/guava-bom/pom.xml +++ b/android/guava-bom/pom.xml @@ -8,7 +8,7 @@ com.google.guava guava-bom - HEAD-android-SNAPSHOT + 1.0-HEAD-android-SNAPSHOT pom diff --git a/android/guava-testlib/pom.xml b/android/guava-testlib/pom.xml index 33dc15799d00..8dc3771c6e0c 100644 --- a/android/guava-testlib/pom.xml +++ b/android/guava-testlib/pom.xml @@ -5,7 +5,7 @@ com.google.guava guava-parent - HEAD-android-SNAPSHOT + 1.0-HEAD-android-SNAPSHOT guava-testlib Guava Testing Library diff --git a/android/guava-tests/pom.xml b/android/guava-tests/pom.xml index bf9bec45c651..f9b485f5e2cf 100644 --- a/android/guava-tests/pom.xml +++ b/android/guava-tests/pom.xml @@ -5,7 +5,7 @@ com.google.guava guava-parent - HEAD-android-SNAPSHOT + 1.0-HEAD-android-SNAPSHOT guava-tests Guava Unit Tests diff --git a/android/guava/pom.xml b/android/guava/pom.xml index 7444cd6972ba..66178f4ffe63 100644 --- a/android/guava/pom.xml +++ b/android/guava/pom.xml @@ -6,7 +6,7 @@ com.google.guava guava-parent - HEAD-android-SNAPSHOT + 1.0-HEAD-android-SNAPSHOT guava bundle diff --git a/android/pom.xml b/android/pom.xml index b21b930e1110..b5944e94e3bd 100644 --- a/android/pom.xml +++ b/android/pom.xml @@ -6,7 +6,7 @@ 4.0.0 com.google.guava guava-parent - HEAD-android-SNAPSHOT + 1.0-HEAD-android-SNAPSHOT pom Guava Maven Parent Parent for guava artifacts diff --git a/guava-bom/pom.xml b/guava-bom/pom.xml index 8c5ea2ec035f..af7c956adbaa 100644 --- a/guava-bom/pom.xml +++ b/guava-bom/pom.xml @@ -8,7 +8,7 @@ com.google.guava guava-bom - HEAD-jre-SNAPSHOT + 1.0-HEAD-jre-SNAPSHOT pom diff --git a/guava-gwt/pom.xml b/guava-gwt/pom.xml index 86fa4b971aa9..a6f9ee291655 100644 --- a/guava-gwt/pom.xml +++ b/guava-gwt/pom.xml @@ -5,7 +5,7 @@ com.google.guava guava-parent - HEAD-jre-SNAPSHOT + 1.0-HEAD-jre-SNAPSHOT guava-gwt Guava GWT compatible libs diff --git a/guava-testlib/pom.xml b/guava-testlib/pom.xml index f60890e78e7a..cd2bc969833b 100644 --- a/guava-testlib/pom.xml +++ b/guava-testlib/pom.xml @@ -5,7 +5,7 @@ com.google.guava guava-parent - HEAD-jre-SNAPSHOT + 1.0-HEAD-jre-SNAPSHOT guava-testlib Guava Testing Library diff --git a/guava-tests/pom.xml b/guava-tests/pom.xml index 8596221d8316..ca74eb2e2814 100644 --- a/guava-tests/pom.xml +++ b/guava-tests/pom.xml @@ -5,7 +5,7 @@ com.google.guava guava-parent - HEAD-jre-SNAPSHOT + 1.0-HEAD-jre-SNAPSHOT guava-tests Guava Unit Tests diff --git a/guava/pom.xml b/guava/pom.xml index aa5095ec2899..f375c22e37f0 100644 --- a/guava/pom.xml +++ b/guava/pom.xml @@ -6,7 +6,7 @@ com.google.guava guava-parent - HEAD-jre-SNAPSHOT + 1.0-HEAD-jre-SNAPSHOT guava bundle @@ -64,9 +64,11 @@ - com.google.common + true + + /module-info.class @@ -102,6 +104,44 @@ maven-compiler-plugin + + + default-compile + + 1.8 + 1.8 + + module-info.java + + + + + compile-java-9 + compile + + compile + + + 9 + + ${project.basedir}/src + + + + + -sourcepath + ${project.basedir}/src + --add-reads=com.google.common=ALL-UNNAMED + + -XDcompilePolicy=simple + + true + + + maven-source-plugin diff --git a/guava/src/module-info.java b/guava/src/module-info.java new file mode 100644 index 000000000000..e459eb9d9e8e --- /dev/null +++ b/guava/src/module-info.java @@ -0,0 +1,44 @@ +// GENERATED FILE - DO NOT EDIT + +/* + * Copyright (C) 2008 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. + */ + +/** + * Google Guava + */ +module com.google.common { + requires java.base; + requires java.logging; + requires jdk.unsupported; + + exports com.google.common.annotations; + exports com.google.common.base; + exports com.google.common.cache; + exports com.google.common.collect; + exports com.google.common.escape; + exports com.google.common.eventbus; + exports com.google.common.graph; + exports com.google.common.hash; + exports com.google.common.html; + exports com.google.common.io; + exports com.google.common.math; + exports com.google.common.net; + exports com.google.common.primitives; + exports com.google.common.reflect; + exports com.google.common.util.concurrent; + exports com.google.common.xml; + exports com.google.thirdparty.publicsuffix; +} diff --git a/pom.xml b/pom.xml index d659eb88c8d7..78c93b7c7edd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 com.google.guava guava-parent - HEAD-jre-SNAPSHOT + 1.0-HEAD-jre-SNAPSHOT pom Guava Maven Parent Parent for guava artifacts @@ -125,21 +125,13 @@ maven-compiler-plugin - 3.8.1 + 3.12.1 1.8 1.8 UTF-8 true - - - -sourcepath - doesnotexist + -XDcompilePolicy=simple