Skip to content

Commit

Permalink
feat: parent pom and gapic-generator-java-bom (#1170)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
suztomo committed Dec 21, 2022
1 parent 53be6b7 commit 4dd5fcf
Show file tree
Hide file tree
Showing 16 changed files with 307 additions and 76 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/ci-maven.yaml
Expand Up @@ -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"
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -87,5 +101,5 @@ jobs:
cache: maven
- run: java -version
- name: Java Linter
run: mvn fmt:check
working-directory: gapic-generator-java
# Exclude the root project
run: mvn -B -ntp --projects '!.' fmt:check
11 changes: 6 additions & 5 deletions api-common-java/pom.xml
Expand Up @@ -5,15 +5,16 @@
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
<packaging>jar</packaging>
<version>2.3.1</version><!-- {x-version-update:api-common:current} -->
<version>2.3.2-SNAPSHOT</version><!-- {x-version-update:api-common:current} -->
<name>API Common</name>
<url>https://github.com/googleapis/api-common-java</url>
<description>Common utilities for Google APIs in Java</description>

<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-shared-config</artifactId>
<version>1.5.5</version>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<relativePath>../gapic-generator-java-pom-parent</relativePath>
</parent>

<developers>
Expand Down Expand Up @@ -49,7 +50,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
Expand All @@ -69,7 +70,7 @@
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<version>${javax.annotation-api.version}</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
Expand Down
99 changes: 99 additions & 0 deletions gapic-generator-java-bom/pom.xml
@@ -0,0 +1,99 @@
<?xml version='1.0' encoding='UTF-8'?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-bom</artifactId>
<packaging>pom</packaging>
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<name>GAPIC Generator Java BOM</name>
<description>
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.
</description>

<parent>
<groupId>com.google.cloud</groupId>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<relativePath>../gapic-generator-java-pom-parent</relativePath>
</parent>

<dependencyManagement>
<dependencies>
<!-- Major external dependencies -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-bom</artifactId>
<version>${grpc.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>${protobuf.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<!-- Libraries published from this repositories -->
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
<version>2.3.2-SNAPSHOT</version><!-- {x-version-update:api-common:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-bom</artifactId>
<version>2.20.2-SNAPSHOT</version><!-- {x-version-update:gax:current} -->
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
<version>2.11.1-SNAPSHOT</version><!-- {x-version-update:proto-google-common-protos:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
<version>2.11.1-SNAPSHOT</version><!-- {x-version-update:proto-google-common-protos:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-iam-v1</artifactId>
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-iam-v2</artifactId>
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v2:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-iam-v2beta</artifactId>
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:proto-google-iam-v2beta:current} -->
</dependency>

<!-- Following test deps are kept to keep them consistent with versions above -->
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v1</artifactId>
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v2</artifactId>
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v2:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v2beta</artifactId>
<version>1.6.23-SNAPSHOT</version><!-- {x-version-update:grpc-google-iam-v2beta:current} -->
</dependency>
</dependencies>

</dependencyManagement>

</project>
109 changes: 109 additions & 0 deletions gapic-generator-java-pom-parent/pom.xml
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<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" child.project.url.inherit.append.path="false">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<packaging>pom</packaging>
<name>GAPIC Generator Java POM Parent</name>
<url>https://github.com/googleapis/google-cloud-java</url>
<description>
The top-level parent for all modules in the repository.
</description>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-shared-config</artifactId>
<version>1.5.5</version>
<relativePath/>
</parent>

<properties>
<skipUnitTests>false</skipUnitTests>
<checkstyle.header.file>java.header</checkstyle.header.file>

<!-- External dependencies, expecially gRPC and Protobuf version, should be
consistent across modules in this repository -->
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
<grpc.version>1.51.1</grpc.version>
<guava.version>31.1-jre</guava.version>
<protobuf.version>3.21.10</protobuf.version>
</properties>

<developers>
<developer>
<id>suztomo</id>
<name>Tomo Suzuki</name>
<email>suztomo@google.com</email>
<organization>Google</organization>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<organization>
<name>Google LLC</name>
</organization>
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false"
child.scm.url.inherit.append.path="false">
<connection>scm:git:git@github.com:googleapis/google-cloud-java.git</connection>
<developerConnection>scm:git:git@github.com:googleapis/google-cloud-java.git</developerConnection>
<url>https://github.com/googleapis/google-cloud-java</url>
<tag>HEAD</tag>
</scm>
<issueManagement>
<url>https://github.com/googleapis/google-cloud-java/issues</url>
<system>GitHub Issues</system>
</issueManagement>

<licenses>
<license>
<name>Apache-2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<profiles>
<profile>
<!-- Only run checkstyle plugin on Java 11+ (checkstyle artifact only supports Java 11+) -->
<id>checkstyle-tests</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<headerLocation>${checkstyle.header.file}</headerLocation>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<repositories>
<repository>
<id>google-maven-central-copy</id>
<name>Google Maven Central copy</name>
<url>https://maven-central.storage-download.googleapis.com/maven2</url>
</repository>
<repository>
<id>maven-central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
</repository>
</repositories>
</project>
23 changes: 6 additions & 17 deletions gapic-generator-java/pom.xml
Expand Up @@ -13,34 +13,24 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Should be in sync with repositories.bzl -->
<googleapis.commit>44d6bef0ca6db8bba3fb324c8186e694bcc4829c</googleapis.commit>
<gax.version>2.20.1</gax.version>
<grpc.version>1.51.1</grpc.version>
<protobuf.version>3.21.10</protobuf.version>
<auto-value.version>1.10.1</auto-value.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-shared-config</artifactId>
<version>1.5.5</version>
<relativePath/>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<relativePath>../gapic-generator-java-pom-parent</relativePath>
</parent>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-bom</artifactId>
<version>${gax.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-bom</artifactId>
<version>${grpc.version}</version>
<artifactId>gapic-generator-java-bom</artifactId>
<version>2.12.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -410,7 +400,6 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
Expand Down Expand Up @@ -448,7 +437,7 @@
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<version>${javax.annotation-api.version}</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion gax-java/gax-bom/build.gradle
Expand Up @@ -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')
Expand Down

0 comments on commit 4dd5fcf

Please sign in to comment.