Skip to content

Add support to custom toolchains #3137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

0xLucasMarcal
Copy link
Contributor

@0xLucasMarcal 0xLucasMarcal commented Mar 8, 2025

Changes

This PR adds support for custom toolchains in rules_xcodeproj by replacing hardcoded references to $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain with the more flexible $TOOLCHAIN_DIR environment variable. This enhancement enables developers to use alternative toolchains with Xcode projects generated by rules_xcodeproj.

Key modifications include:

  • Updated script references in generated Xcode schemes to check for $TOOLCHAIN_DIR and use it when available
  • Modified toolchain path resolution in swiftc_stub to prioritize $TOOLCHAIN_DIR when set
  • Updated system lib symlink creation for sanitizer support to use the custom toolchain's libraries
  • Updated clang.sh and ld to respect custom toolchain configuration
  • Updated test fixtures to reflect the new scheme generation approach
  • For backward compatibility, the original Xcode default toolchain paths are maintained as a fallback when $TOOLCHAIN_DIR is not set, ensuring existing projects continue to work as expected.

Benefits

  • Allows projects to use custom Xcode toolchains
  • Enables sanitizer instrumentation with custom toolchains
  • Provides a more flexible development experience with rules_xcodeproj

Testing

All test fixtures have been updated and verified to work with both default and custom toolchains.

@0xLucasMarcal 0xLucasMarcal force-pushed the lucas/support-custom-xcode-toolchain branch from 8315640 to 037a8cf Compare March 11, 2025 19:01
@0xLucasMarcal 0xLucasMarcal marked this pull request as ready for review March 11, 2025 22:30
@0xLucasMarcal 0xLucasMarcal requested a review from a team as a code owner March 11, 2025 22:30
@0xLucasMarcal 0xLucasMarcal force-pushed the lucas/support-custom-xcode-toolchain branch from be4ba4b to 9c8774f Compare March 13, 2025 00:20
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.

1 participant