Skip to content

Support embedded Swift#116

Open
guoye-zhang wants to merge 10 commits into
apple:mainfrom
guoye-zhang:embedded
Open

Support embedded Swift#116
guoye-zhang wants to merge 10 commits into
apple:mainfrom
guoye-zhang:embedded

Conversation

@guoye-zhang
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.

Is there a CI we can enable for embedded?

@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?

Copy link
Copy Markdown
Member

@MaxDesiatov MaxDesiatov Apr 10, 2026

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
Copy link
Copy Markdown
Member

@MaxDesiatov MaxDesiatov left a comment

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"
Copy link
Copy Markdown
Member

@MaxDesiatov MaxDesiatov Apr 13, 2026

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)
Copy link
Copy Markdown
Member

@MaxDesiatov MaxDesiatov Apr 15, 2026

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))

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.

3 participants