I want to execute bazel query //...
but I have many .cache
folders in my repo and they may contain BUILD files in their subfolders that may cause bazel errors. I want bazel to exclude all BUILD files that matches the glob pattern **/.cache/**/BUILD
. What should I do?
In the documentation, I find that filter
can be used for filtering basing on the name of the target, but that is after parsing BUILD files which cannot prevent errors.
Minimal setup:
.
├── .cache
│ └── BUILD # garbage file
└── BUILD # normal file
Running bazel query //...
gives errors as the BUILD file in .cache
is invalid.