Skip to content

Commit

Permalink
Mark nogo targets as manual to keep top-level symlinks (#3410)
Browse files Browse the repository at this point in the history
With --use_top_level_targets_for_symlinks, which is enabled by default
in Bazel 6.0.0, self-transitioning top-level targets prevent the
bazel-bin convenience symlink from being created. Since nogo targets are
of this type, their presence would trigger this behavior. Work around
this by excluding them from wildcards - they are still transitively
built as a tool dependency of every Go target.
  • Loading branch information
fmeum authored Dec 20, 2022
1 parent 8d309d5 commit de2074e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/private/rules/nogo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ def nogo(name, visibility = None, **kwargs):
visibility = visibility,
)

# With --use_top_level_targets_for_symlinks, which is enabled by default in
# Bazel 6.0.0, self-transitioning top-level targets prevent the bazel-bin
# convenience symlink from being created. Since nogo targets are of this
# type, their presence would trigger this behavior. Work around this by
# excluding them from wildcards - they are still transitively built as a
# tool dependency of every Go target.
kwargs.setdefault("tags", [])
if "manual" not in kwargs["tags"]:
kwargs["tags"].append("manual")

_nogo(
name = actual_name,
visibility = visibility,
Expand Down

0 comments on commit de2074e

Please sign in to comment.