-
-
Notifications
You must be signed in to change notification settings - Fork 274
Description
Since protocolbuffers/protobuf@1999135 (aka 32.0+), the protobuf
dependency in BCR uses maven.install
with a lockfile on the @maven
name instead of @protobuf_maven
: https://github.com/protocolbuffers/protobuf/blob/894039e7512e9940095a0bf04214adcba7a37adb/MODULE.bazel#L221-L228
Similarly, following feedback on the same logic, since 5.4.0 rules_proto_grpc pulls its 'user' dependencies into the same @maven
repo, without a lockfile: https://github.com/rules-proto-grpc/rules_proto_grpc/blob/e40a70e7375f6dab68d402e78ff540c9d8177a09/modules/java/MODULE.bazel#L22-L25
A top level user may use rules_proto_grpc_java
, which has a transitive dependency on protobuf
and if they do not specify a lock file (or don't even use maven.install
) then the protobuf lock file 'wins' and only its dependencies show up in the @maven
repo and attempting to use a dep from outside the lockfile errors with a missing target.
See https://buildkite.com/bazel/rules-proto-grpc-rules-proto-grpc/builds/3744/steps/canvas?sid=0198eb95-044b-439a-9710-7bce4943ba79 for an example error
How is this meant to be handled when multiple non-root modules need to inject deps into the @maven
name?
- I cannot also add a lock file to rules_proto_grpc with the additional deps like protobuf has, as only a single non-root lock file is permitted (note also that this code below fails to print the error because
lock_files
is an array of labels not strings):
rules_jvm_external/private/extensions/maven.bzl
Lines 631 to 636 in 7d00153
for repo_name, lock_files in repo_to_lock_file.items(): | |
if len(lock_files) > 1: | |
fail("There can only be one lock file for the repo %s. Lock files seen were %s" % ( | |
repo_name, | |
", ".join(lock_files), | |
)) |
-
Should the protobuf repo drop their lockfile?
-
Or is this additional functionality that needs adding to rules_jvm_external?