Reputation: 1322
What label can be used to reference a local package from an external package's BUILD file?
Say I have package A, which is my top level package. In the WORKSPACE file of package A, I grab external package B, which I use the build_file argument to overlay a BUILD.bazel file onto.
A's cc_library rule does not actually depend on B. The A.Tests rule, depends on A and on B. B has a dependency on A as well.
In the BUILD file that I defined for B, how do I reference A? No labels seemed to work. Is this possible?
Upvotes: 0
Views: 232
Reputation: 1322
Inside of B's BUILD file (specified with the build_file argument), I can reference A via this label: @//<path_to_A>
Upvotes: 0
Reputation: 4271
If A.Tests depends on B (and A), and B also depends on A, why are A and B separate?
To answer your question, you need to create a third workspace C, declare both A and B as external workspaces, then A's targets can reference @B//x:y
and B's targets can reference @A//z:w
.
Upvotes: 1