Make Xcode version accessible to aspects #17871
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: feature request
Description of the feature request:
For reasons outlined in the following sections, I want to fetch the Xcode version from an aspect. In normal build-land, a
cc_*
target would get the xcode version via the cc toolchain:I have gotten the aspect to propagate up to the right target via the
_xcode_config
attribute, but I can't get it to pass the relevant information down.This is the aspect: https://gist.github.com/blorente/95f74405142d5a2364909950e505e79d
And the output of running it on roughly any
cc_*
target: https://gist.github.com/blorente/296e5fd4bb9eec22299eaa0204dc13f3As far as I can see, the fundamental pain point here is that the
toolchains
attribute ofcc_toolchain_suite
is aLABEL_DICT_UNARY
, according to Bazel source code. This is not one of the "dependency attributes", according to Bazel docs. And so I can't really get the deps outputs from@local_config_cc//:toolchain
to pass downstream (see this comment).Therefore, I'd like a way to figure out which version of Xcode a particular cc toolchain is using from an aspect.
What underlying problem are you trying to solve with this feature?
I'm working on the CLion plugin. It uses an aspect to gather build configuration for each target, as well as about the toolchains configured (e.g. the
CcToolchainInfo
), which is then passed to the plugin to translate into the IDE's model of the world.One such information we need is the CC compiler. Via
CcToolchainInfo
we're able to get the clang wrapper script, which we can pass to CLion as "the compiler to use to implement your smarts". This is correct behavior. However, that script has a baked-in assumption that it'll haveDEVELOPER_DIR
andSDKROOT
set.In Bazel, those are set roughly by querying
@local_config_xcode//:host_xcodes
(or equivalent) to get the xcode version, and then runningxcode-locator -v <that version>
to get the rightDEVELOPER_DIR
.I want to replicate that behaviour in the compiler we give to CLion.
Which operating system are you running Bazel on?
macOS, arm
What is the output of
bazel info release
?Tested with 6.0.0 and 5.4.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?
I have googled and searched the GitHub issues, to no avail. Asked in the upstream slack with no success.
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: