Skip to content

Commit

Permalink
Update java-dependency-guide contributor-doc reflecting gcpbomupgrade…
Browse files Browse the repository at this point in the history
…r script (apache#30942)

* Update java-dependency-guide contributor-doc for GCP-BOM script usage

* Fix cross-ref link
  • Loading branch information
Abacn authored Apr 12, 2024
1 parent ce364e1 commit be7d84d
Showing 1 changed file with 16 additions and 28 deletions.
44 changes: 16 additions & 28 deletions contributor-docs/java-dependency-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,38 +93,26 @@ or on the dev mailing list, for [example](https://lists.apache.org/thread/jgjdt5

# Google Cloud-related dependency upgrades

To provide the consistent dependencies to Beam users, follow the following steps when upgrading Google Cloud-related dependencies:

- [ ] Set the Libraries BOM version. Find the latest release in
https://github.com/googleapis/java-cloud-bom/releases and set libraries-bom
value in BeamModulePlugin.groovy
- [ ] Find core Google Java library versions.
- Such as gRPC, Protobuf, Guava, Google Auth Library in the release note
of the Libraries BOM and set them in BeamModulePlugin.groovy
- [ ] Find appropriate Netty version by checking io.grpc:grpc-netty's
dependency declaration. For example, you can tell gRPC version 1.49.0
was built with Netty "4.1.77.Final" by reading
https://search.maven.org/artifact/io.grpc/grpc-netty/1.49.0/jar:
```
<artifactId>netty-codec-http2</artifactId>
<version>4.1.77.Final</version>
```
- [ ] Update netty_version in BeamModulePlugin.groovy
- [ ] Find netty-tcnative version via netty-parent artifact. For example, you
can tell Netty 4.1.77.Final was built with netty-tcnative "2.0.52.Final".
https://search.maven.org/artifact/io.netty/netty-parent/4.1.77.Final/jar:
```
<tcnative.version>2.0.52.Final</tcnative.version>
```
- [ ] Update netty_tcnative_boringssl_static version in BeamModulePlugin.groovy


The following script may be useful to identify matching/consistent dependency overrides.
Beam uses [GCP-BOM](https://cloud.google.com/java/docs/bom) to manage Google Cloud-related dependencies. A [script](../scripts/tools/bomupgrader.py) is used to upgrade GCP-BOM dependencies. To upgrade, find the latest BOM version in https://mvnrepository.com/artifact/com.google.cloud/libraries-bom and run

```
python scripts/tools/gcpbomupgrader.py <latest_bom_version>
```

then the changes will made in place.

This script does the following steps:

1. preprocessing BeamModulePlugin.groovy to decide the dependencies need to sync
2. generate an empty Maven project to fetch the exact target versions to change
3. Write back to BeamModulePlugin.groovy
4. Update libraries-bom version on sdks/java/container/license_scripts/dep_urls_java.yaml

In the case of modifying the script or diagnose, the following commands may be useful to identify matching/consistent dependency overrides.

export BOM_VERSION=26.22.0 ; \
cd /tmp; \
wget https://repo1.maven.org/maven2/com/google/cloud/libraries-bom/$BOM_VERSION/libraries-bom-$BOM_VERSION.pom -O base.pom && \
mvn help:effective-pom -f base.pom -Doutput=effective.pom && cat effective.pom | \
grep -v 'dependencyManagement' > cleanup.pom && \
mvn dependency:tree -f cleanup.pom

0 comments on commit be7d84d

Please sign in to comment.