feat(SPM): Add package traits for UI framework opt-out and macOS CLI sample#7578
feat(SPM): Add package traits for UI framework opt-out and macOS CLI sample#7578
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧Samples
Other
🤖 This preview updates automatically when you update the PR. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7578 +/- ##
=============================================
+ Coverage 85.314% 85.318% +0.003%
=============================================
Files 483 483
Lines 28750 28751 +1
Branches 12492 12496 +4
=============================================
+ Hits 24528 24530 +2
+ Misses 4177 4174 -3
- Partials 45 47 +2 see 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
|
@sentry review |
…wift-6.1.swift in version bump script Correct the Xcode version in the changelog entry for the NoUIFramework trait from 26.2 to 26.4. Additionally, include Package@swift-6.1.swift in the version bump script to ensure proper handling of Swift 6.1+ builds. Refs #7578
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bed2eb7 | 1215.88 ms | 1247.14 ms | 31.27 ms |
| 47c9f79 | 1216.57 ms | 1240.94 ms | 24.37 ms |
| b882255 | 1216.49 ms | 1253.66 ms | 37.17 ms |
| dbfeb41 | 1215.17 ms | 1237.41 ms | 22.23 ms |
| bb418da | 1227.60 ms | 1265.90 ms | 38.30 ms |
| c424b6a | 1220.38 ms | 1248.18 ms | 27.80 ms |
| 70fb69e | 1230.45 ms | 1257.00 ms | 26.55 ms |
| 98a16ef | 1227.45 ms | 1258.19 ms | 30.74 ms |
| e01eafa | 1223.36 ms | 1252.43 ms | 29.07 ms |
| b984142 | 1219.17 ms | 1250.17 ms | 31.00 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bed2eb7 | 24.14 KiB | 1.07 MiB | 1.04 MiB |
| 47c9f79 | 24.14 KiB | 1.09 MiB | 1.06 MiB |
| b882255 | 24.14 KiB | 1.12 MiB | 1.09 MiB |
| dbfeb41 | 24.14 KiB | 1.04 MiB | 1.02 MiB |
| bb418da | 24.14 KiB | 1.04 MiB | 1.02 MiB |
| c424b6a | 24.14 KiB | 1.06 MiB | 1.04 MiB |
| 70fb69e | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| 98a16ef | 24.14 KiB | 1.09 MiB | 1.07 MiB |
| e01eafa | 24.14 KiB | 1.07 MiB | 1.04 MiB |
| b984142 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
Previous results on branch: sentry-cocoa-7369
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 88d0ca1 | 1215.96 ms | 1250.54 ms | 34.59 ms |
| 9da863e | 1223.27 ms | 1258.53 ms | 35.26 ms |
| 6bd7987 | 1208.81 ms | 1235.45 ms | 26.64 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 88d0ca1 | 24.14 KiB | 1.12 MiB | 1.10 MiB |
| 9da863e | 24.14 KiB | 1.12 MiB | 1.10 MiB |
| 6bd7987 | 24.14 KiB | 1.12 MiB | 1.09 MiB |
…sample Add Package@swift-6.1.swift with NoUIFramework trait so SPM compile-from-source users can build without UIKit/AppKit (e.g. macOS/Linux CLIs). Trait maps to SENTRY_NO_UI_FRAMEWORK; no source changes. Add macOS-CLI-Xcode sample (xcodegen + .xcodeproj with traits), Makefile targets and post-step to inject traits after xcodegen until XcodeGen supports them. Track .xcodeproj; ignore only xcuserdata. Refs #7369
…trait injection Build workflow: select Xcode 26.4 for ios-swift-release and build-sample-spm (required for Swift 6.1 package traits). Add build-sample-macOS-CLI-Xcode to the SPM sample matrix. Makefile: remove xcodegen and perl trait injection from build-sample-macOS-CLI-Xcode; use committed .xcodeproj only. Refs #7369
…ecutables Add dedicated check-macOS-CLI-Xcode-no-UI-framework job on macos-26 with Xcode 26.4. Builds the sample and verifies the binary does not link AppKit or UIKit. Extend check-ui-framework-linkage.sh to support bare executables (not just .framework bundles). Refs #7369
Add Unreleased changelog entry for NoUIFramework trait with usage instructions: Swift 6.1+, Xcode setup, SentrySPM product, and sample reference. Refs #7369
Swift 6.1+ uses Package@swift-6.1.swift instead of Package.swift. prepare-package.sh only modifies Package.swift, so when the 6.1 manifest exists it was used unmodified, causing 'Multiple commands produce Sentry.framework' from conflicting binary targets. Temporarily rename Package@swift-6.1.swift so the stripped Package.swift is used. Refs #7369
…wift-6.1.swift in version bump script Correct the Xcode version in the changelog entry for the NoUIFramework trait from 26.2 to 26.4. Additionally, include Package@swift-6.1.swift in the version bump script to ensure proper handling of Swift 6.1+ builds. Refs #7578
Extend all 4 "Prepare Package.swift" steps in release.yml to also process Package@swift-6.1.swift. This ensures binary targets are properly prepared for both package manifests during release validation. Addresses review feedback from philipphofmann. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Log source/target versions, per-file replacement counts, and warnings when a file is left unchanged during update. On verify failures, print the regex used and versions found vs expected.
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, enable autofix in the Cursor dashboard.
Update binary target URLs and checksums from 9.5.1 to 9.6.0 to match Package.swift after rebasing on main.
f99e696 to
e06426f
Compare
After rebasing on main, the entry landed under the released 9.6.0 section. Move it to Unreleased where it belongs.
Refine changelog entry for NoUIFramework trait by removing reference to macOS CLI sample. Update the DSN in the macOS CLI sample to a valid Sentry endpoint for improved functionality.
Add documentation for the new NoUIFramework Swift Package Manager trait that allows building the Sentry SDK without UIKit or AppKit linkage. Covers both Xcode UI setup and Package.swift configuration using the SentrySPM compile-from-source product. Refs getsentry/sentry-cocoa#7578 Co-Authored-By: Claude <noreply@anthropic.com>
Sentry Build Distribution
|
## DESCRIBE YOUR PR Document the new `NoUIFramework` Swift Package Manager trait added in getsentry/sentry-cocoa#7578. This trait lets compile-from-source users build the Sentry SDK without UIKit or AppKit linkage — useful for command-line tools, headless servers, and other non-UI contexts. Adds a "Building Without UIKit or AppKit" section to the SPM install page covering: - Requirements (Swift 6.1+, Xcode 26.4+) - Xcode UI setup (selecting `SentrySPM` product, enabling the trait) - `Package.swift` configuration with a runnable example - Note explaining why `SentrySPM` (compile-from-source) is needed Refs getsentry/sentry-cocoa#7578 ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.): - [ ] Other deadline: - [x] None: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST - [x] Checked Vercel preview for correctness, including links - [x] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Add Swift Package Manager traits support (Swift 6.1+) so compile-from-source users can build without UIKit/AppKit. Introduces
Package@swift-6.1.swiftwith aNoUIFrameworktrait that setsSENTRY_NO_UI_FRAMEWORKwhen enabled; singleSentrySPMproduct, no source changes.Add a macOS command-line tool sample (
Samples/macOS-CLI-Xcode) that depends on SentrySPM with the trait enabled. The sample uses a committed .xcodeproj with traits set (XcodeGen does not support traits yet; see yml comment and XcodeGen #1585).Verification: Without the
NoUIFrameworktrait, the build still succeeds but the binary links AppKit and SwiftUI. With the trait, the binary links only Foundation, CoreFoundation, CoreGraphics, MetricKit, and Swift runtime—no AppKit or UIKit. CI jobcheck-macOS-CLI-Xcode-no-UI-frameworkbuilds the sample and runscheck-ui-framework-linkage.shto enforce this.Check without trait
NoUIFramework:Check with trait
NoUIFrameworkset:Closes #7369