bazel-deps icon indicating copy to clipboard operation
bazel-deps copied to clipboard

Artifacts in replacements shouldn't need versions

Open bjchambers opened this issue 6 years ago • 2 comments

Say that GRPC is loaded as a replacement, with something like:

replacements:
  io.grpc:
    grpc-core:
      lang: java
      target: "@io_grpc_grpc_java//core"
    grpc-netty:
      lang: java
      target: "@io_grpc_grpc_java//netty"
    grpc-stub:
      lang: java
      target: "@io_grpc_grpc_java//stub"

If we want to depend on that outside of third party, we need to change the visibility rule. This can be done by listing these artifacts in the main dependencies section as well. However, doing so requires a version to be set, which seems to be irrelevant since the version is already configured.

Seems like the two options for fixing this are to either (1) allow the entry in dependencies to be omit the version or (2) allow the entry in replacements to declare the library as visible.

bjchambers avatar Aug 09 '18 22:08 bjchambers

Dependencies already can omit versions. Have you had a problem with that?

johnynek avatar Aug 10 '18 04:08 johnynek

Hmm... I may have read it wrong. The documentation suggested that the version was necessary unless you wanted to use the version that was selected based on transitive dependencies of other explicitly versioned dependencies.

I can confirm that it does work, so option (1) seems to be good. Maybe an update to documentation indicating this use case?

bjchambers avatar Aug 10 '18 17:08 bjchambers