Skip to content

Support embedded Swift#116

Merged
ekinnear merged 14 commits into
apple:mainfrom
guoye-zhang:embedded
Jun 5, 2026
Merged

Support embedded Swift#116
ekinnear merged 14 commits into
apple:mainfrom
guoye-zhang:embedded

Conversation

@guoye-zhang

@guoye-zhang guoye-zhang commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

In order for swift-http-api-proposal to support embedded Swift, swift-http-types has to support embedded Swift first.

@guoye-zhang guoye-zhang added the 🆕 semver/minor Adds new public API. label Apr 8, 2026
public func withUnsafeBytesOfValue<Result>(
_ body: (UnsafeBufferPointer<UInt8>) throws -> Result
) rethrows -> Result {
public func withUnsafeBytesOfValue<Result, Failure: Error>(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this API breakage real?

@MaxDesiatov MaxDesiatov Apr 10, 2026

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.

IIUC this is not source-breaking, but very likely ABI-breaking.

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.

Correct. This is considered fine.

Comment thread Sources/HTTPTypes/HTTPFields.swift

@MaxDesiatov MaxDesiatov 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.

It would be great for this PR or imminent followup PRs to also add Wasm (both embedded and non-embedded) jobs on CI to ensure no regressions are introduced in the future.

Comment thread .github/workflows/pull_request.yml Outdated
name: WebAssembly Swift SDK
uses: apple/swift-nio/.github/workflows/wasm_swift_sdk.yml@main
with:
additional_command_arguments: "--target HTTPTypes"

@MaxDesiatov MaxDesiatov Apr 13, 2026

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.

Would you mind using this one instead? Otherwise we'll have replicate Embedded Swift builds in swift-nio workflows.

  embedded-swift:
    name: Build with Embedded Swift
    uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.9
    with:
      enable_linux_checks: false
      enable_macos_checks: false
      enable_windows_checks: false
      enable_wasm_sdk_build: false
      enable_embedded_wasm_sdk_build: true
      swift_flags: --target HTTPTypes

Comment thread Sources/HTTPTypes/HTTPFields.swift Outdated
fatalError()
}
#else
#if !hasFeature(Embedded) || os(WASI)

@MaxDesiatov MaxDesiatov Apr 15, 2026

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.

Seems like Mutex is only available on WASI in main snapshots, but not 6.3 or 6.2:

Suggested change
#if !hasFeature(Embedded) || os(WASI)
#if !hasFeature(Embedded) || (os(WASI) && compiler(>=6.4))

@MaxDesiatov MaxDesiatov 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.

Thank you!

@ekinnear
ekinnear merged commit db774a2 into apple:main Jun 5, 2026
68 of 69 checks passed
@guoye-zhang
guoye-zhang deleted the embedded branch June 5, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants