How to prevent Bazel from scanning certain directories?

1,657 views
Skip to first unread message

Alpha Lam

unread,
Oct 20, 2015, 11:34:06 PM10/20/15
to bazel-discuss
Hi,

I have a workspace that has a few directories that I would like to hide from Bazel.

For example I have a .universe symlink in the workspace that is pointing to a FUSE mount to a large amount of files. I don't want Bazel to scan through it. Is there an option I can do this?

I tried:

bazel query //... -.universe

and 

bazel query --deleted_packages .universe //...

but none of these works. Any ideas how I can do this? Thanks.

Alpha

Austin Schuh

unread,
Oct 20, 2015, 11:38:44 PM10/20/15
to Alpha Lam, bazel-discuss
Try

bazel query //... -- -.universe

--
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/CABJijUq3Deo2QdMea6s06MybgUOdny--p-XNg_xt1BvDLYyMKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Alpha Lam

unread,
Oct 21, 2015, 11:07:11 AM10/21/15
to Austin Schuh, bazel-discuss
It gives something like this:

/bazel query //... -- -.universe -ext -fout
ERROR: Bad target pattern '.universe': package names may contain only A-Z, a-z, 0-9, '/', '-' and '_'.

Kristina Chodorow

unread,
Oct 21, 2015, 11:24:51 AM10/21/15
to Alpha Lam, Austin Schuh, bazel-discuss
Dots were actually added to the allowed set a couple of days ago: https://github.com/bazelbuild/bazel/commit/c1caffaabd028493188b7e3419bedf3a9506dfee

They aren't in a release yet, but you could build bazel from source to get the change (bazel build //src:bazel).

alpha....@gmail.com

unread,
Oct 22, 2015, 6:57:45 PM10/22/15
to bazel-discuss, alpha....@gmail.com, austin...@gmail.com
Thanks Kristina,

I have synced and rebuilt Bazel but it still tries to peek into the directories I told it not to:

$ time bazel query //... -- -.universe -.base_universe -fout
INFO: Waiting for response from Bazel server (pid 7831)...
INFO: Loading package: .universe/x86-64/ext/public/google/bazel/dist/base_workspace/tools

Is there something wrong I'm doing? Thanks.

Alpha

Alpha Lam

unread,
Oct 25, 2015, 1:07:00 AM10/25/15
to Kristina Chodorow, Austin Schuh, bazel-discuss
After some testing it seems like whenever //... is used Bazel always scan all the directories under the target. Exclusion is done after the scan.

For example:
bazel build --deleted_packages=ext //...

or bazel build //... -- -ext

will always scan into ext. And exclude the targets after scanning.

Is there an option to avoid scanning a directory at all? Thanks.

Alpha

Tom Ball

unread,
Oct 25, 2015, 1:31:34 AM10/25/15
to Alpha Lam, Kristina Chodorow, Austin Schuh, bazel-discuss
One way is to put a BUILD file in that sub-directory. If nothing else, it's a good place to put a comment explaining why its files aren't part of the overall build.

Reply all
Reply to author
Forward
0 new messages