Skip to content

Use xcodebuild for Swift XCFramework assembly - #666

Merged
i386 merged 4 commits into
mainfrom
fix/swift-xcframework-native-library
May 24, 2026
Merged

Use xcodebuild for Swift XCFramework assembly#666
i386 merged 4 commits into
mainfrom
fix/swift-xcframework-native-library

Conversation

@i386

@i386 i386 commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #665. The Swift SDK packaging scripts now let xcodebuild -create-xcframework write the XCFramework structure instead of carrying a shell fallback that hand-writes Info.plist and library metadata.

This PR depends on #665's inner framework-bundle layout fix: xcodebuild -create-xcframework wraps the input frameworks, but it does not validate or repair a flat macOS .framework. Flat-in would still be flat-out. The release verifier now checks that every macOS slice has the required Versions/A layout and canonical symlinks before it runs a consumer smoke.

The scripts still wrap the Rust static archive in framework bundles before calling xcodebuild, because the SDK needs PrivacyInfo.xcprivacy to live in each framework slice. The docs now call out why the tempting -library -headers path is not enough unless another App Store-visible SDK target carries the privacy manifest.

This also hardens the release path:

  • tracks the generated Swift UniFFI source needed by tagged SwiftPM consumers
  • declares required-reason API categories for native file metadata, disk-capacity, and elapsed-time APIs used by the embedded runtime
  • adds verifiers for the privacy manifest and zipped MeshLLMFFI.xcframework.zip artifact
  • verifies the macOS framework slice is versioned before accepting the release artifact
  • verifies the tagged Package.swift already points at the exact release URL and checksum for the built artifact
  • runs a temporary SwiftPM consumer from the zipped artifact and calls generateOwnerKeypairHex() through the packaged UniFFI binary target
  • runs the zipped-artifact consumer smoke from the Swift SDK CI smoke script and release preparation script
  • adds a release workflow job that builds, verifies, and uploads MeshLLMFFI.xcframework.zip
  • adds stream cancellation tests for break/cancel, completion-before-activation, and late completion after cancellation

Validation

  • bash -n sdk/swift/scripts/build-xcframework.sh
  • bash -n sdk/swift/scripts/build-host-macos-xcframework.sh
  • bash -n scripts/verify-swift-privacy-manifest.sh
  • bash -n scripts/verify-swift-release-artifact.sh
  • bash -n scripts/verify-swift-package-manifest.sh
  • bash -n scripts/ci-swift-sdk-smoke.sh
  • bash -n scripts/prepare-swift-package-release.sh
  • plutil -lint sdk/swift/PrivacyInfo.xcprivacy
  • scripts/check-sdk-contract.sh
  • ./sdk/swift/scripts/build-host-macos-xcframework.sh
  • scripts/verify-swift-privacy-manifest.sh sdk/swift/PrivacyInfo.xcprivacy sdk/swift/Generated/MeshLLMFFI.xcframework
  • zipped-artifact smoke via scripts/verify-swift-release-artifact.sh <tmp>/MeshLLMFFI.xcframework.zip; this verified the versioned macOS framework slice and ran a SwiftPM consumer that calls UniFFI
  • scripts/verify-swift-package-manifest.sh v0.0.0-test <tmp>/MeshLLMFFI.xcframework.zip <tmp>/Package.swift
  • swift test
  • workflow YAML parsed with Ruby/Psych
  • cargo run -p xtask -- repo-consistency release-targets
  • cargo run -p xtask -- repo-consistency ci-crate-lists

Notes

The fully native long-term shape is an Xcode-built static framework target archived per platform and then assembled into an XCFramework. This PR is a narrower step: remove hand-built XCFramework metadata now while preserving the privacy manifest behavior from #665 and adding checks that catch SwiftPM release packaging regressions.

A release tag must already contain the prepared SwiftPM URL/checksum in Package.swift; release CI now verifies that instead of mutating the manifest after the tag has been checked out.

@i386
i386 marked this pull request as ready for review May 24, 2026 08:38
@i386

i386 commented May 24, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the review feedback in dd34aaa:\n\n- Documented that this PR depends on #665's inner framework layout fix: xcodebuild wraps input frameworks and does not repair a flat macOS bundle.\n- Added release-artifact verification that every macOS slice has the versioned Versions/A layout and canonical symlinks.\n- Strengthened the zipped SwiftPM consumer smoke to call generateOwnerKeypairHex() through the packaged UniFFI binary target, not just compile wrapper code.\n- Added a release workflow job that runs the Swift package artifact preparation path and uploads MeshLLMFFI.xcframework.zip before publication.

@i386
i386 merged commit c3b35aa into main May 24, 2026
21 checks passed
@i386
i386 deleted the fix/swift-xcframework-native-library branch May 24, 2026 19:29
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.

1 participant