feat: build kit xcframeworks from SPM packages instead of Xcode projects#729
feat: build kit xcframeworks from SPM packages instead of Xcode projects#729
Conversation
PR SummaryMedium Risk Overview CI workflows and kit metadata are simplified. Kits are updated to support the new build path. Kit Reviewed by Cursor Bugbot for commit 1ed9bea. Bugbot is set up for automated code reviews on this repo. Configure here. |
📦 SDK Size Impact ReportMeasures how much the SDK adds to an app's size (with-SDK minus without-SDK).
➡️ SDK size impact change is minimal. Raw measurementsTarget branch (main): {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1876,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":1792,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6528}This PR: {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1876,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":1792,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6528} |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a2f4b2a. Configure here.
| HEADERS_DIR="Sources/${SCHEME}/include" | ||
|
|
||
| XCFRAMEWORK_ARGS="" | ||
| FRAMEWORK_NAME="${SCHEME}.framework" |
There was a problem hiding this comment.
Wrong framework name: uses SCHEME instead of MODULE
High Severity
FRAMEWORK_NAME is set to "${SCHEME}.framework" (e.g., mParticle-Braze.framework) but xcodebuild archive from an SPM package produces framework bundles using the c99 extended identifier form with underscores (e.g., mParticle_Braze.framework). The existing Scripts/xcframework.sh and the deleted old workflow code both correctly use $MODULE.framework for the -framework argument. This mismatch causes the header/modulemap post-processing to silently skip (the -d check fails) and xcodebuild -create-xcframework to fail because it can't find the framework. Affects all 29 kits.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a2f4b2a. Configure here.
There was a problem hiding this comment.
The module name inside the framework uses underscores (mParticle_Adjust), but the bundle name uses hyphens
Remove kit-level .xcodeproj files and tvOS-specific directories, replacing the xcodeproj-based xcframework build with a script that archives directly from each kit's Package.swift using xcodebuild -skipPackagePluginValidation. - Add Scripts/build_kit_xcframework.sh for SPM-based xcframework generation - Simplify Kits/matrix.json to scheme + module + platforms[] per kit - Update release-publish.yml and build-kits.yml to use the new format - Update all 29 kit Package.swift files with BUILD_XCFRAMEWORK dynamic type and explicit package identity for local path dependencies - Delete 29 kit .xcodeproj directories and 5 tvOS header directories - Update KIT_XCFRAMEWORK_RELEASE_WORKFLOW.md to document the new approach
a2f4b2a to
e83842e
Compare
Xcode 16.4 fails to verify the core SDK's swiftinterface due to the multi-module ObjC/Swift structure introduced in v9.0.0. Remove the xcode_version override so Braze kits build with the default Xcode version like all other kits.


Summary
.xcodeprojdirectories and 5 tvOS-specific header directories (mParticle-*-tvOS/), replacing the xcodeproj-based xcframework build withScripts/build_kit_xcframework.shthat archives directly from each kit'sPackage.swiftusingxcodebuild -skipPackagePluginValidationKits/matrix.jsonfrom separate per-platform schemes to a singlescheme+module+platforms[]per kitrelease-publish.ymlandbuild-kits.ymlworkflows to use the new SPM-based build approachMotivation
Kit
.xcodeprojfiles were only used to generate xcframeworks during release. Every kit already has aPackage.swiftthat defines the same targets and dependencies. By building directly from SPM, we:Key changes
New:
Scripts/build_kit_xcframework.shReusable script that builds an xcframework from an SPM package for one or more platforms. Handles:
xcodebuild archivewith-skipPackagePluginValidation(no.xcodeprojneeded)module.modulemapinto framework bundlesBUILD_XCFRAMEWORK=1to signalPackage.swiftto use dynamic library typeUpdated:
Kits/matrix.jsonSimplified from:
To:
Updated: 29 kit
Package.swiftfilesBUILD_XCFRAMEWORKenv var to conditionally set.dynamiclibrary type (required for framework output from SPM)name: "mparticle-apple-sdk"on local path dependency for SPM identity resolutionDeleted
.xcodeprojdirectories (project files + shared schemes)mParticle-*-tvOS/directories from Braze (3) and Kochava (2) kits — only contained tvOS headers/plists used by the Xcode project's tvOS targetTest plan
Scripts/build_kit_xcframework.shproduces valid xcframeworks for an iOS-only kit (e.g., Adjust) and a multi-platform kit (e.g., Braze)Release – Publishworkflow withdry_run: trueto validate the full CI pipelineBuild KitsCI workflow passes for all 29 kits