Skip to content

Commit

Permalink
fix: pass visibility attribute for gazelle macro to resulting `sh…
Browse files Browse the repository at this point in the history
…_binary` (bazelbuild#1340)
  • Loading branch information
cgrindel committed Oct 6, 2022
1 parent d201190 commit fe1935f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def gazelle(name, **kwargs):
kwargs["extra_args"] = kwargs["args"]
kwargs.pop("args")

visibility = kwargs.pop("visibility", default = None)

tags_set = {t: "" for t in kwargs.pop("tags", [])}
tags_set["manual"] = ""
tags = [k for k in tags_set.keys()]
Expand All @@ -149,4 +151,5 @@ def gazelle(name, **kwargs):
name = name,
srcs = [runner_name],
tags = tags,
visibility = visibility,
)
6 changes: 6 additions & 0 deletions tests/visibility_attr/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("//:def.bzl", "gazelle")

gazelle(
name = "gazelle",
visibility = ["//tests/visibility_attr:__subpackages__"],
)
6 changes: 6 additions & 0 deletions tests/visibility_attr/child/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")

build_test(
name = "visibility_test",
targets = ["//tests/visibility_attr:gazelle"],
)

0 comments on commit fe1935f

Please sign in to comment.