Simple repro here: repro.zip
# Building in a folder is fine
~/Documents/skylib$ bazel build //nested:root_folder
INFO: Analyzed target //nested:root_folder (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //nested:root_folder up-to-date (nothing to build)
INFO: Elapsed time: 0.111s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
# Building an identical target in the root folder fails
~/Documents/skylib$ bazel build //:root_folder
ERROR: /home/alex/Documents/skylib/BUILD.bazel:3:10: in directory rule //:root_folder:
Traceback (most recent call last):
File "/home/alex/.cache/bazel/_bazel_alex/5d972a82134322fe6f7f87cad8a4f41a/external/bazel_skylib+/rules/directory/directory.bzl", line 71, column 31, in _directory_impl
prefix = _prefix_match(src, prefixes)
File "/home/alex/.cache/bazel/_bazel_alex/5d972a82134322fe6f7f87cad8a4f41a/external/bazel_skylib+/rules/directory/directory.bzl", line 24, column 9, in _prefix_match
fail("Expected {path} to start with one of {prefixes}".format(path = f.path, prefixes = list(prefixes)))
Error in fail: Expected root/file to start with one of ["/", "bazel-out/k8-fastbuild/bin/"]
ERROR: /home/alex/Documents/skylib/BUILD.bazel:3:10: Analysis of target '//:root_folder' (config: 91e2498) failed
ERROR: Analysis of target '//:root_folder' failed; build aborted
INFO: Elapsed time: 0.059s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
The validation here seems to be making some incorrect assumptions.
Simple repro here: repro.zip
The validation here seems to be making some incorrect assumptions.