sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

Full spm

Open noahsmartin opened this issue 6 months ago • 2 comments

This enables SPM support for building the entire SDK, and gets it building in CI. The approach follows from our slack discussion about introducing a new flag for any changes that are breaking the public API.

The PR is separated into 3 commits for easier reviewing. The first commit is the changes to Decodable conformances which is the part that changes the public API. The second commit is enabling accessing sentryId from Swift. Previously I had done this with a force cast, but this is a simpler way to get it compiling in CI without needing to introduce the force cast. The last commit just sets up CI/Package.swift

If we didn't want to modify the public API we could convert all these classes to Swift, as I started doing here: https://github.com/getsentry/sentry-cocoa/pull/5390 but the focus of this PR is just to get CI building with SPM without making as extensive changes.

#skip-changelog

noahsmartin avatar Jun 04 '25 21:06 noahsmartin

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.258%. Comparing base (2b02431) to head (cd69ef9). Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #5359       +/-   ##
=============================================
+ Coverage   86.238%   86.258%   +0.020%     
=============================================
  Files          399       400        +1     
  Lines        34814     34866       +52     
  Branches     15097     15135       +38     
=============================================
+ Hits         30023     30075       +52     
+ Misses        4744      4743        -1     
- Partials        47        48        +1     
Files with missing lines Coverage Δ
Sources/Sentry/SentryEventSwiftHelper.m 100.000% <100.000%> (ø)
...Integrations/SessionReplay/SentryReplayEvent.swift 85.714% <100.000%> (ø)
...ift/Protocol/Codable/SentryBreadcrumbCodable.swift 100.000% <100.000%> (ø)
...wift/Protocol/Codable/SentryDebugMetaCodable.swift 100.000% <100.000%> (ø)
...es/Swift/Protocol/Codable/SentryEventCodable.swift 100.000% <100.000%> (ø)
...wift/Protocol/Codable/SentryExceptionCodable.swift 100.000% <100.000%> (ø)
...es/Swift/Protocol/Codable/SentryFrameCodable.swift 100.000% <100.000%> (ø)
...rces/Swift/Protocol/Codable/SentryGeoCodable.swift 100.000% <100.000%> (ø)
...wift/Protocol/Codable/SentryMechanismCodable.swift 100.000% <100.000%> (ø)
.../Protocol/Codable/SentryMechanismMetaCodable.swift 100.000% <100.000%> (ø)
... and 6 more

... and 11 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2b02431...cd69ef9. Read the comment docs.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 05 '25 03:06 codecov[bot]

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1207.98 ms 1239.43 ms 31.45 ms
Size 23.75 KiB 852.24 KiB 828.49 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
2691350f392f9e1d9cfebba331b3cd210822d385 1224.92 ms 1255.82 ms 30.90 ms
fc0757dafef9fca8b8101395728bae8800c6a65a 1231.83 ms 1248.98 ms 17.15 ms
2b02431104d0f2ae572950a3f9e14e29e19b5eb5 1229.63 ms 1248.98 ms 19.35 ms
5cfc76877e04e23aca2f156286738a33882cd485 1220.74 ms 1245.06 ms 24.32 ms

App size

Revision Plain With Sentry Diff
2691350f392f9e1d9cfebba331b3cd210822d385 23.75 KiB 850.73 KiB 826.98 KiB
fc0757dafef9fca8b8101395728bae8800c6a65a 23.75 KiB 850.73 KiB 826.98 KiB
2b02431104d0f2ae572950a3f9e14e29e19b5eb5 23.75 KiB 850.73 KiB 826.98 KiB
5cfc76877e04e23aca2f156286738a33882cd485 23.75 KiB 850.73 KiB 826.98 KiB

Previous results on branch: fullSPM

Startup times

Revision Plain With Sentry Diff
81d5875159649b4e7acdfffbc5b9ce023848d660 1229.65 ms 1248.77 ms 19.12 ms

App size

Revision Plain With Sentry Diff
81d5875159649b4e7acdfffbc5b9ce023848d660 23.75 KiB 852.24 KiB 828.49 KiB

github-actions[bot] avatar Jun 05 '25 03:06 github-actions[bot]

I think we should hold off a bit longer on letting users try it, maybe once we have our own sample app using it that would be a good time to put it in the changelog/let people try it

noahsmartin avatar Jun 24 '25 13:06 noahsmartin