-
-
Notifications
You must be signed in to change notification settings - Fork 372
meta: Enable interoperability mode for Swift 5.9 #5823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
itaybre
merged 17 commits into
main
from
itay/cocoa-483-unable-to-build-with-xcode-26-for-visionos
Aug 14, 2025
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2a35181
Set default C language to compiler default
itaybre 9eb217b
Bump GCC C version to GNU11
itaybre 9f350cc
Use GNU17
itaybre ec65866
Remove GCC_C_LANGUAGE_STANDARD
itaybre 662306a
Restore xcconfig changes
itaybre ebd10d0
Add Package.swift for swift 5.9 with interoperabilityMode
itaybre 980cbd3
Update changelog
itaybre c7b2d8a
Set interoperabilityMode only for visionOS
itaybre bc4b06d
Update trigger paths to include any package.swift
itaybre b86218c
Fix building for v9
itaybre be1aa6b
Remove encoding
itaybre 0b116f3
Update tests to check building with both package files
itaybre 3b27258
Only delete newer package files
itaybre 1a71aec
Add explanation comment to Package@swift-5.9.swift
itaybre d541706
Update changelog
itaybre 3400e44
Update file filters to include Package@swift-5.9.swift
itaybre 2c9251c
Fix changelog
itaybre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| // swift-tools-version:5.9 | ||
itaybre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // This Package.swift for Swift 5.9 (and newer) fixes an issue on Xcode 26 when linking `SentrySwiftUI`. | ||
| // Don't remove this comment. | ||
|
|
||
| #if canImport(Darwin) | ||
| import Darwin.C | ||
| #elseif canImport(Glibc) | ||
| import Glibc | ||
| #elseif canImport(MSVCRT) | ||
| import MSVCRT | ||
| #endif | ||
|
|
||
| import PackageDescription | ||
|
|
||
| var products: [Product] = [ | ||
| .library(name: "Sentry", targets: ["Sentry"]), | ||
| .library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]), | ||
| .library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI"]) | ||
| ] | ||
|
|
||
| var targets: [Target] = [ | ||
| .binaryTarget( | ||
| name: "Sentry", | ||
| url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.54.0/Sentry.xcframework.zip", | ||
| checksum: "f0f4b5582f7fef029ddedd22b6b9894a6d2d31ea9c7b52a2133b1ec7c4cff206" //Sentry-Static | ||
itaybre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ), | ||
| .binaryTarget( | ||
| name: "Sentry-Dynamic", | ||
| url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.54.0/Sentry-Dynamic.xcframework.zip", | ||
| checksum: "2cd3ee298133ed3a6d3b98f3b040e5c67b752887e67647ae671f450ecfd3facf" //Sentry-Dynamic | ||
| ), | ||
| .target ( | ||
| name: "SentrySwiftUI", | ||
| dependencies: ["Sentry", "SentryInternal"], | ||
| path: "Sources/SentrySwiftUI", | ||
| exclude: ["SentryInternal/", "module.modulemap"], | ||
| swiftSettings: [ | ||
| .interoperabilityMode(.Cxx, .when(platforms: [.visionOS])) | ||
| ], | ||
| linkerSettings: [ | ||
| .linkedFramework("Sentry") | ||
| ]), | ||
| .target( | ||
| name: "SentryInternal", | ||
| path: "Sources/SentrySwiftUI", | ||
| sources: [ | ||
| "SentryInternal/" | ||
| ], | ||
| publicHeadersPath: "SentryInternal/") | ||
| ] | ||
|
|
||
| let env = getenv("EXPERIMENTAL_SPM_BUILDS") | ||
| if let env = env, String(cString: env) == "1" { | ||
| 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"]), | ||
| // Some API breaking changes are necessary for the framework to compile with SPM, we’ll ship | ||
| // those in V9. | ||
| .define("SDK_V9") | ||
| ]), | ||
| .target( | ||
| name: "SentryObjc", | ||
| dependencies: ["SentrySwift"], | ||
| path: "Sources", | ||
| exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration"], | ||
| publicHeadersPath: "", | ||
itaybre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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"), | ||
| .define("SDK_V9")]) | ||
| ]) | ||
| } | ||
|
|
||
| let package = Package( | ||
| name: "Sentry", | ||
| platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4), .visionOS(.v1)], | ||
| products: products, | ||
| targets: targets, | ||
| cxxLanguageStandard: .cxx14 | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.