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
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
PR SummaryMedium Risk Overview Release publishing now delegates xcframework creation to a new reusable script, Kit metadata is simplified in Reviewed by Cursor Bugbot for commit a2f4b2a. Bugbot is set up for automated code reviews on this repo. Configure here. |
# Conflicts: # Kits/google-analytics-firebase-ga4/firebase-ga4-11/mParticle-FirebaseGA4.xcodeproj/project.pbxproj # Kits/google-analytics-firebase-ga4/firebase-ga4-12/mParticle-FirebaseGA4.xcodeproj/project.pbxproj # Kits/google-analytics-firebase/firebase-11/mParticle-Firebase.xcodeproj/project.pbxproj # Kits/google-analytics-firebase/firebase-12/mParticle-Firebase.xcodeproj/project.pbxproj # Kits/urbanairship/urbanairship-19/mParticle-UrbanAirship.xcodeproj/project.pbxproj # Kits/urbanairship/urbanairship-20/mParticle-UrbanAirship.xcodeproj/project.pbxproj
📦 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":1880,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":1796,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6532}This PR: {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1880,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":1796,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6532} |
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.


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