How to use a sub-repo/sub-module in another root module #26953
Unanswered
mikael-s-persson
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have basically the following structure:
In order to build any target in lib_b that refers to
@lib_c, I need to "use" that repo at the top level MODULE.bazel in "lib_a". I have tried to follow and adapt the examples that instruct to use a module extension for this purpose, but to no avail.I have a repro here: mikael-s-persson/bazelbuild_examples@a908775
It has the following files (pretend
lib_aandlib_bare two separately hosted packages (git/http)):In relevant part. In theory, the
lib_b/MODULE.bazelcould contain:But that only works to build
lib_btargets when it is the root module. Trying to build targets inlib_athat depend on targets fromlib_bfails becausethird_party/lib_cis not a subdirectory oflib_a, obviously.I tried a bunch of different things (lost count), and some of which I noted in the code I linked to above. Nothing seems to work so far. The best I could manage was to create a
relative_repositoryrule that is likelocal_repositorybut also takes a parent repository label (e.g.,@lib_b) and assumes the local path to be relative to where that repo is located from the workspace root, but that fails at thelib_alevel because it can't find that directory, although I can definitely see that it exists where bazel it doesn't (in the build cache folder).Long story short, how do I make this work?
How should
lib_buselib_csuch thatlib_bis also buildable as a dependency, not just as the root module?How can
lib_amake@lib_caccessible too?All reactions