vaticle / dependencies

Bazel dependency declarations for build tools reused across @vaticle repositories (only for @vaticle)
Mozilla Public License 2.0
12 stars 23 forks source link

Upgrade bazel rules_* and GRPC dependencies #454

Closed flyingsilverfin closed 11 months ago

flyingsilverfin commented 1 year ago

What is the goal of this PR?

In order to use the latest Bazel and GRPC versions, we have to upgrade the various rules_<lang> dependencies during the upgrade of grpc dependencies. We also replace stackb_rules_proto (https://github.com/stackb/rules_proto) with rules-proto-grpc (https://rules-proto-grpc.com/en/latest/).

What are the changes implemented in this PR?

typedb-bot commented 1 year ago

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

Code

Architecture

flyingsilverfin commented 11 months ago

Closing due the following findings:

This upgrade required upgrading the grpc build rules to a much newer version. However, the newer version of the stackb rules were tricky to use and didn't appear to work very easily. Instead, this work proceeded with rules-proto-grpc and successfully got typedb-protocol (PR), client-java (PR), factory-tracing (PR), and typedb (PR) to a working state, with the exception of assembling the final distributions.

The java_grpc_library rule provided by rules-proto-grpc are architected as macros that automatically pull in various dependencies via Bazel. See https://github.com/rules-proto-grpc/rules_proto_grpc/blob/7064b28a75b3feb014b20d3276e17498987a68e2/java/java_grpc_library.bzl#L26.

These dependencies are Bazel, not Maven dependencies. However, in order to build TypeDB's zip distributions, as well as deploy the Java client, we must provide maven coordinates for every java library we depend on. Because rules-proto-grpc does not depend on these repositories via Maven, our assembly rules fail.

One 'correct' solution could be to provide a mapping from Bazel targets to Maven coordinates to both the java_deps and the assemble_maven rules in vaticle/bazel-distribution. However, we consider reverting back to stackb simpler, since it produces source Java files instead of compiled JARs, which we can compile into our own java library and control its dependencies explicitly.

We also can gain some efficiency by delaying the Bazel and GRPC upgrade since we will drop Python support for compiling our protocol (after implementing native JNI-based drivers.)