bazelbuild / rules_scala

Scala rules for Bazel
Apache License 2.0
363 stars 278 forks source link

Bump ScalaPB, protoc-bridge, gRPC, and Guava deps, and add `ProtobufAdapter`s and `ScalaPBCodeGenerator` wrappers #1648

Open mbland opened 1 week ago

mbland commented 1 week ago

Description

Adds ScalaPB 0.11.17, protoc-bridge 0.9.8, gRPC 1.68.1, and Guava 33.3.1-jre as root artifacts in scripts/create_repository.py and ProtobufAdapters for cross Scala version compatibility. Adds ScalaPBCodeGenerator wrappers to ensure all ScalaPB workers catch all exceptions to avoid build hangs when updating the Protobuf library.

This change does not bump the Protobuf library version, which can happen in another PR and is up for discussion in #1647. As always, I'm happy to break this apart, at least into one "version bump and compatibility updates" PR and one "wrap ScalaPBCodeGenerator" PR, if so desired.

There are lots of details in the individual commit messages.

Motivation

These changes are spawned from #1482 and #1647, whereby I investigated what it would take to update the Protobuf version to accommodate future Bzlmod users that depend on newer Protobuf versions.

These changes were essential to the Protobuf experiment, yet aren't necessarily essential to the Bzlmod work, but they're generally beneficial to include for their own sake. All builds and tests are still compatible with all supported Scala versions, on Bazel 6 and Bazel 7.

This is also a good demonstration of how to add new root artifact dependencies to scripts/create_repository.py, and how easy it is to run the script and get correct updates across all supported Scala versions.

Regarding the ScalaPBCodeGenerator wrappers, I encountered more hanging builds in my bzlmod-update-abseil-cpp-and-protobuf working branch that the changes from #1637 didn't catch. I backported Wrap ScalaPbCodeGenerator, expose Scala 2.11 error from that branch into this one.

See that commit's message and #1647 for the gory details on why the ScalaPB libs are so sensitive to the Protobuf version and why we have to use wrappers to avoid hanging the build.

mbland commented 1 day ago

FYI, and FWIW, Iust filed scalapb/ScalaPB#1771 to see about applying fixes upstream to avoid scalapb.ScalaPbCodeGenerator hangs in future versions.