build: consume single self-contained SentryObjC xcframework; drop Sentry.xcframework - #5500
build: consume single self-contained SentryObjC xcframework; drop Sentry.xcframework#5500jamescrosswell wants to merge 5 commits into
Conversation
…drop Sentry.xcframework Completes #5444. Follow-up to #5450 (which removed all use of the classic Sentry* ObjC API); this removes the last dependency on Sentry.framework. The .NET SDK now consumes one self-contained SentryObjC-Dynamic.xcframework (the SentryObjC* surface with the engine baked in) instead of three thin frameworks (Sentry + SentryObjC + SentryObjCCompat) that dynamically linked each other. - modules/sentry-cocoa.properties: version of the pre-built framework to download. - scripts/download-sentry-cocoa.sh (default): download + re-slice the release artifact to the platforms we ship; no submodule checkout or from-source build needed. - scripts/build-sentry-cocoa.sh (-p:BuildCocoaSdkFromSource=true): build the same framework from the submodule via sentry-cocoa's own dynamic-variant pipeline, for debugging. Requires xcbeautify. - Sentry.Bindings.Cocoa.csproj: one NativeReference; _DownloadCocoaSDK / _BuildCocoaSDK select the source. buildTransitive Hot-Restart strip updated to the single framework. Both paths produce byte-identical bindings. Validated locally: iOS + Mac Catalyst build, iOS device tests (2771 run, 0 failed), and the app embeds only SentryObjC.framework. #skip-changelog Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5500 +/- ##
==========================================
+ Coverage 74.73% 74.88% +0.14%
==========================================
Files 513 513
Lines 18744 18659 -85
Branches 3666 3636 -30
==========================================
- Hits 14009 13972 -37
+ Misses 3863 3818 -45
+ Partials 872 869 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…_RUNTIME=1 The generic pre-built SentryObjC-Dynamic release artifact can't be used: the .NET SDK needs SentryCrash compiled with SENTRY_CRASH_MANAGED_RUNTIME=1 (a compile-time #ifdef so the signal / mach-exception monitors cooperate with the managed .NET/mono runtime), and you can't inject a compile flag into a pre-built binary. Without it, native capture of managed crashes breaks (the "captures managed crash" integration tests fail). So build the single self-contained SentryObjC-Dynamic.xcframework from the modules/sentry-cocoa submodule (from-source only; no download/toggle), injecting the define via XCODE_XCCONFIG_FILE since cocoa's packaging scripts don't expose extra build settings. - scripts/sentry-cocoa.xcconfig: GCC_PREPROCESSOR_DEFINITIONS += SENTRY_CRASH_MANAGED_RUNTIME=1. - scripts/build-sentry-cocoa.sh: export XCODE_XCCONFIG_FILE before cocoa's dynamic build. - Removed the download path (download-sentry-cocoa.sh, modules/sentry-cocoa.properties) and the BuildCocoaSdkFromSource toggle; csproj always builds from source (submodule required). Validated locally: SENTRY_CRASH_MANAGED_RUNTIME=1 confirmed on the SentryCrash C compilation; iOS xUnit device suite (2771/0) and the crash-integration tests (6/0, incl. captures managed crash / null reference) pass. #skip-changelog Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Cocoa SDK now ships one self-contained SentryObjC-Dynamic.xcframework instead of three frameworks, so sentry-cli uploads one native debug file (SentryObjC) rather than Sentry + SentryObjC + SentryObjCCompat. Update the expected list accordingly (confirmed by the actual UploadedDebugFiles reported in CI). #skip-changelog Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
| xcodebuild -create-xcframework \ | ||
| -framework "$xcf/ios-arm64/SentryObjC.framework" \ | ||
| -framework "$xcf/ios-arm64_x86_64-simulator/SentryObjC.framework" \ | ||
| -output "Carthage/Build-ios/$FRAMEWORK.xcframework" | ||
| xcodebuild -create-xcframework \ | ||
| -framework "$xcf/ios-arm64_x86_64-maccatalyst/SentryObjC.framework" \ | ||
| -output "Carthage/Build-maccatalyst/$FRAMEWORK.xcframework" |
There was a problem hiding this comment.
Bug: The build script hardcodes XCFramework slice directory names. This is fragile and will break the build if the sentry-cocoa dependency changes its naming convention in a future update.
Severity: MEDIUM
Suggested Fix
Instead of hardcoding the slice directory names, the script should dynamically discover them from the filesystem after the sentry-cocoa framework is built. Alternatively, add explicit checks to verify that each required slice directory exists before calling xcodebuild, and provide a clear error message if a path is not found. This will make the build process more resilient to changes in the dependency.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: scripts/build-sentry-cocoa.sh#L68-L74
Potential issue: The build script `scripts/build-sentry-cocoa.sh` uses hardcoded paths
for XCFramework slices, such as `ios-arm64` and `ios-arm64_x86_64-simulator`, when
calling `xcodebuild`. The script does not validate that these specific slice directories
exist before using them. If a future update to the `sentry-cocoa` dependency changes its
slice naming convention (for example, to support new architectures), the hardcoded paths
will become invalid. This will cause the `xcodebuild` command to fail, breaking the
entire SDK build process. While this failure would be caught by CI, it introduces
fragility and maintenance debt, as dependency updates could unexpectedly block builds.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
@philprime is this a realistic concern worth adding complexity for?
I'm guessing if you ever changed things around significantly, you'd probably give us a heads up... worst case, our bump to a new version of sentry-cocoa would fail and we'd discover things had moved around. So kind of thinking it's easier to react to than to anticipate and avoid in advance.
Summary
Completes #5444: the .NET SDK now consumes a single self-contained
SentryObjC-Dynamic.xcframework(theSentryObjC*surface with the engine baked in) and no longer shipsSentry.xcframework. Follow-up to #5450 (which removed all use of the classicSentry*Obj-C API); this removes the last structural dependency onSentry.framework.We build the single framework from the
modules/sentry-cocoasubmodule (replacing the previous three thinxcodebuild archiveframeworks with sentry-cocoa's own dynamic-variant packaging), instead of the three thin frameworks that dynamically linked each other.Important
SentryCrash must be compiled with
SENTRY_CRASH_MANAGED_RUNTIME=1(a compile-time#ifdefthat makes the signal / mach-exception monitors cooperate with the managed .NET/mono runtime). The generic release artifact isn't built with it — so we can't use the generic pre-built framework archive.What changed
scripts/build-sentry-cocoa.sh— builds the single self-containedSentryObjC-Dynamic.xcframeworkvia sentry-cocoa's own pipeline (build-xcframework-sentryobjc.sh --variant dynamic), then re-slices it to the platforms we ship:Carthage/Build-ios(device + simulator) andCarthage/Build-maccatalyst, plus headers. The old bespoke 3-scheme archive + inter-framework linking + nested-Frameworksstripping is gone.scripts/sentry-cocoa.xcconfig(new) — injectsGCC_PREPROCESSOR_DEFINITIONS = $(inherited) SENTRY_CRASH_MANAGED_RUNTIME=1viaXCODE_XCCONFIG_FILE, because cocoa's packaging scripts don't expose extra build settings. (Verified: the define reaches the SentryCrash C compilation.)Sentry.Bindings.Cocoa.csproj— oneNativeReference(SentryObjC-Dynamic.xcframework) instead of three.buildTransitive/Sentry.Bindings.Cocoa.targets— Hot-Restart simulator-strip regex updated to the single framework name.Validation (local, macOS + Xcode 26.6, cocoa 9.26.0)
SentryObjC.framework(noSentry.framework).SENTRY_CRASH_MANAGED_RUNTIME=1confirmed on the SentryCrash C compilation.Closes #5492
Closes #5444
🤖 Generated with Claude Code