-
-
Notifications
You must be signed in to change notification settings - Fork 259
Open
Description
I created my own sysroot repository rule, and it was producing a warning like below:
(15:35:50) WARNING: /workspaces/xxx/BUILD.bazel:3:8: input 'sysroot' of //xxx/tests:hello_test is a directory; dependency checking of directories is unsound
I then took the exact code from toolchains_llvm's sysroot.bzl on main to make sure I wasn't missing anything and declared the same sysroot from toolchain_llvm's tests/MODULE.bazel:
sysroot_llvm = use_repo_rule("//build-support/sysroot:sysroot.bzl", "sysroot")
# This sysroot is used by github.com/vsco/bazel-toolchains.
sysroot_llvm(
name = "org_chromium_sysroot_linux_x64",
sha256 = "84656a6df544ecef62169cfe3ab6e41bb4346a62d3ba2a045dc5a0a2ecea94a3",
urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/2202c161310ffde63729f29d27fe7bb24a0bc540/debian_stretch_amd64_sysroot.tar.xz"],
)
and confirmed that this generates the same warning, so it's not my custom code.
It appears linked to this code fragment, which they both share:
# Source directories are more efficient than file groups for 2 reasons:
# - They can be symlinked into a local sandbox with a single symlink instead of 1-per-file
# - They serve as a signal to the Merkle tree cache machinery since they can be memoized as a single node.
# Since sysroots are usually a ton of files, it can improve build performance to declare them as source directories.
# Also, create the BUILD file before extracting because `bsdtar` expects the target
# directory to exist, and this way Bazel creates it for us without needing `mkdir`.
rctx.file(
"sysroot/BUILD.bazel",
"""filegroup(
name = "sysroot",
srcs = ["."],
visibility = ["//visibility:public"],
)""",
)
Bazel version: 8.4.2.
Workaround: aspect-build/rules_js#1408 (comment).
Metadata
Metadata
Assignees
Labels
No labels