Open jsun-splunk opened 4 months ago
Hey, although the problem is coming from C++ rules, this seems to involve 2 other teams. Configurability team because of queries and toolchains, and OSS team because of repositories.
@jsun-splunk It'll be very helpful if you can provide a reproducible case.
Description of the feature request:
It would be useful to have the ability to query what repository rules are depending on when registering a toolchain. See the example scenario in the next section.
Which category does this issue belong to?
C++ Rules
What underlying problem are you trying to solve with this feature?
Consider the following scenario:
I have 2 repository rules to declare my cpp hermetic toolchain on macos.
repo_rule_1()
declares a toolchain configuration with the following rules:CcToolchainConfigInfo
@rules_cc//cc:defs.bzl
the
tool_paths
in CcToolchainConfigInfopoints files under a relative ./bin directory in the same package. the ./bin directory is symlinked in
repo_rule_1()to the real bin directory under a second, different repository. Let's call this second one
repo_rule_2()`.repo_rule_2()
is where all the actual toolchain binaries are. e.g. libtool, clang, etc. With filegroups() pointing to required tools/files.the toolchain works when I run it on macos. However, when running the toolchain on windows or linux, it downloads both repositories (
repo_rule_1()
andrepo_rule_2()
) before toolchain resolution even happens. The expectation is that it should only download the repo defined inrepo_rule_1()
, perform toolchain resolution and if it resolves to the toolchain config inrepo_rule_1()
then download the repo defined inrepo_rule_2()
. Otherwise, the second repo should never get downloaded.Currently, I have not been able to figure out a way to troubleshoot what is dependent on
repo_rule_2()
that cause it to be downloaded. None of the query/cquery I have tried seems to be able to tell me this information. The cquery results only tell me the dependency on the final toolchain after toolchain resolution.I don't understand enough about bazel internally to know how such a query would work or if it's even possible. But without being about to do this, it is like finding a needle in a haystack to resolve this.
Looking for ideas and suggestions.
Which operating system are you running Bazel on?
macos, linux, windows
What is the output of
bazel info release
?release 7.1.2
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 HEAD
?No response
Have you found anything relevant by searching the web?
No
Any other information, logs, or outputs that you want to share?
No response