We have a repository which uses bazel build, Folder structure is such that remote_repo -> source -> BUILD we have added target in BUILD file like //source:target (starts from root folder) This works fine when we run Bazel command in remote_repo
Now this repository is added as a remote repo to another repository in git in the form of submodule. Folder structure is like actual_repo -> applications -> our_application -> remote_repo -> source -> BUILD When I try to compile actual repo which has its own BUILD file and remote repo BUILD is added as dependent target, am getting error: as no package found at source (//source:target starts from root, it is not able to find target).
How to resolve such an issue?
The problem here is, that you now have to use a longer path like
//applications/our_application/remote_repo/source:target
as target labels are relative to theWORKSPACE
root.Another option would be to include the submodule as a
local_repository()
and referencing your target as@remote_repo//source:target
(given you've named the repository accordingly).