Repository navigation
Add optional sysroot and env to swift.toolchain - #1993
Open
TrapsterDK wants to merge 5 commits into
Open
TrapsterDK wants to merge 5 commits into
TrapsterDK wants to merge 5 commits into
Conversation
TrapsterDK
requested review from
aaronsky,
adincebic,
brentleyjones,
keith and
luispadron
as code owners
November 4, 2026 22:12
TrapsterDK
force-pushed
the
standalone-toolchain-sysroot
branch
from
November 5, 2026 11:07
8a3a373 to
44c5077
Compare
This was referenced Nov 5, 2026
TrapsterDK
added a commit
to devhusdk/rules_dx
that referenced
this pull request
Nov 9, 2026
…loses #5714) (#9375) Carry bazelbuild/rules_swift#1993 (sysroot/env on swift.toolchain) and #1996 (non-root swift.toolchain) as patches on rules_swift 4.2.2, ship them through the dx init override table, and declare the Linux Swift toolchain with the public swift.toolchain tag. swift/toolchain keeps only the link-libs wrapper and the toolchain registration; the local archive download, pins.bzl and the hand-built swift_toolchain go away. Claude-Session: https://claude.ai/code/session_01Xut2hwESun1HL2eSVd1d5B Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
TrapsterDK
force-pushed
the
standalone-toolchain-sysroot
branch
from
November 11, 2026 23:06
055fb39 to
ed854a0
Compare
Part of bazelbuild#1991. Assisted by Claude.
`sysroot` maps each platform to the sysroot files for its exec Swift
toolchain. `env` sets environment variables for it, with `{sysroot}`
replaced by that platform's sysroot root. Unset, nothing changes.
rules_swift's own dev toolchain now sets `sysroot`, and a new argv test
checks that `-sdk` follows it rather than the C++ toolchain's sysroot.
The fixture referenced an apt sysroot repo, which can't be fetched on macOS hosts.
TrapsterDK
force-pushed
the
standalone-toolchain-sysroot
branch
from
November 16, 2026 23:44
ed854a0 to
b275fb1
Compare
Resolve the conflict in test/swift_toolchain_tests.bzl by keeping both the Windows sdkroot test rule from main and the Linux sysroot test rule. Assisted-by: Claude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two optional attributes to the
swift.toolchaintag:sysroot: a map of platform -> label of sysroot files, e.g.{"ubuntu22.04": "@my_sysroot_amd64//:files"}. That platform's exec Swift toolchain passes the label's repo root as-sdkand adds the files to the inputs of its Swift tools. A platform the toolchain doesn't download fails.env: environment variables for the exec Swift toolchain.{sysroot}in a value is replaced with that platform's sysroot root, so one tag can set e.g.LD_LIBRARY_PATHper platform. Using{sysroot}without a sysroot fails.With both unset, nothing changes:
sdkrootis empty,envis{}, and-sdkstill comes from the C++ toolchain's sysroot. The embedded toolchains are unchanged.Tests:
swift.toolchainnow setssysrootto its existingswift_ubuntu22.04_{amd64,arm64}_sysroot, which is the same sysroot the C++ toolchain uses, so the existing tests are unaffected.//test:swift_toolchain_linux_sdk_from_swift_sysrootpoints//swift/toolchains:linux_sysroot_featureat a local fixture directory and expects-sdkto still be the amd64 sysroot. Withoutsysrooton the tag it fails with-sdk test/fixtures/toolchains.test/utils_tests.bzlcovers the{sysroot}substitution inenv.bazel test //test:swift_toolchain //test:utilspasses, and buildifier is clean.Part of #1991. Non-root use is in #1996.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TGY1iq223a2QbjAKgmPghQ