rules_xcodeproj
rules_xcodeproj copied to clipboard
Add support to custom toolchains
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_DIRand use it when available - Modified toolchain path resolution in swiftc_stub to prioritize
$TOOLCHAIN_DIRwhen 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_DIRis 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.