Skip to content

Commit eaea273

Browse files
authored
Merge 5d61a7d into 82f60cf
2 parents 82f60cf + 5d61a7d commit eaea273

File tree

6 files changed

+146
-16
lines changed

6 files changed

+146
-16
lines changed

.github/workflows/api-stability.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- ".github/workflows/api-stability.yml"
99
- Sentry.xcworkspace/**
1010
- Sentry.xcodeproj/**
11-
- "Package.swift"
11+
- "Package*.swift"
1212
- "scripts/build-xcframework-local.sh"
1313
- "scripts/update-api.sh"
1414
- "scripts/ci-select-xcode.sh"

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
- Sentry.xcworkspace/**
1717
- Sentry.xcodeproj/**
1818
- Gemfile.lock
19-
- "Package.swift"
19+
- "Package*.swift"
2020
- "Makefile" # Make commands used for CI build setup
2121
- "Brewfile*" # Dependency installation affects build environment
2222

.github/workflows/release.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- "scripts/ci-select-xcode.sh"
1313
- Sentry.xcworkspace/**
1414
- Sentry.xcodeproj/**
15-
- "Package.swift"
15+
- "Package*.swift"
1616
- ".github/workflows/build-xcframework.yml"
1717
- "scripts/build-xcframework-slice.sh"
1818
- "scripts/assemble-xcframework.sh"
@@ -122,7 +122,7 @@ jobs:
122122
# the github.sha is be the pre merge commit id for PRs.
123123
# See https://github.saobby.my.eu.orgmunity/t/github-sha-isnt-the-value-expected/17903/17906.
124124
validate-spm:
125-
name: Validate SPM Static
125+
name: Validate SPM Static ${{matrix.package-file.name}}
126126
runs-on: macos-14
127127
needs: assemble-xcframework-variant
128128
steps:
@@ -131,17 +131,25 @@ jobs:
131131
with:
132132
pattern: xcframework-${{github.sha}}-*
133133
merge-multiple: true
134+
- name: Remove newer package files
135+
if: ${{ matrix.package-file.name == 'Package.swift' }}
136+
run: rm -rf Package@swift*
134137
- name: Change path of the framework
135138
run: |
136-
sed -i '' 's/url.*//g' Package.swift
137-
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' Package.swift
138-
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift
139+
sed -i '' 's/url.*//g' ${{matrix.package-file.name}}
140+
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' ${{matrix.package-file.name}}
141+
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' ${{matrix.package-file.name}}
139142
shell: bash
140143
- run: swift build
141144
working-directory: Samples/macOS-SPM-CommandLine
145+
strategy:
146+
matrix:
147+
package-file:
148+
- name: Package.swift
149+
- name: Package@swift-5.9.swift
142150

143151
validate-spm-dynamic:
144-
name: Validate SPM Dynamic
152+
name: Validate SPM Dynamic ${{matrix.package-file.name}}
145153
runs-on: macos-14
146154
needs: assemble-xcframework-variant
147155
steps:
@@ -150,17 +158,25 @@ jobs:
150158
with:
151159
pattern: xcframework-${{github.sha}}-*
152160
merge-multiple: true
161+
- name: Remove newer package files
162+
if: ${{ matrix.package-file.name == 'Package.swift' }}
163+
run: rm -rf Package@swift*
153164
- name: Change path of the framework
154165
run: |
155-
sed -i '' 's/url.*//g' Package.swift
156-
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' Package.swift
157-
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift
166+
sed -i '' 's/url.*//g' ${{matrix.package-file.name}}
167+
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' ${{matrix.package-file.name}}
168+
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' ${{matrix.package-file.name}}
158169
shell: bash
159170
- run: swift build
160171
working-directory: Samples/SPM-Dynamic
172+
strategy:
173+
matrix:
174+
package-file:
175+
- name: Package.swift
176+
- name: Package@swift-5.9.swift
161177

162178
swift-build:
163-
name: Build Swift Static
179+
name: Build Swift Static ${{matrix.package-file.name}}
164180
runs-on: macos-14
165181
needs: assemble-xcframework-variant
166182
steps:
@@ -169,13 +185,21 @@ jobs:
169185
with:
170186
pattern: xcframework-${{github.sha}}-*
171187
merge-multiple: true
188+
- name: Remove newer package files
189+
if: ${{ matrix.package-file.name == 'Package.swift' }}
190+
run: rm -rf Package@swift*
172191
- name: Change path of the framework
173192
run: |
174-
sed -i '' 's/url.*//g' Package.swift
175-
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' Package.swift
176-
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift
193+
sed -i '' 's/url.*//g' ${{matrix.package-file.name}}
194+
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' ${{matrix.package-file.name}}
195+
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' ${{matrix.package-file.name}}
177196
shell: bash
178197
- run: swift build
198+
strategy:
199+
matrix:
200+
package-file:
201+
- name: Package.swift
202+
- name: Package@swift-5.9.swift
179203

180204
duplication-tests:
181205
name: Test Sentry Duplication V4 # Up the version with every change to keep track of flaky tests

.github/workflows/test-cross-platform.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- "Sources/**"
1111
- "Sentry.podspec"
1212
- "SentrySwiftUI.podspec"
13-
- "Package.swift"
13+
- "Package*.swift"
1414
- "Makefile" # Make commands used for cross-platform setup
1515
- "Brewfile*" # Dependency installation affects cross-platform testing
1616

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Fix Infinite Session Replay Processing Loop (#5765)
99
- Fix memory leak in SessionReplayIntegration (#5770)
1010
- Fix reporting of energy used while profiling (#5768)
11+
- Fix linking with SentrySwiftUI on Xcode 26 for visionOS (#5823)
1112

1213
### Internal
1314

Package@swift-5.9.swift

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// swift-tools-version:5.9
2+
// This Package.swift for Swift 5.9 (and newer) fixes an issue on Xcode 26 when linking `SentrySwiftUI`.
3+
// Don't remove this comment.
4+
5+
#if canImport(Darwin)
6+
import Darwin.C
7+
#elseif canImport(Glibc)
8+
import Glibc
9+
#elseif canImport(MSVCRT)
10+
import MSVCRT
11+
#endif
12+
13+
import PackageDescription
14+
15+
var products: [Product] = [
16+
.library(name: "Sentry", targets: ["Sentry"]),
17+
.library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]),
18+
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI"])
19+
]
20+
21+
var targets: [Target] = [
22+
.binaryTarget(
23+
name: "Sentry",
24+
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.54.0/Sentry.xcframework.zip",
25+
checksum: "f0f4b5582f7fef029ddedd22b6b9894a6d2d31ea9c7b52a2133b1ec7c4cff206" //Sentry-Static
26+
),
27+
.binaryTarget(
28+
name: "Sentry-Dynamic",
29+
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.54.0/Sentry-Dynamic.xcframework.zip",
30+
checksum: "2cd3ee298133ed3a6d3b98f3b040e5c67b752887e67647ae671f450ecfd3facf" //Sentry-Dynamic
31+
),
32+
.target (
33+
name: "SentrySwiftUI",
34+
dependencies: ["Sentry", "SentryInternal"],
35+
path: "Sources/SentrySwiftUI",
36+
exclude: ["SentryInternal/", "module.modulemap"],
37+
swiftSettings: [
38+
.interoperabilityMode(.Cxx, .when(platforms: [.visionOS]))
39+
],
40+
linkerSettings: [
41+
.linkedFramework("Sentry")
42+
]),
43+
.target(
44+
name: "SentryInternal",
45+
path: "Sources/SentrySwiftUI",
46+
sources: [
47+
"SentryInternal/"
48+
],
49+
publicHeadersPath: "SentryInternal/")
50+
]
51+
52+
let env = getenv("EXPERIMENTAL_SPM_BUILDS")
53+
if let env = env, String(cString: env) == "1" {
54+
products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"]))
55+
targets.append(contentsOf: [
56+
// At least one source file is required, therefore we use a dummy class to satisfy the SPM build system
57+
.target(
58+
name: "SentryHeaders",
59+
path: "Sources/Sentry",
60+
sources: ["SentryDummyPublicEmptyClass.m"],
61+
publicHeadersPath: "Public"
62+
),
63+
.target(
64+
name: "_SentryPrivate",
65+
dependencies: ["SentryHeaders"],
66+
path: "Sources/Sentry",
67+
sources: ["SentryDummyPrivateEmptyClass.m"],
68+
publicHeadersPath: "include",
69+
cSettings: [.headerSearchPath("include/HybridPublic")]),
70+
.target(
71+
name: "SentrySwift",
72+
dependencies: ["_SentryPrivate", "SentryHeaders"],
73+
path: "Sources/Swift",
74+
swiftSettings: [
75+
.unsafeFlags(["-enable-library-evolution"]),
76+
// Some API breaking changes are necessary for the framework to compile with SPM, we’ll ship
77+
// those in V9.
78+
.define("SDK_V9")
79+
]),
80+
.target(
81+
name: "SentryObjc",
82+
dependencies: ["SentrySwift"],
83+
path: "Sources",
84+
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration"],
85+
publicHeadersPath: "",
86+
cSettings: [
87+
.headerSearchPath("Sentry/include/HybridPublic"),
88+
.headerSearchPath("Sentry"),
89+
.headerSearchPath("SentryCrash/Recording"),
90+
.headerSearchPath("SentryCrash/Recording/Monitors"),
91+
.headerSearchPath("SentryCrash/Recording/Tools"),
92+
.headerSearchPath("SentryCrash/Installations"),
93+
.headerSearchPath("SentryCrash/Reporting/Filters"),
94+
.headerSearchPath("SentryCrash/Reporting/Filters/Tools"),
95+
.define("SDK_V9")])
96+
])
97+
}
98+
99+
let package = Package(
100+
name: "Sentry",
101+
platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4), .visionOS(.v1)],
102+
products: products,
103+
targets: targets,
104+
cxxLanguageStandard: .cxx14
105+
)

0 commit comments

Comments
 (0)