target_name_glob
def target_name_glob(
name_globs: list[str] | tuple[str, ...],
/,
*,
within: list[str] | tuple[str, ...] = [],
) -> target_name_glob
Creates a target-name glob pattern used inside visibility / within_view attribute lists.
name_globs is a non-empty list of glob patterns (* is the only
wildcard) that match against target names. A target matches the
target_name_glob if any glob in the list matches its name. A glob
consisting solely of * is rejected — use "PUBLIC" for unrestricted
visibility instead.
The optional within parameter is a list of package or recursive
package patterns (e.g. ["//pkg:", "//other/..."]) that scope the
match: a target matches only if its package falls inside any of the
within scopes. If omitted or empty, the globs match targets in any
package.
Each within pattern is parsed when the enclosing target's visibility
/ within_view attribute is coerced, using the cell aliases of the file
that target is defined in. "PUBLIC" is not a valid within scope (it is
a target name, not a package); omit within to match any package.
Example usage:
visibility = [
target_name_glob(["*-deprecated"]),
target_name_glob(["*-test", "*-bench"], within = ["//pkg/..."]),
]