Skip to content

Add shared framework for Swift SDK cross-compilation toolchains - #1821

Merged
keith merged 1 commit into
bazelbuild:mainfrom
AttilaTheFun:swift-sdk-framework
Jun 24, 2026
Merged

Add shared framework for Swift SDK cross-compilation toolchains#1821
keith merged 1 commit into
bazelbuild:mainfrom
AttilaTheFun:swift-sdk-framework

Conversation

@AttilaTheFun

Copy link
Copy Markdown
Contributor

Second foundation PR from the #1809 split (see #1820 for the linkshared half).
This adds the platform-agnostic machinery the per-platform Swift SDK PRs build
on:

main ─┬─ #1820 linkshared
      └─ Swift SDK framework (this PR)
            ├─ WebAssembly
            ├─ Android
            └─ Windows host

What this adds

The shared building blocks for downloading a swift.org "Swift SDK" artifact
bundle and turning it into Bazel toolchains:

  • swift_toolchain gains linkopts / linker_inputs attributes (and
    _swift_sdk_linkopts_cc_info) so a toolchain can link against a Swift runtime
    provided by an SDK rather than the host toolchain.
  • swift_sdks.bzl: helpers and BUILD-file templates a Swift SDK repository
    rule uses (bundle download, cc_tool / cc_toolchain / swift_toolchain
    templates).
  • toolchains.bzl: the _SDK_TOOLCHAIN_PLATFORM template and a shared
    exec-constraint helper for generating toolchain() declarations.
  • swift_sdk_releases.bzl: the SDK download-URL helper and the (initially
    empty) SWIFT_SDK_RELEASES checksum registry the platform extensions
    populate.

These are deliberately a foundation: they're exercised end-to-end by the stacked
platform PRs (WebAssembly / Android / Windows). A unit test covers
swift_sdk_download_url in //test:utils.

@keith keith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, small thing

Comment thread swift/toolchains/swift_toolchain.bzl
Foundation for the per-platform Swift SDK extensions (wasm_sdk, android_sdk,
landing as follow-ups). Platform-agnostic building blocks:

- swift_toolchain gains linkopts / linker_inputs attributes (and
  _swift_sdk_linkopts_cc_info) so a toolchain can link against a Swift runtime
  provided by an SDK rather than the host toolchain.
- swift_sdks.bzl: helpers and BUILD-file templates a Swift SDK repository rule
  uses (bundle download, cc_tool / cc_toolchain / swift_toolchain templates).
- toolchains.bzl: the _SDK_TOOLCHAIN_PLATFORM template and a shared
  exec-constraint helper for generating toolchain() declarations.
- swift_sdk_releases.bzl: the SDK download-URL helper and the (initially empty)
  SWIFT_SDK_RELEASES checksum registry the platform extensions populate.

These are exercised end-to-end by the stacked platform PRs; a unit test covers
swift_sdk_download_url here.
@AttilaTheFun
AttilaTheFun force-pushed the swift-sdk-framework branch from 086c902 to 463a9a4 Compare June 23, 2026 23:42
@keith
keith enabled auto-merge (squash) June 23, 2026 23:52
@keith
keith merged commit 2687dc0 into bazelbuild:main Jun 24, 2026
14 checks passed
@AttilaTheFun
AttilaTheFun deleted the swift-sdk-framework branch June 24, 2026 00:13
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