Absolute patterns in globs

226 views
Skip to first unread message

DC

unread,
Jun 4, 2023, 1:58:52 PM6/4/23
to bazel-discuss
Hi,

I would like to define a glob within a target's visibility:
foo(
name = "foo",
package_name = "foo",
srcs = glob(["**"]),
visibility = glob(["//**/bar"]),
)

This results in an error: "Error in glob: pattern cannot be absolute".

How can I achieve this intended result if absolute patterns are not supported?

Thanks


Jiawen Chen

unread,
Jun 5, 2023, 2:36:26 PM6/5/23
to DC, bazel-discuss
Does visibility = [“//dst:__subpackages__”] not suffice? Is that or public visibility too broad?

Bazel tends to not like globs. Instead you can define a package group with a specific list of approved users. Those users can request to be added on a case by case basis, which works great in my experience.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/3526626c-eb90-41a2-9caf-210eab42eb24n%40googlegroups.com.

DC

unread,
Jun 7, 2023, 1:51:54 PM6/7/23
to bazel-discuss
Thanks, public visibility is too broad, I would like it to be available to "//**/bar" paths so I can restrict PR reviews to these paths via codeowners.

I prefer not to add a hardcoded list of users as it's inconvenient for the users and not scalable.

Reply all
Reply to author
Forward
0 new messages