I was looking for ways to compose local repositories in the bazel modules world, without changing any checked-in files.
I was experimenting on my repo bazel-rules-bid
, and I wanted to locally override the dependency gotopt2
. See at https://github.com/filmil/bazel-rules-bid/blob/main/MODULE.bazel#L11
I did this by adding the following to my user.bazelrc
:
build --override_repository=+bazel_rules_bid_extension+gotopt2=/home/filmil/code/bazel/gotopt2
But, while this “worked” in the sense that the override was honored, I got the error:
╰─>$ bazel build //...
ERROR: error loading package '@@+bazel_rules_bid_extension+gotopt2//': Unable to find package for @@[unknown repo 'gazelle' requested from @@+bazel_rules_bid_extension+gotopt2]//:def.bzl: The repository '@@[unknown repo 'gazelle' requested from @@+bazel_rules_bid_extension+gotopt2]' could not be resolved: No repository visible as '@gazelle' from repository '@@+bazel_rules_bid_extension+gotopt2'.
ERROR: /home/filmil/code/bazel/bazel-rules-bid/build/BUILD.bazel:16:8: error loading package '@@+bazel_rules_bid_extension+gotopt2//': Unable to find package for @@[unknown repo 'gazelle' requested from @@+bazel_rules_bid_extension+gotopt2]//:def.bzl: The repository '@@[unknown repo 'gazelle' requested from @@+bazel_rules_bid_extension+gotopt2]' could not be resolved: No repository visible as '@gazelle' from repository '@@+bazel_rules_bid_extension+gotopt2'. and referenced by '//build:gen_docker_run'
ERROR: Analysis of target '//build:gen_docker_run' failed; build aborted: Analysis failed
INFO: Elapsed time: 1.681s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
I noticed that the error goes away if I add the appropriate bazel_dep
in bazel-rules-bid
. Is this expected? If yes, is there a way to override the repo in a way that handles the dependencies? Do I have to use bazel_dep
for that?
Thanks,
F
I also tried this if I bring in the repo gotopt2
using bazel_dep(...)
, and changing the override repository to:
build --override_repository=gotopt2+=/home/filmil/code/bazel/gotopt2
but the same behavior remains.
F
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bazel-discuss/CAKaOXii-z7Jod0RnfZHZXMm-cesBPNKuB%3D7rzjP%3DQYksFS9MVA%40mail.gmail.com.