I found it in this build:
$DIR/m/WORKSPACE:
local_repository(name="a", path="$DIR/a")
local_repository(name="b", path="$DIR/b")
$DIR/a/BUILD:
SYNTAX ERROR
genrule(
name = "gen",
srcs = [
"a1.cc",
"a2.cc",
],
outs = ["a.cc"],
cmd = "cat $(SRCS) > $@",
)
$DIR/a/WORKSPACE: (empty)
$DIR/b/WORKSPACE(empty)
$DIR/b/BUILD:
cc_library(
name = "b",
srcs = ["@a//:a.cc"],
)
Then:
bazel query @a//:all
# Remove SYNTAX ERROR from a/BUILD
bazel query @a//:all
The second query invocation will not notice that a/BUILD changed.