Prototype: Swift Package Manager distribution (xcframework)#1486
Open
bmehta001 wants to merge 7 commits into
Open
Prototype: Swift Package Manager distribution (xcframework)#1486bmehta001 wants to merge 7 commits into
bmehta001 wants to merge 7 commits into
Conversation
First-pass scaffold to support Swift Package Manager on Apple platforms (the successor to CocoaPods, whose trunk goes read-only Dec 2 2026; there is no official in-repo podspec today). SPM cannot practically compile the C++ tree (CMake/Bond/sqlite/zlib/platform conditionals), so the compiled C++ core + Obj-C wrappers ship as a prebuilt MATTelemetry.xcframework (.binaryTarget) and the thin Swift layer (wrappers/swift/Sources/OneDSSwift) is compiled from source on top of the Obj-C module the xcframework vends. - Package.swift (root): binaryTarget (xcframework) + OneDSSwift source target; documents the path: -> url:+checksum: switch for releases. - tools/apple/build-xcframework.sh: per-slice static libmat.a via build-ios.sh (iOS device + simulator), lipo, then xcodebuild -create-xcframework; emits a zip + SPM checksum. - tools/apple/module.modulemap + MATTelemetry-umbrella.h: vend the `ObjCModule` Clang module the existing Swift sources already import. - tools/apple/README.md: approach, build/consume steps, release wiring, and the macOS-validation TODOs (macOS/Catalyst slices, conditional modules, header flattening, signing). NOT yet validated on macOS -- needs a mac with Xcode to run the build and adjust the static-lib path / header layout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds .github/workflows/spm-release.yml: on a published 4-component release (vX.Y.Z.W), a macOS-runner job builds MATTelemetry.xcframework, uploads it to the Release, computes the SPM checksum, rewrites the Package.swift binaryTarget from path: to url:+checksum:, and pushes a 3-component SemVer tag (X.Y.Z) that Swift Package Manager can resolve (the SDK's own 4-component tags are not valid SemVer, so SPM ignores them). Also documents the parallel-tag consumption (`from: "3.10.161"`) and the release flow in tools/apple/README.md. Mirrors the vcpkg-release-bump pattern. NOT yet validated -- needs the prototype merged (so Package.swift exists at the release tag) and a macOS runner; the build script itself still needs a first run on a mac. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy objc_begin/end support headers into the flattened xcframework Headers directory and mirror the existing Swift wrapper optional-module source exclusions in the root package manifest. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid vending private wrapper headers from the flattened MATTelemetry.xcframework Headers directory, which otherwise triggers incomplete umbrella warnings when ObjCModule is imported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prototypes distributing the 1DS C++ SDK to Apple developers via Swift Package Manager by shipping the C++ core + Obj-C wrappers as a prebuilt MATTelemetry.xcframework binary target, with the Swift wrapper layer (OneDSSwift) compiled from source on top.
Changes:
- Add a distributable root
Package.swiftusing an SPMbinaryTargetplus the existing Swift sources. - Add Apple tooling to build and package
MATTelemetry.xcframework(modulemap + umbrella header + build script). - Add a GitHub Actions workflow to build/upload the xcframework on release and publish an SPM-resolvable SemVer tag.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
Package.swift |
New root SPM manifest for distributing OneDSSwift backed by a binary xcframework. |
tools/apple/build-xcframework.sh |
Script to build per-slice libmat.a, assemble an xcframework, zip it, and compute SPM checksum. |
tools/apple/module.modulemap |
Declares the ObjCModule Clang module for Swift to import from the xcframework. |
tools/apple/MATTelemetry-umbrella.h |
Umbrella header listing Obj-C wrapper headers to export via the modulemap. |
tools/apple/README.md |
Documentation of the approach, local build steps, and release wiring/TODOs. |
.github/workflows/spm-release.yml |
Release automation: build xcframework, upload to Release, rewrite manifest to url+checksum, and tag for SPM. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Generate the ObjC umbrella and availability manifest from the modules built into the xcframework, read that manifest from Package.swift, and guard Swift type aliases for optional modules. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drive Swift source exclusions and ObjC umbrella optional imports from the modules actually built into MATTelemetry.xcframework, remove unsupported macOS package advertising, and add Apple system linker settings for the static binary target. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment on lines
+118
to
+124
| .linkedFramework("CFNetwork"), | ||
| .linkedFramework("CoreFoundation"), | ||
| .linkedFramework("Foundation"), | ||
| .linkedFramework("IOKit"), | ||
| .linkedFramework("Network"), | ||
| .linkedFramework("SystemConfiguration"), | ||
| .linkedFramework("UIKit"), |
| "sanitizer": $has_sanitizer | ||
| } | ||
| EOF | ||
| cp "$OUT/MATTelemetryAvailability.json" "$ROOT/tools/apple/MATTelemetryAvailability.json" |
Remove macOS package advertising until a macOS slice exists, add iOS linker settings for the static xcframework, and avoid repeating build tool setup for each slice. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment on lines
+3
to
+6
| **Status: prototype / not yet validated on macOS.** This is a first-pass scaffold | ||
| for distributing the 1DS C++ SDK to Apple app developers via **Swift Package | ||
| Manager (SPM)**, the successor to CocoaPods (the CocoaPods trunk goes read-only | ||
| on 2 Dec 2026, and there is no official in-repo podspec today). |
Comment on lines
+20
to
+21
| # NOTE: this is a first-pass scaffold. It has NOT been executed on macOS yet; | ||
| # validate on a mac and adjust the static-lib path / header flattening as needed. |
Comment on lines
+43
to
+48
| has_dataviewer=false | ||
| has_privacyguard=false | ||
| has_sanitizer=false | ||
| [[ -d "$ROOT/lib/modules/dataviewer" ]] && has_dataviewer=true | ||
| [[ -d "$ROOT/lib/modules/privacyguard" ]] && has_privacyguard=true | ||
| [[ -d "$ROOT/lib/modules/sanitizer" ]] && has_sanitizer=true |
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.
Prototype: Swift Package Manager distribution (xcframework)
First-pass scaffold to distribute the 1DS C++ SDK to Apple app developers via Swift Package Manager — the successor to CocoaPods (trunk goes read-only 2 Dec 2026). There is no official in-repo podspec today, and the existing
wrappers/swift/Package.swiftis a local-build skeleton rather than a distributable package.Approach
SPM cannot practically compile this C++ tree from source (CMake/Bond/sqlite/zlib/platform conditionals), so:
MATTelemetry.xcframework(.binaryTarget). The Obj-C wrappers compile intolibmat.aon Apple.wrappers/swift/Sources/OneDSSwift) is compiled from source on top of theObjCModulevended by the xcframework.Package.swiftadvertises.iOS(.v12)only until macOS / Catalyst / visionOS slices are added.What's here
Package.swift— distributable SPM manifest:binaryTarget+OneDSSwiftsource target.tools/apple/build-xcframework.sh— builds staticlibmat.aslices viabuild-ios.sh, combines simulator archs withlipo, and assemblesMATTelemetry.xcframeworkwithxcodebuild -create-xcframework.tools/apple/module.modulemap+MATTelemetry-umbrella.h— vend theObjCModuleClang module.tools/apple/MATTelemetryAvailability.json— generated by the xcframework build and read byPackage.swiftso Swift source exclusions match the optional modules actually built into the binary..github/workflows/spm-release.yml— on a publishedvX.Y.Z.Wrelease: build the xcframework on a macOS runner, upload it to the Release, pin thebinaryTargeturl:+checksum:, and push a 3-component SemVer tag (X.Y.Z) that SPM can resolve.tools/apple/README.md— approach, build/consume, release wiring, and remaining TODOs.Validation performed on macOS
Validated locally with Xcode on macOS:
./build-ios.sh clean release arm64 iphonesimulatorproducedout/lib/libmat.aas a static archive and included Obj-C wrapper symbols.tools/apple/build-xcframework.sh releasesucceeded.ios-arm64ios-arm64_x86_64-simulatorxcodebuild -scheme OneDSSwift -destination 'generic/platform=iOS Simulator' buildConsume after a release
Remaining TODOs
Package.swift.Package.swiftlives long-term, since it makes the repository an SPM package.Companion to the official vcpkg port (C++ consumers) — SPM serves Apple app developers; the two are complementary.