Skip to content
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

Add proper support for custom Swift toolchains #1025

Merged
merged 4 commits into from
Mar 22, 2023

Conversation

keith
Copy link
Member

@keith keith commented Mar 21, 2023

Previously we did some amount of handling if you passed a custom
toolchain identifier. This didn't handle the case that the toolchain
required new compatibility libraries to actually link your binary. To
handle this we have to pass a new -L to the path in the root of the
toolchain. We do this with a custom env var that we replace, similar to
the DEVELOPER_DIR variable. Ideally this would be cached in memory, but
we can't do that without editing bazel, luckily xcrun has a cache that
makes this likely fast enough (about 0.01s for a cached invocation).

keith added a commit to bazelbuild/apple_support that referenced this pull request Mar 21, 2023
This adds support for replacing the
__BAZEL_CUSTOM_XCODE_TOOLCHAIN_PATH__ argument with the absolute path to
the custom toolchain defined by the TOOLCHAINS environment variable
(passed with --action_env). This allows us to fully support custom Swift
toolchains and linking their libraries

bazelbuild/rules_swift#1025
@keith
Copy link
Member Author

keith commented Mar 21, 2023

Previously we did some amount of handling if you passed a custom
toolchain identifier. This didn't handle the case that the toolchain
required new compatibility libraries to actually link your binary. To
handle this we have to pass a new -L to the path in the root of the
toolchain. We do this with a custom env var that we replace, similar to
the DEVELOPER_DIR variable. Ideally this would be cached in memory, but
we can't do that without editing bazel, luckily xcrun has a cache that
makes this likely fast enough (about 0.01s for a cached invocation).
@keith keith force-pushed the ks/add-proper-support-for-custom-swift-toolchains branch from 881bbe2 to b301b5c Compare March 21, 2023 23:53
@keith keith marked this pull request as ready for review March 22, 2023 19:07
@keith keith merged commit b9a4991 into master Mar 22, 2023
@keith keith deleted the ks/add-proper-support-for-custom-swift-toolchains branch March 22, 2023 19:08
keith added a commit to bazelbuild/apple_support that referenced this pull request Mar 22, 2023
This adds support for replacing the
`__BAZEL_CUSTOM_XCODE_TOOLCHAIN_PATH__` argument with the absolute path
to
the custom toolchain defined by the TOOLCHAINS environment variable
(passed with --action_env). This allows us to fully support custom Swift
toolchains and linking their libraries

bazelbuild/rules_swift#1025
tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this pull request Jul 19, 2023
Previously we did some amount of handling if you passed a custom
toolchain identifier. This didn't handle the case that the toolchain
required new compatibility libraries to actually link your binary. To
handle this we have to pass a new -L to the path in the root of the
toolchain. We do this with a custom env var that we replace, similar to
the DEVELOPER_DIR variable. Ideally this would be cached in memory, but
we can't do that without editing bazel, luckily xcrun has a cache that
makes this likely fast enough (about 0.01s for a cached invocation).
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.

None yet

2 participants