Skip to content

Commit 4dd5fcf

Browse files
authored
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
1 parent 53be6b7 commit 4dd5fcf

File tree

16 files changed

+307
-76
lines changed

16 files changed

+307
-76
lines changed

.github/workflows/ci-maven.yaml

+21-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
- run: java -version
2121
- name: Unit Tests
2222
run: |
23-
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip
23+
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
24+
-Dfmt.skip
2425
2526
units-java8:
2627
name: "units (8) except gapic-generator-java"
@@ -48,7 +49,8 @@ jobs:
4849
4950
# Why not compile? It's because the process needs to package jar so
5051
# that gapic-generator-java module can use testlib modules of gax.
51-
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip -DskipTests
52+
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
53+
-DskipTests -Dfmt.skip
5254
- name: Run test with Java 8 for all modules except gapic-generator-java
5355
shell: bash
5456
run: |
@@ -58,23 +60,35 @@ jobs:
5860
# useIncrementalCompilation=false to avoid recompiling classes
5961
# generated by Java 11 compiler above.
6062
mvn -B -ntp test --projects '!gapic-generator-java' \
61-
-Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false
63+
-Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false \
64+
-Dfmt.skip
6265
6366
units-java8-gapic-generator-java:
6467
name: "units (8) for gapic-generator-java"
6568
runs-on: ubuntu-latest
6669
steps:
6770
- uses: actions/checkout@v3
71+
- uses: actions/setup-java@v3
72+
with:
73+
java-version: 11
74+
distribution: temurin
75+
cache: maven
76+
- name: Install modules outside gapic-generator-java
77+
shell: bash
78+
run: |
79+
mvn -B -ntp install --projects '!gapic-generator-java' \
80+
-Dcheckstyle.skip -Dfmt.skip -DskipTests
6881
- uses: actions/setup-java@v3
6982
with:
7083
java-version: 8
7184
distribution: temurin
7285
cache: maven
7386
- run: java -version
74-
- name: Run test only for gapic-generator-java
87+
- name: Run test only for gapic-generator-java using Java 8
7588
shell: bash
7689
run: |
77-
mvn -B -ntp verify --projects 'gapic-generator-java' -Dcheckstyle.skip
90+
mvn -B -ntp verify --projects 'gapic-generator-java' \
91+
-Dcheckstyle.skip -Dfmt.skip
7892
7993
lint:
8094
runs-on: ubuntu-latest
@@ -87,5 +101,5 @@ jobs:
87101
cache: maven
88102
- run: java -version
89103
- name: Java Linter
90-
run: mvn fmt:check
91-
working-directory: gapic-generator-java
104+
# Exclude the root project
105+
run: mvn -B -ntp --projects '!.' fmt:check

api-common-java/pom.xml

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
<groupId>com.google.api</groupId>
66
<artifactId>api-common</artifactId>
77
<packaging>jar</packaging>
8-
<version>2.3.1</version><!-- {x-version-update:api-common:current} -->
8+
<version>2.3.2-SNAPSHOT</version><!-- {x-version-update:api-common:current} -->
99
<name>API Common</name>
1010
<url>https://github.com/googleapis/api-common-java</url>
1111
<description>Common utilities for Google APIs in Java</description>
1212

1313
<parent>
1414
<groupId>com.google.cloud</groupId>
15-
<artifactId>google-cloud-shared-config</artifactId>
16-
<version>1.5.5</version>
15+
<artifactId>gapic-generator-java-pom-parent</artifactId>
16+
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
17+
<relativePath>../gapic-generator-java-pom-parent</relativePath>
1718
</parent>
1819

1920
<developers>
@@ -49,7 +50,7 @@
4950
<dependency>
5051
<groupId>com.google.guava</groupId>
5152
<artifactId>guava</artifactId>
52-
<version>31.1-jre</version>
53+
<version>${guava.version}</version>
5354
</dependency>
5455
<dependency>
5556
<groupId>com.google.auto.value</groupId>
@@ -69,7 +70,7 @@
6970
<dependency>
7071
<groupId>javax.annotation</groupId>
7172
<artifactId>javax.annotation-api</artifactId>
72-
<version>1.3.2</version>
73+
<version>${javax.annotation-api.version}</version>
7374
</dependency>
7475
<dependency>
7576
<groupId>com.google.errorprone</groupId>

gapic-generator-java-bom/pom.xml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.google.api</groupId>
5+
<artifactId>gapic-generator-java-bom</artifactId>
6+
<packaging>pom</packaging>
7+
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
8+
<name>GAPIC Generator Java BOM</name>
9+
<description>
10+
BOM for the libraries in gapic-generator-java repository. Users should not
11+
depend on this artifact explicitly because this BOM is an implementation
12+
detail of the Libraries BOM.
13+
</description>
14+
15+
<parent>
16+
<groupId>com.google.cloud</groupId>
17+
<artifactId>gapic-generator-java-pom-parent</artifactId>
18+
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
19+
<relativePath>../gapic-generator-java-pom-parent</relativePath>
20+
</parent>
21+
22+
<dependencyManagement>
23+
<dependencies>
24+
<!-- Major external dependencies -->
25+
<dependency>
26+
<groupId>io.grpc</groupId>
27+
<artifactId>grpc-bom</artifactId>
28+
<version>${grpc.version}</version>
29+
<type>pom</type>
30+
<scope>import</scope>
31+
</dependency>
32+
<dependency>
33+
<groupId>com.google.protobuf</groupId>
34+
<artifactId>protobuf-bom</artifactId>
35+
<version>${protobuf.version}</version>
36+
<type>pom</type>
37+
<scope>import</scope>
38+
</dependency>
39+
40+
<!-- Libraries published from this repositories -->
41+
<dependency>
42+
<groupId>com.google.api</groupId>
43+
<artifactId>api-common</artifactId>
44+
<version>2.3.2-SNAPSHOT</version><!-- {x-version-update:api-common:current} -->
45+
</dependency>
46+
<dependency>
47+
<groupId>com.google.api</groupId>
48+
<artifactId>gax-bom</artifactId>
49+
<version>2.20.2-SNAPSHOT</version><!-- {x-version-update:gax:current} -->
50+
<type>pom</type>
51+
<scope>import</scope>
52+
</dependency>
53+
<dependency>
54+
<groupId>com.google.api.grpc</groupId>
55+
<artifactId>grpc-google-common-protos</artifactId>
56+
<version>2.11.1-SNAPSHOT</version><!-- {x-version-update:proto-google-common-protos:current} -->
57+
</dependency>
58+
<dependency>
59+
<groupId>com.google.api.grpc</groupId>
60+
<artifactId>proto-google-common-protos</artifactId>
61+
<version>2.11.1-SNAPSHOT</version><!-- {x-version-update:proto-google-common-protos:current} -->
62+
</dependency>
63+
<dependency>
64+
<groupId>com.google.api.grpc</groupId>
65+
<artifactId>proto-google-iam-v1</artifactId>
66+
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v1:current} -->
67+
</dependency>
68+
<dependency>
69+
<groupId>com.google.api.grpc</groupId>
70+
<artifactId>proto-google-iam-v2</artifactId>
71+
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v2:current} -->
72+
</dependency>
73+
<dependency>
74+
<groupId>com.google.api.grpc</groupId>
75+
<artifactId>proto-google-iam-v2beta</artifactId>
76+
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v2beta:current} -->
77+
</dependency>
78+
79+
<!-- Following test deps are kept to keep them consistent with versions above -->
80+
<dependency>
81+
<groupId>com.google.api.grpc</groupId>
82+
<artifactId>grpc-google-iam-v1</artifactId>
83+
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v1:current} -->
84+
</dependency>
85+
<dependency>
86+
<groupId>com.google.api.grpc</groupId>
87+
<artifactId>grpc-google-iam-v2</artifactId>
88+
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v2:current} -->
89+
</dependency>
90+
<dependency>
91+
<groupId>com.google.api.grpc</groupId>
92+
<artifactId>grpc-google-iam-v2beta</artifactId>
93+
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v2beta:current} -->
94+
</dependency>
95+
</dependencies>
96+
97+
</dependencyManagement>
98+
99+
</project>
+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" child.project.url.inherit.append.path="false">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.google.cloud</groupId>
7+
<artifactId>gapic-generator-java-pom-parent</artifactId>
8+
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
9+
<packaging>pom</packaging>
10+
<name>GAPIC Generator Java POM Parent</name>
11+
<url>https://github.com/googleapis/google-cloud-java</url>
12+
<description>
13+
The top-level parent for all modules in the repository.
14+
</description>
15+
<parent>
16+
<groupId>com.google.cloud</groupId>
17+
<artifactId>google-cloud-shared-config</artifactId>
18+
<version>1.5.5</version>
19+
<relativePath/>
20+
</parent>
21+
22+
<properties>
23+
<skipUnitTests>false</skipUnitTests>
24+
<checkstyle.header.file>java.header</checkstyle.header.file>
25+
26+
<!-- External dependencies, expecially gRPC and Protobuf version, should be
27+
consistent across modules in this repository -->
28+
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
29+
<grpc.version>1.51.1</grpc.version>
30+
<guava.version>31.1-jre</guava.version>
31+
<protobuf.version>3.21.10</protobuf.version>
32+
</properties>
33+
34+
<developers>
35+
<developer>
36+
<id>suztomo</id>
37+
<name>Tomo Suzuki</name>
38+
<email>[email protected]</email>
39+
<organization>Google</organization>
40+
<roles>
41+
<role>Developer</role>
42+
</roles>
43+
</developer>
44+
</developers>
45+
<organization>
46+
<name>Google LLC</name>
47+
</organization>
48+
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false"
49+
child.scm.url.inherit.append.path="false">
50+
<connection>scm:git:[email protected]:googleapis/google-cloud-java.git</connection>
51+
<developerConnection>scm:git:[email protected]:googleapis/google-cloud-java.git</developerConnection>
52+
<url>https://github.com/googleapis/google-cloud-java</url>
53+
<tag>HEAD</tag>
54+
</scm>
55+
<issueManagement>
56+
<url>https://github.com/googleapis/google-cloud-java/issues</url>
57+
<system>GitHub Issues</system>
58+
</issueManagement>
59+
60+
<licenses>
61+
<license>
62+
<name>Apache-2.0</name>
63+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
64+
</license>
65+
</licenses>
66+
67+
<profiles>
68+
<profile>
69+
<!-- Only run checkstyle plugin on Java 11+ (checkstyle artifact only supports Java 11+) -->
70+
<id>checkstyle-tests</id>
71+
<activation>
72+
<jdk>[11,)</jdk>
73+
</activation>
74+
<build>
75+
<plugins>
76+
<plugin>
77+
<groupId>org.apache.maven.plugins</groupId>
78+
<artifactId>maven-checkstyle-plugin</artifactId>
79+
<executions>
80+
<execution>
81+
<id>checkstyle</id>
82+
<phase>validate</phase>
83+
<goals>
84+
<goal>check</goal>
85+
</goals>
86+
<configuration>
87+
<headerLocation>${checkstyle.header.file}</headerLocation>
88+
</configuration>
89+
</execution>
90+
</executions>
91+
</plugin>
92+
</plugins>
93+
</build>
94+
</profile>
95+
</profiles>
96+
97+
<repositories>
98+
<repository>
99+
<id>google-maven-central-copy</id>
100+
<name>Google Maven Central copy</name>
101+
<url>https://maven-central.storage-download.googleapis.com/maven2</url>
102+
</repository>
103+
<repository>
104+
<id>maven-central</id>
105+
<name>Maven Central</name>
106+
<url>https://repo1.maven.org/maven2</url>
107+
</repository>
108+
</repositories>
109+
</project>

gapic-generator-java/pom.xml

+6-17
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,24 @@
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
<!-- Should be in sync with repositories.bzl -->
1515
<googleapis.commit>44d6bef0ca6db8bba3fb324c8186e694bcc4829c</googleapis.commit>
16-
<gax.version>2.20.1</gax.version>
17-
<grpc.version>1.51.1</grpc.version>
18-
<protobuf.version>3.21.10</protobuf.version>
1916
<auto-value.version>1.10.1</auto-value.version>
2017
<maven.compiler.source>1.8</maven.compiler.source>
2118
<maven.compiler.target>1.8</maven.compiler.target>
2219
</properties>
2320

2421
<parent>
2522
<groupId>com.google.cloud</groupId>
26-
<artifactId>google-cloud-shared-config</artifactId>
27-
<version>1.5.5</version>
28-
<relativePath/>
23+
<artifactId>gapic-generator-java-pom-parent</artifactId>
24+
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
25+
<relativePath>../gapic-generator-java-pom-parent</relativePath>
2926
</parent>
3027

3128
<dependencyManagement>
3229
<dependencies>
3330
<dependency>
3431
<groupId>com.google.api</groupId>
35-
<artifactId>gax-bom</artifactId>
36-
<version>${gax.version}</version>
37-
<type>pom</type>
38-
<scope>import</scope>
39-
</dependency>
40-
<dependency>
41-
<groupId>io.grpc</groupId>
42-
<artifactId>grpc-bom</artifactId>
43-
<version>${grpc.version}</version>
32+
<artifactId>gapic-generator-java-bom</artifactId>
33+
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
4434
<type>pom</type>
4535
<scope>import</scope>
4636
</dependency>
@@ -410,7 +400,6 @@
410400
<dependency>
411401
<groupId>com.google.protobuf</groupId>
412402
<artifactId>protobuf-java-util</artifactId>
413-
<version>${protobuf.version}</version>
414403
</dependency>
415404
<dependency>
416405
<groupId>io.grpc</groupId>
@@ -448,7 +437,7 @@
448437
<dependency>
449438
<groupId>javax.annotation</groupId>
450439
<artifactId>javax.annotation-api</artifactId>
451-
<version>1.3.2</version>
440+
<version>${javax.annotation-api.version}</version>
452441
</dependency>
453442

454443
<dependency>

gax-java/gax-bom/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55

66
archivesBaseName = 'gax-bom'
77

8-
project.version = "2.20.1" // {x-version-update:gax-bom:current}
8+
project.version = "2.20.1" // {x-version-update:gax:current}
99

1010
def mavenJavaDir = "$buildDir/publications/mavenJava"
1111
def mavenJavaBomOutputFile = file(mavenJavaDir + '/pom-default.xml')

0 commit comments

Comments
 (0)