bazel: Use jarjar to avoid xds deps #12243
Merged
+380
−188
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Avoiding so many deps will allow us to upgrade the protos without being forced to upgrade to protobuf-java 4.x. It also removes the remaining non-bzlmod dependencies.
It'd be really easy to get this wrong, so we do two things 1) mirror the gradle configuration as much as possible, as that sees a lot of testing, and 2) run the fake control plane with the results of jarjar. There's lots of classes that we could mess up, but that at least kicks the tires.
XdsTestUtils.buildRouteConfiguration() was moved to ControlPlaneRule to stop the unnecessary circular dependency between the classes and to avoid the many dependencies of XdsTestUtils.
I'm totally hacking java_grpc_library to improve the dependency situation. Long-term, I think we will stop building Java libraries with Bazel and require users to rely entirely on Maven Central. That seems to be the direction Bazel is going and it will greatly simplify the problems we've seen with protobuf having a single repository for many languages. So while the hack isn't too bad, I hope we won't have to live with it long-term.
CC @shivaspeaks, @ted-xie, @mering