You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a workspace top_level_workspace and a sub-workspace third_party_lib:
If a visibility declaration to a target is added to third_party_lib to grant visibility to targets in top_level_workspace, bazel build //... in top_level_workspace will fail; only bazel build @top_level_workspace//... works.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
ERROR: /home/bminor/dev/bazel_workspace_bug/foo/BUILD.bazel:1:1: in filegroup rule //foo:some_app: target '@third_party_lib//:third_party_target' is not visible from target '//foo:some_app'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: Analysis of target '//foo:some_app' failed; build aborted: Analysis of target '//foo:some_app' failed; build aborted
Since the current working directory is in @top_level_workspace, I would expect that these two commands are equivalent; shouldn't //foo/... resolve to this workspace unambiguously? It's definitely inconvenient to lose the ability to do bazel build //... due to this.
What operating system are you running Bazel on?
Fedora Workstation 31
What's the output of bazel info release?
release 1.2.1
Have you found anything relevant by searching the web?
No, but this issue is a bit ambiguous to search for. Please feel free to dupe if this is already known.
The text was updated successfully, but these errors were encountered:
This is a consequence of Bazel treating @// and @top_level_workspace// differently.
The --incompatible_remap_main_repo flag merges the two and solves this issue.
I cannot tell though when --incompatible_remap_main_repo will be enabled.
Description of the problem / feature request:
Given a workspace
top_level_workspace
and a sub-workspacethird_party_lib
:If a visibility declaration to a target is added to
third_party_lib
to grant visibility to targets intop_level_workspace
,bazel build //...
intop_level_workspace
will fail; onlybazel build @top_level_workspace//...
works.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Minimal repro workspace: visibility_bug_minimal_repro.zip
In the following workspace:
WORKSPACE
//foo/BUILD.bazel
//third_party_lib/BUILD.bazel
bazel build @top_level_workspace//foo/...
succeedsbazel build //foo/...
fails:Since the current working directory is in
@top_level_workspace
, I would expect that these two commands are equivalent; shouldn't//foo/...
resolve to this workspace unambiguously? It's definitely inconvenient to lose the ability to dobazel build //...
due to this.What operating system are you running Bazel on?
Fedora Workstation 31
What's the output of
bazel info release
?Have you found anything relevant by searching the web?
No, but this issue is a bit ambiguous to search for. Please feel free to dupe if this is already known.
The text was updated successfully, but these errors were encountered: