Skip to content

fix: SPM manifest compilation on Swift 6.1#7819

Merged
philprime merged 3 commits into
v8.xfrom
fix/spm-manifest-swift-6.1
Apr 22, 2026
Merged

fix: SPM manifest compilation on Swift 6.1#7819
philprime merged 3 commits into
v8.xfrom
fix/spm-manifest-swift-6.1

Conversation

@itaybre
Copy link
Copy Markdown
Contributor

@itaybre itaybre commented Apr 21, 2026

This PR is a clone of #7800 because it failed due to GH permissions, it should pass when created by a Collaborator

📜 Description

Remove the encoding: argument from String(cString:) in Package@swift-6.1.swift so the manifest compiles on Swift 6.1 / Xcode 16+.

💡 Motivation and Context

String(cString:encoding:) is a Foundation extension on String and is not available in the manifest context. On Swift 6.1 / Xcode 16+, manifest compilation fails with:

/Package@swift-6.1.swift:72:51: error: extra argument 'encoding' in call
/Package@swift-6.1.swift:72:51: error: cannot infer contextual base in reference to member 'utf8'

This breaks swift package resolve for downstream projects consuming affected 8.x versions on Xcode 16+.

The stdlib String(cString:) already decodes the C string as UTF-8, so behavior is preserved.

Fixes #7797

💚 How did you test it?

  • swift package dump-package now succeeds on Xcode 16 / Swift 6.1.
  • End-to-end dependency resolution was verified on a consumer project pinning sentry-cocoa in the 8.x range.

No unit tests added — this is a manifest-only change, and the current
test/CI setup does not include a dedicated manifest-compilation check.

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

`String(cString:encoding:)` is a Foundation extension on `String`
and is not available in the SwiftPM manifest context, where only
`PackageDescription` is imported. On Swift 6.1 / Xcode 16+,
`swift package resolve` now fails with:

    error: extra argument 'encoding' in call

Use the stdlib `String(cString:)` initializer, which already
decodes as UTF-8 and matches the original intent.
@itaybre itaybre added the ready-to-merge Use this label to trigger all PR workflows label Apr 21, 2026
@itaybre itaybre changed the title Fix/spm manifest swift 6.1 fix: SPM manifest compilation on Swift 6.1 Apr 21, 2026
@itaybre itaybre closed this Apr 21, 2026
@itaybre itaybre reopened this Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1227.35 ms 1261.76 ms 34.41 ms
Size 24.15 KiB 1005.14 KiB 980.99 KiB

Baseline results on branch: v8.x

Startup times

Revision Plain With Sentry Diff
b79b552 1210.26 ms 1232.54 ms 22.28 ms
e537c90 1226.22 ms 1256.64 ms 30.41 ms
b66be9b 1218.22 ms 1244.19 ms 25.96 ms
e5256c6 1216.34 ms 1248.29 ms 31.95 ms
33c9619 1220.80 ms 1240.02 ms 19.22 ms
5e3fb04 1239.84 ms 1267.39 ms 27.55 ms
e5256c6 1240.96 ms 1273.33 ms 32.38 ms
3af1ae9 1225.60 ms 1252.65 ms 27.05 ms
33c9619 1233.02 ms 1252.60 ms 19.58 ms
b79b552 1216.04 ms 1241.27 ms 25.22 ms

App size

Revision Plain With Sentry Diff
b79b552 23.75 KiB 992.25 KiB 968.50 KiB
e537c90 23.75 KiB 992.03 KiB 968.28 KiB
b66be9b 23.75 KiB 996.03 KiB 972.28 KiB
e5256c6 24.14 KiB 1004.95 KiB 980.80 KiB
33c9619 24.14 KiB 1001.22 KiB 977.08 KiB
5e3fb04 23.74 KiB 981.30 KiB 957.56 KiB
e5256c6 24.14 KiB 1005.14 KiB 980.99 KiB
3af1ae9 23.74 KiB 981.29 KiB 957.55 KiB
33c9619 24.14 KiB 1001.34 KiB 977.19 KiB
b79b552 23.75 KiB 992.16 KiB 968.41 KiB

@itaybre itaybre marked this pull request as ready for review April 21, 2026 19:41
@philprime philprime merged commit 54b6113 into v8.x Apr 22, 2026
402 of 417 checks passed
@philprime philprime deleted the fix/spm-manifest-swift-6.1 branch April 22, 2026 08:02
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.

3 participants