Skip to content

Conversation

@LeFrosch
Copy link
Collaborator

The previous target (@bazel_tools//tools/osx:current_xcode_config) which we used in the cquery no longer exists in Bazel 9. However, the actual target which provides the version (@bazel_tools//tools/cpp:host_xcodes) exists in Bazel 9 and all currently supported versions (6-7).

@LeFrosch
Copy link
Collaborator Author

Preparation for: #8004

@LeFrosch LeFrosch marked this pull request as ready for review November 22, 2025 11:01
@github-actions github-actions bot added product: CLion CLion plugin awaiting-review Awaiting review from Bazel team on PRs labels Nov 22, 2025
"#!/bin/bash",
"__BAZEL_BIN__ cquery \\",
" 'deps(\"@bazel_tools//tools/osx:current_xcode_config\")' \\",
" 'deps(\"@bazel_tools//tools/cpp:host_xcodes\")' \\",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure, but I have a feeling that item on the left has current config, while rhs lists all
https://bazel.build/reference/command-line-reference#flag--xcode_version_config

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So apparently host_xcodes is the default value for --xcode_version_config: https://github.com/bazelbuild/bazel/blob/f57b39513a30d0ebd46e8888b2445313b3198de1/tools/cpp/BUILD.tools#L125-L128

Where as current_xcode_config was the current value of --xcode_version_config: https://github.com/bazelbuild/bazel/blob/3b1ed466d08107049dc1d232f43a7018997a2505/src/main/starlark/builtins_bzl/common/xcode/xcode_config_alias.bzl

But this rule has been removed in bazelbuild/bazel@873b036 and is no longer in the builtins. Idk where it moved to.

As shown in the new aspect, it is possible to move the xcode version collection to the aspect finally. I could port this code and we could use this for Bazel 8+.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need some short term solution here as bazel 9 release is kinda close and full migration to the new aspect is a bit risky? Or is it ok for us to depend on aspect change here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though I'm a bit puzzled about the real need in this code. We have it to set DEVELOPER_DIR and SDKROOT for compiler script, but we never had such a need in CMake support. Is it so that we rely on default xcode selection, while bazel can override it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this code is incorrectly placed, this has to be somewhat related closer to toolchain info rather than just "random" Xcode-related target query.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree. By porting I meant only taking the code I wrote for xcode info collection and adding it to the old aspect. If this is possible.

@LeFrosch LeFrosch changed the title Prepartation for Bazel 9: get xcode version from @bazel_tools//tools/cpp:host_xcodes @LeFrosch Prepartation for Bazel 9: get xcode version from @bazel_tools//tools/cpp:host_xcodes Nov 24, 2025
@LeFrosch
Copy link
Collaborator Author

As agreed, we'll proceed as follows. Only use the @bazel_tools//tools/cpp:host_xcodes for Bazel 9+ and keep the previous logic for older Bazel versions. While host_xcodes only provides the default it should be fine for most cases.

With the new aspect we'll receive the correct xcode version from the aspect and can deprecate this entire cquery setup.

@LeFrosch LeFrosch force-pushed the pull/61eeff0599c76063f1820e2de003fe063f00e41b branch from 086f413 to 28acd21 Compare November 25, 2025 21:14
@LeFrosch LeFrosch merged commit 52f2c0c into bazelbuild:master Nov 26, 2025
3 checks passed
@LeFrosch LeFrosch deleted the pull/61eeff0599c76063f1820e2de003fe063f00e41b branch November 26, 2025 06:56
@github-project-automation github-project-automation bot moved this from Untriaged to Done in Bazel IntelliJ Plugin Nov 26, 2025
@github-actions github-actions bot removed the awaiting-review Awaiting review from Bazel team on PRs label Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: CLion CLion plugin

Projects

Development

Successfully merging this pull request may close these issues.

2 participants