Skip to content

Conversation

@noahsmartin
Copy link
Contributor

@noahsmartin noahsmartin commented Oct 16, 2025

This adds a sample app that builds natively with SPM. I don't want to call this GA yet, but once we merge this it will be possible for anyone to build with SPM and I would update the docs to call it a pre-release. With a future major version we can update all the public API to be in Swift and then call it GA

#skip-changelog

Closes #6762

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 29c5899

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1235.77 ms 1268.62 ms 32.85 ms
Size 24.14 KiB 1.01 MiB 1012.19 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a3dfd57 1230.78 ms 1244.91 ms 14.14 ms
e9f483c 1224.60 ms 1260.00 ms 35.40 ms
ad964ca 1234.73 ms 1254.88 ms 20.15 ms
0b6776b 1230.18 ms 1262.06 ms 31.88 ms
52bdc10 1216.35 ms 1255.18 ms 38.83 ms
3cdbc22 1231.63 ms 1251.06 ms 19.43 ms
d48a247 1243.59 ms 1273.27 ms 29.67 ms
c585b1e 1232.88 ms 1249.45 ms 16.58 ms
aff3b66 1229.53 ms 1263.08 ms 33.55 ms
f262e10 1226.88 ms 1250.39 ms 23.51 ms

App size

Revision Plain With Sentry Diff
a3dfd57 23.75 KiB 913.63 KiB 889.87 KiB
e9f483c 23.75 KiB 1022.77 KiB 999.03 KiB
ad964ca 23.75 KiB 913.17 KiB 889.42 KiB
0b6776b 23.75 KiB 968.23 KiB 944.49 KiB
52bdc10 23.75 KiB 1022.78 KiB 999.03 KiB
3cdbc22 23.75 KiB 928.14 KiB 904.40 KiB
d48a247 23.75 KiB 994.73 KiB 970.99 KiB
c585b1e 23.75 KiB 879.95 KiB 856.21 KiB
aff3b66 23.75 KiB 978.53 KiB 954.78 KiB
f262e10 23.75 KiB 913.62 KiB 889.87 KiB

Previous results on branch: addSPMExample

Startup times

Revision Plain With Sentry Diff
a2acf83 1208.89 ms 1242.36 ms 33.47 ms
8afcfeb 1216.15 ms 1236.04 ms 19.89 ms
1268f4f 1226.69 ms 1263.32 ms 36.63 ms

App size

Revision Plain With Sentry Diff
a2acf83 24.14 KiB 1.01 MiB 1014.00 KiB
8afcfeb 23.74 KiB 1008.68 KiB 984.94 KiB
1268f4f 23.74 KiB 1009.43 KiB 985.68 KiB

@noahsmartin noahsmartin force-pushed the addSPMExample branch 2 times, most recently from 005e509 to 786d2c1 Compare October 16, 2025 14:33
@codecov
Copy link

codecov bot commented Nov 11, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
3953 1 3952 24
View the top 1 failed test(s) by shortest run time
iOS_Swift6_UITests.UITests::testLaunchAndCaptureError
Stack Traces | 0s run time
.../iOS-Swift6/iOS-Swift6-UITests/UITests.swift:11 - Failed to get background assertion for target app with pid 18179: Timed out while acquiring background assertion.

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@noahsmartin noahsmartin added the ready-to-merge Use this label to trigger all PR workflows label Nov 11, 2025
@noahsmartin noahsmartin force-pushed the addSPMExample branch 4 times, most recently from 2f42897 to f4c8186 Compare November 12, 2025 18:09
@noahsmartin noahsmartin marked this pull request as ready for review November 12, 2025 20:48
@github-actions github-actions bot mentioned this pull request Nov 12, 2025
Copy link
Contributor

@itaybre itaybre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a comment

Copy link
Member

@philprime philprime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with comments to consider

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Binary Target Removal Fails, Creating Orphans

Removing the conditional wrapper around targets.append breaks the --remove-binary-targets flag in prepare-package.sh. The script's sed pattern /^let env = getenv("EXPERIMENTAL_SPM_BUILDS")/,/^}/d no longer matches, leaving the append statement intact. After the script replaces the targets array with only SentryDistribution, the unconditional append re-adds all SentrySPM targets without corresponding products, creating orphaned targets.

Package.swift#L76-L114

sentry-cocoa/Package.swift

Lines 76 to 114 in 29c5899

products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"]))
targets.append(contentsOf: [
// At least one source file is required, therefore we use a dummy class to satisfy the SPM build system
.target(
name: "SentryHeaders",
path: "Sources/Sentry",
sources: ["SentryDummyPublicEmptyClass.m"],
publicHeadersPath: "Public"
),
.target(
name: "_SentryPrivate",
dependencies: ["SentryHeaders"],
path: "Sources/Sentry",
sources: ["SentryDummyPrivateEmptyClass.m"],
publicHeadersPath: "include",
cSettings: [.headerSearchPath("include/HybridPublic")]),
.target(
name: "SentrySwift",
dependencies: ["_SentryPrivate", "SentryHeaders"],
path: "Sources/Swift",
swiftSettings: [
.unsafeFlags(["-enable-library-evolution"])
]),
.target(
name: "SentryObjc",
dependencies: ["SentrySwift"],
path: "Sources",
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper", "SentryDistribution", "SentryDistributionTests"],
cSettings: [
.headerSearchPath("Sentry/include/HybridPublic"),
.headerSearchPath("Sentry"),
.headerSearchPath("SentryCrash/Recording"),
.headerSearchPath("SentryCrash/Recording/Monitors"),
.headerSearchPath("SentryCrash/Recording/Tools"),
.headerSearchPath("SentryCrash/Installations"),
.headerSearchPath("SentryCrash/Reporting/Filters"),
.headerSearchPath("SentryCrash/Reporting/Filters/Tools")])
])

Fix in Cursor Fix in Web


@noahsmartin noahsmartin merged commit f9270f9 into main Nov 13, 2025
225 of 232 checks passed
@noahsmartin noahsmartin deleted the addSPMExample branch November 13, 2025 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add SPM sample

4 participants