From 4dd5fcf7b817c56bcfd90c3977bf003f212fbddf Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Tue, 20 Dec 2022 23:11:13 -0500 Subject: [PATCH] feat: parent pom and gapic-generator-java-bom (#1170) * feat: parent pom and gapic-generator-java-bom * gapic-generator-java to use gapic-generator-java-bom * gRPC and Protobuf as part of the BOM * Maven format plugin run at the root * Consolidate external dependencies' versions to the parent * Ensure snapshot versions --- .github/workflows/ci-maven.yaml | 28 +++-- api-common-java/pom.xml | 11 +- gapic-generator-java-bom/pom.xml | 99 ++++++++++++++++ gapic-generator-java-pom-parent/pom.xml | 109 ++++++++++++++++++ gapic-generator-java/pom.xml | 23 +--- gax-java/gax-bom/build.gradle | 2 +- gax-java/gax-bom/pom.xml | 14 +-- gax-java/gax-grpc/pom.xml | 4 +- gax-java/gax-httpjson/pom.xml | 4 +- gax-java/gax/pom.xml | 4 +- gax-java/pom.xml | 20 ++-- .../grpc-google-common-protos/pom.xml | 2 +- java-common-protos/pom.xml | 10 +- java-iam/pom.xml | 41 +++++-- pom.xml | 3 +- versions.txt | 9 +- 16 files changed, 307 insertions(+), 76 deletions(-) create mode 100644 gapic-generator-java-bom/pom.xml create mode 100644 gapic-generator-java-pom-parent/pom.xml diff --git a/.github/workflows/ci-maven.yaml b/.github/workflows/ci-maven.yaml index dfbdbfb78b..15ba07a36e 100644 --- a/.github/workflows/ci-maven.yaml +++ b/.github/workflows/ci-maven.yaml @@ -20,7 +20,8 @@ jobs: - run: java -version - name: Unit Tests run: | - mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip + mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \ + -Dfmt.skip units-java8: name: "units (8) except gapic-generator-java" @@ -48,7 +49,8 @@ jobs: # Why not compile? It's because the process needs to package jar so # that gapic-generator-java module can use testlib modules of gax. - mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip -DskipTests + mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \ + -DskipTests -Dfmt.skip - name: Run test with Java 8 for all modules except gapic-generator-java shell: bash run: | @@ -58,23 +60,35 @@ jobs: # useIncrementalCompilation=false to avoid recompiling classes # generated by Java 11 compiler above. mvn -B -ntp test --projects '!gapic-generator-java' \ - -Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false + -Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false \ + -Dfmt.skip units-java8-gapic-generator-java: name: "units (8) for gapic-generator-java" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: 11 + distribution: temurin + cache: maven + - name: Install modules outside gapic-generator-java + shell: bash + run: | + mvn -B -ntp install --projects '!gapic-generator-java' \ + -Dcheckstyle.skip -Dfmt.skip -DskipTests - uses: actions/setup-java@v3 with: java-version: 8 distribution: temurin cache: maven - run: java -version - - name: Run test only for gapic-generator-java + - name: Run test only for gapic-generator-java using Java 8 shell: bash run: | - mvn -B -ntp verify --projects 'gapic-generator-java' -Dcheckstyle.skip + mvn -B -ntp verify --projects 'gapic-generator-java' \ + -Dcheckstyle.skip -Dfmt.skip lint: runs-on: ubuntu-latest @@ -87,5 +101,5 @@ jobs: cache: maven - run: java -version - name: Java Linter - run: mvn fmt:check - working-directory: gapic-generator-java \ No newline at end of file + # Exclude the root project + run: mvn -B -ntp --projects '!.' fmt:check diff --git a/api-common-java/pom.xml b/api-common-java/pom.xml index c720dd5804..30ad3b66ab 100644 --- a/api-common-java/pom.xml +++ b/api-common-java/pom.xml @@ -5,15 +5,16 @@ com.google.api api-common jar - 2.3.1 + 2.3.2-SNAPSHOT API Common https://github.com/googleapis/api-common-java Common utilities for Google APIs in Java com.google.cloud - google-cloud-shared-config - 1.5.5 + gapic-generator-java-pom-parent + 2.12.1-SNAPSHOT + ../gapic-generator-java-pom-parent @@ -49,7 +50,7 @@ com.google.guava guava - 31.1-jre + ${guava.version} com.google.auto.value @@ -69,7 +70,7 @@ javax.annotation javax.annotation-api - 1.3.2 + ${javax.annotation-api.version} com.google.errorprone diff --git a/gapic-generator-java-bom/pom.xml b/gapic-generator-java-bom/pom.xml new file mode 100644 index 0000000000..ebdbffbf08 --- /dev/null +++ b/gapic-generator-java-bom/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + com.google.api + gapic-generator-java-bom + pom + 2.12.1-SNAPSHOT + GAPIC Generator Java BOM + + BOM for the libraries in gapic-generator-java repository. Users should not + depend on this artifact explicitly because this BOM is an implementation + detail of the Libraries BOM. + + + + com.google.cloud + gapic-generator-java-pom-parent + 2.12.1-SNAPSHOT + ../gapic-generator-java-pom-parent + + + + + + + io.grpc + grpc-bom + ${grpc.version} + pom + import + + + com.google.protobuf + protobuf-bom + ${protobuf.version} + pom + import + + + + + com.google.api + api-common + 2.3.2-SNAPSHOT + + + com.google.api + gax-bom + 2.20.2-SNAPSHOT + pom + import + + + com.google.api.grpc + grpc-google-common-protos + 2.11.1-SNAPSHOT + + + com.google.api.grpc + proto-google-common-protos + 2.11.1-SNAPSHOT + + + com.google.api.grpc + proto-google-iam-v1 + 1.6.23-SNAPSHOT + + + com.google.api.grpc + proto-google-iam-v2 + 1.6.23-SNAPSHOT + + + com.google.api.grpc + proto-google-iam-v2beta + 1.6.23-SNAPSHOT + + + + + com.google.api.grpc + grpc-google-iam-v1 + 1.6.23-SNAPSHOT + + + com.google.api.grpc + grpc-google-iam-v2 + 1.6.23-SNAPSHOT + + + com.google.api.grpc + grpc-google-iam-v2beta + 1.6.23-SNAPSHOT + + + + + + \ No newline at end of file diff --git a/gapic-generator-java-pom-parent/pom.xml b/gapic-generator-java-pom-parent/pom.xml new file mode 100644 index 0000000000..5a28edad79 --- /dev/null +++ b/gapic-generator-java-pom-parent/pom.xml @@ -0,0 +1,109 @@ + + + 4.0.0 + com.google.cloud + gapic-generator-java-pom-parent + 2.12.1-SNAPSHOT + pom + GAPIC Generator Java POM Parent + https://github.com/googleapis/google-cloud-java + + The top-level parent for all modules in the repository. + + + com.google.cloud + google-cloud-shared-config + 1.5.5 + + + + + false + java.header + + + 1.3.2 + 1.51.1 + 31.1-jre + 3.21.10 + + + + + suztomo + Tomo Suzuki + suztomo@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/google-cloud-java.git + scm:git:git@github.com:googleapis/google-cloud-java.git + https://github.com/googleapis/google-cloud-java + HEAD + + + https://github.com/googleapis/google-cloud-java/issues + GitHub Issues + + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + + checkstyle-tests + + [11,) + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + checkstyle + validate + + check + + + ${checkstyle.header.file} + + + + + + + + + + + + google-maven-central-copy + Google Maven Central copy + https://maven-central.storage-download.googleapis.com/maven2 + + + maven-central + Maven Central + https://repo1.maven.org/maven2 + + + \ No newline at end of file diff --git a/gapic-generator-java/pom.xml b/gapic-generator-java/pom.xml index c5beba7381..3a3a929a89 100644 --- a/gapic-generator-java/pom.xml +++ b/gapic-generator-java/pom.xml @@ -13,9 +13,6 @@ UTF-8 44d6bef0ca6db8bba3fb324c8186e694bcc4829c - 2.20.1 - 1.51.1 - 3.21.10 1.10.1 1.8 1.8 @@ -23,24 +20,17 @@ com.google.cloud - google-cloud-shared-config - 1.5.5 - + gapic-generator-java-pom-parent + 2.12.1-SNAPSHOT + ../gapic-generator-java-pom-parent com.google.api - gax-bom - ${gax.version} - pom - import - - - io.grpc - grpc-bom - ${grpc.version} + gapic-generator-java-bom + 2.12.1-SNAPSHOT pom import @@ -410,7 +400,6 @@ com.google.protobuf protobuf-java-util - ${protobuf.version} io.grpc @@ -448,7 +437,7 @@ javax.annotation javax.annotation-api - 1.3.2 + ${javax.annotation-api.version} diff --git a/gax-java/gax-bom/build.gradle b/gax-java/gax-bom/build.gradle index 6dfd30ff59..8a9dcd7cf5 100644 --- a/gax-java/gax-bom/build.gradle +++ b/gax-java/gax-bom/build.gradle @@ -5,7 +5,7 @@ plugins { archivesBaseName = 'gax-bom' -project.version = "2.20.1" // {x-version-update:gax-bom:current} +project.version = "2.20.1" // {x-version-update:gax:current} def mavenJavaDir = "$buildDir/publications/mavenJava" def mavenJavaBomOutputFile = file(mavenJavaDir + '/pom-default.xml') diff --git a/gax-java/gax-bom/pom.xml b/gax-java/gax-bom/pom.xml index 1681cf4f9a..0af7a1e44b 100644 --- a/gax-java/gax-bom/pom.xml +++ b/gax-java/gax-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.api gax-bom - 2.20.1 + 2.20.2-SNAPSHOT pom GAX (Google Api eXtensions) for Java (BOM) Google Api eXtensions for Java (BOM) @@ -42,34 +42,34 @@ com.google.api gax - 2.20.1 + 2.20.2-SNAPSHOT com.google.api gax - 2.20.1 + 2.20.2-SNAPSHOT testlib com.google.api gax-grpc - 2.20.1 + 2.20.2-SNAPSHOT com.google.api gax-grpc - 2.20.1 + 2.20.2-SNAPSHOT testlib com.google.api gax-httpjson - 0.105.1 + 0.105.2-SNAPSHOT com.google.api gax-httpjson - 0.105.1 + 0.105.2-SNAPSHOT testlib diff --git a/gax-java/gax-grpc/pom.xml b/gax-java/gax-grpc/pom.xml index ad7addccda..7f9e8dae30 100644 --- a/gax-java/gax-grpc/pom.xml +++ b/gax-java/gax-grpc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax-grpc - 2.20.1 + 2.20.2-SNAPSHOT jar GAX (Google Api eXtensions) for Java (gRPC) Google Api eXtensions for Java (gRPC) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.20.1 + 2.20.2-SNAPSHOT diff --git a/gax-java/gax-httpjson/pom.xml b/gax-java/gax-httpjson/pom.xml index 32fcdc5f16..9e192cccae 100644 --- a/gax-java/gax-httpjson/pom.xml +++ b/gax-java/gax-httpjson/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax-httpjson - 0.105.1 + 0.105.2-SNAPSHOT jar GAX (Google Api eXtensions) for Java (HTTP JSON) Google Api eXtensions for Java (HTTP JSON) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.20.1 + 2.20.2-SNAPSHOT diff --git a/gax-java/gax/pom.xml b/gax-java/gax/pom.xml index 09f587cb3d..793f459bd3 100644 --- a/gax-java/gax/pom.xml +++ b/gax-java/gax/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax - 2.20.1 + 2.20.2-SNAPSHOT jar GAX (Google Api eXtensions) for Java (Core) Google Api eXtensions for Java (Core) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.20.1 + 2.20.2-SNAPSHOT diff --git a/gax-java/pom.xml b/gax-java/pom.xml index 98b084d3e1..2ef6360785 100644 --- a/gax-java/pom.xml +++ b/gax-java/pom.xml @@ -4,16 +4,16 @@ com.google.api gax-parent pom - 2.20.1 + 2.20.2-SNAPSHOT GAX (Google Api eXtensions) for Java (Parent) https://github.com/googleapis/gax-java Google Api eXtensions for Java (Parent) com.google.cloud - google-cloud-shared-config - 1.5.5 - + gapic-generator-java-pom-parent + 2.12.1-SNAPSHOT + ../gapic-generator-java-pom-parent @@ -57,7 +57,7 @@ com.google.api api-common - 2.2.2 + 2.3.2-SNAPSHOT com.google.auth @@ -124,24 +124,24 @@ com.google.api gax - 2.20.1 + 2.20.2-SNAPSHOT com.google.api gax - 2.20.1 + 2.20.2-SNAPSHOT test-jar testlib com.google.api.grpc proto-google-common-protos - 2.11.0 + 2.11.1-SNAPSHOT com.google.api.grpc grpc-google-common-protos - 2.11.0 + 2.11.1-SNAPSHOT io.grpc @@ -170,7 +170,7 @@ com.google.protobuf protobuf-bom - 3.21.10 + ${protobuf.version} pom import diff --git a/java-common-protos/grpc-google-common-protos/pom.xml b/java-common-protos/grpc-google-common-protos/pom.xml index e4c7249e95..4c53615c96 100644 --- a/java-common-protos/grpc-google-common-protos/pom.xml +++ b/java-common-protos/grpc-google-common-protos/pom.xml @@ -58,7 +58,7 @@ javax.annotation javax.annotation-api - 1.3.2 + ${javax.annotation-api.version} diff --git a/java-common-protos/pom.xml b/java-common-protos/pom.xml index c8c2149fcb..c846224ddc 100644 --- a/java-common-protos/pom.xml +++ b/java-common-protos/pom.xml @@ -13,9 +13,9 @@ com.google.cloud - google-cloud-shared-config - 1.5.4 - + gapic-generator-java-pom-parent + 2.12.1-SNAPSHOT + ../gapic-generator-java-pom-parent @@ -64,9 +64,7 @@ UTF-8 github google-iam-parent - 3.21.9 4.13.2 - 1.51.1 31.1-jre @@ -104,7 +102,7 @@ javax.annotation javax.annotation-api - 1.3.2 + ${javax.annotation-api.version} diff --git a/java-iam/pom.xml b/java-iam/pom.xml index 51e63248d1..4d12b4e449 100644 --- a/java-iam/pom.xml +++ b/java-iam/pom.xml @@ -13,9 +13,9 @@ com.google.cloud - google-cloud-shared-config - 1.5.5 - + gapic-generator-java-pom-parent + 2.12.1-SNAPSHOT + ../gapic-generator-java-pom-parent @@ -68,20 +68,31 @@ + + com.google.guava + guava-bom + ${guava.version} + pom + import + com.google.protobuf protobuf-bom - 3.21.9 + ${protobuf.version} pom import - - com.google.cloud - google-cloud-shared-dependencies - 3.0.6 + io.grpc + grpc-bom + ${grpc.version} + pom + import + + + com.google.api + gax-bom + 2.20.2-SNAPSHOT pom import @@ -100,6 +111,11 @@ google-iam-policy 1.6.23-SNAPSHOT + + com.google.api.grpc + proto-google-common-protos + 2.11.1-SNAPSHOT + com.google.api.grpc proto-google-iam-v2beta @@ -120,6 +136,11 @@ proto-google-iam-v1 1.6.23-SNAPSHOT + + javax.annotation + javax.annotation-api + ${javax.annotation-api.version} + junit diff --git a/pom.xml b/pom.xml index 2bee8665f5..3950b69edc 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,13 @@ + gapic-generator-java-pom-parent api-common-java gax-java gapic-generator-java java-common-protos java-iam - + gapic-generator-java-bom diff --git a/versions.txt b/versions.txt index 34a9138050..b9064ef863 100644 --- a/versions.txt +++ b/versions.txt @@ -1,12 +1,11 @@ # Format: # module:released-version:current-version -api-common:2.3.1:2.3.1 gapic-generator-java:2.12.0:2.12.1-SNAPSHOT -gax:2.20.1:2.20.1 -gax-bom:2.20.1:2.20.1 -gax-grpc:2.20.1:2.20.1 -gax-httpjson:0.105.1:0.105.1 +api-common:2.3.1:2.3.2-SNAPSHOT +gax:2.20.1:2.20.2-SNAPSHOT +gax-grpc:2.20.1:2.20.2-SNAPSHOT +gax-httpjson:0.105.1:0.105.2-SNAPSHOT proto-google-common-protos:2.11.0:2.11.1-SNAPSHOT grpc-google-common-protos:2.11.0:2.11.1-SNAPSHOT proto-google-iam-v1:1.6.22:1.6.23-SNAPSHOT