tool(tool="//some:target") doesn't declare a dependency on the target #17401
Labels
P3
We're not considering working on this, but happy to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-Rules-CPP
Issues for C++ rules
type: bug
Description of the bug:
The
tool
macro provided bycc_toolchain_config_lib.bzl
claims the following in its arguments:My understanding after reading this is that using
tool="//some:target"
should cause the given target to be built as a dependency of the tool -- but this does not seem to be the case. Even if the provided target exists and can be built correctly when given explicitly tobazel build
, the target won't be picked up as a dependency of the tool.The reason I'm trying to do this is because I need to write a wrapper script for the linker (because of #17368) and I wanted to use a
genrule
to auto-generate the script based on certain string replacements. Unfortunately, I've found no way to do this, and I had to end up checking in the "auto-generated" script and using that instead. This is a problem because now I have to remember to maintain this checked-in script, and I had to add logic to our toolchain definitions to attempt to spot stale files.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
genrule
that creates a shell script.tool
, using the macro from@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl
, that depends on thegenrule
via thetool
attribute.tool
and notice how the dependency is never built.Which operating system are you running Bazel on?
Linux, but this is irrelevant
What is the output of
bazel info release
?bazel release 6.0.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: