Skip to content

Conversation

ma-oli
Copy link

@ma-oli ma-oli commented Aug 26, 2025

In the exceptional case where the user has multiple versions of Xcode on his system with the same Xcode version, we want to make sure that Xcode is invoking bazel by referring to itself.

As bazel supports passing DEVELOPER_DIR to --xcode_version, we're using that variable when invoked through Xcode instead.

In the exceptional case where the user has multiple versions of Xcode on
his system with the same Xcode version, we want to make sure that Xcode
is invoking bazel by referring to itself.

As bazel supports passing DEVELOPER_DIR to --xcode_version, we're using
that variable when invoked through Xcode instead.
@ma-oli ma-oli requested a review from a team as a code owner August 26, 2025 21:26
@@ -79,7 +79,7 @@ readonly bazel_cmd

readonly base_pre_config_flags=(
# Be explicit about our desired Xcode version
"--xcode_version=$XCODE_PRODUCT_BUILD_VERSION"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is using $DEVELOPER_DIR a new capability for Bazel? I don't recall this working before.

Since DEVELOPER_DIR could just be /Applications/Xcode.app/Contents/Developer, I believe this has the issue of Bazel caching which version this resolves to, so if the Xcode installed at that spot changes, Bazel still thinks it's compiling with a different version.

Also, --xcode_version= impacts analysis, and this will result in a cache miss from the version used in xcodeproj/internal/templates/runner.sh.

Copy link
Author

Choose a reason for hiding this comment

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

I think it came with that change: bazelbuild/bazel@d2e8c82

Copy link
Author

Choose a reason for hiding this comment

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

But yes; I agree with your comment about bazel not noticing Xcode changing. That could be a problem for the general case actually 🤔 let me think about it. I wish there was a way to override it somehow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants