Skip to content

Commit f5666e7

Browse files
authored
fix(visionOS): Remove Interoperability mode for visionOS (#6077)
* fix(visionOS): Remove Interoperability mode for visionOS * Remove swift settings * Update changelog * Update package.swift patch * Add helper target to link agains libc++ when building for visionOS * Remove extra "," * Fix formatting in expected_package_diff.patch by removing an extra comma in linkerSettings * Fix build issue with SPM * Update Package.swift * Add visionOS validation job * Rename SentryVisionHelper to SentryCppHelper and add add it to every platform * Exclude SentryCppHelper
1 parent 561321a commit f5666e7

File tree

12 files changed

+113
-26
lines changed

12 files changed

+113
-26
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,29 @@ jobs:
211211
- name: Package.swift
212212
213213

214+
validate-spm-visionos:
215+
name: Validate SPM Static visionOS
216+
runs-on: macos-14
217+
needs: [files-changed, assemble-xcframework-variant]
218+
# Run the job only for PRs with related changes or non-PR events.
219+
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
220+
steps:
221+
- uses: actions/checkout@v5
222+
- uses: actions/download-artifact@v5
223+
with:
224+
pattern: xcframework-${{github.sha}}-*
225+
merge-multiple: true
226+
- name: Prepare Package.swift
227+
uses: ./.github/actions/prepare-package.swift
228+
with:
229+
is-pr: ${{ github.event_name == 'pull_request' }}
230+
package-file: [email protected]
231+
- run: set -o pipefail &&xcodebuild build -scheme visionOS-SPM -sdk xros -destination 'generic/platform=xros' | tee raw-build-output-spm-visionOS.log | xcbeautify
232+
working-directory: Samples/visionOS-SPM
233+
- name: Run CI Diagnostics
234+
if: failure()
235+
run: ./scripts/ci-diagnostics.sh
236+
214237
duplication-tests:
215238
name: Test Sentry Duplication V4 # Up the version with every change to keep track of flaky tests
216239
uses: ./.github/workflows/ui-tests-common.yml

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- Lazily CharacterSet only once in SentryBaggageSerialization (#5871)
2424
- Structured Logging: Log `SentrySDK.logger` calls to `SentrySDKLog` (#5991)
2525
- The build type in the app context now differentiates between `enterprise` and `adhoc` (#6044)
26+
- visionOS no longer needs swift's interoperability mode (#6077)
2627
- Ensure IP address is only inferred by Relay if sendDefaultPii is true (#5877)
2728

2829
## 8.55.1

Package.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import MSVCRT
1010
import PackageDescription
1111

1212
var products: [Product] = [
13-
.library(name: "Sentry", targets: ["Sentry"]),
13+
.library(name: "Sentry", targets: ["Sentry", "SentryCppHelper"]),
1414
.library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]),
1515
.library(name: "Sentry-Dynamic-WithARM64e", targets: ["Sentry-Dynamic-WithARM64e"]),
16-
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI"])
16+
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"])
1717
]
1818

1919
var targets: [Target] = [
@@ -46,7 +46,15 @@ var targets: [Target] = [
4646
sources: [
4747
"SentryInternal/"
4848
],
49-
publicHeadersPath: "SentryInternal/")
49+
publicHeadersPath: "SentryInternal/"),
50+
.target(
51+
name: "SentryCppHelper",
52+
dependencies: ["Sentry"],
53+
path: "Sources/SentryCppHelper",
54+
linkerSettings: [
55+
.linkedLibrary("c++")
56+
]
57+
)
5058
]
5159

5260
let env = getenv("EXPERIMENTAL_SPM_BUILDS")
@@ -81,7 +89,7 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
8189
name: "SentryObjc",
8290
dependencies: ["SentrySwift"],
8391
path: "Sources",
84-
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration"],
92+
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper"],
8593
cSettings: [
8694
.headerSearchPath("Sentry/include/HybridPublic"),
8795
.headerSearchPath("Sentry"),

[email protected]

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import MSVCRT
1313
import PackageDescription
1414

1515
var products: [Product] = [
16-
.library(name: "Sentry", targets: ["Sentry"]),
16+
.library(name: "Sentry", targets: ["Sentry", "SentryCppHelper"]),
1717
.library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]),
18-
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI"])
18+
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"])
1919
]
2020

2121
var targets: [Target] = [
@@ -39,9 +39,6 @@ var targets: [Target] = [
3939
dependencies: ["Sentry", "SentryInternal"],
4040
path: "Sources/SentrySwiftUI",
4141
exclude: ["SentryInternal/", "module.modulemap"],
42-
swiftSettings: [
43-
.interoperabilityMode(.Cxx, .when(platforms: [.visionOS]))
44-
],
4542
linkerSettings: [
4643
.linkedFramework("Sentry")
4744
]),
@@ -51,7 +48,15 @@ var targets: [Target] = [
5148
sources: [
5249
"SentryInternal/"
5350
],
54-
publicHeadersPath: "SentryInternal/")
51+
publicHeadersPath: "SentryInternal/"),
52+
.target(
53+
name: "SentryCppHelper",
54+
dependencies: ["Sentry"],
55+
path: "Sources/SentryCppHelper",
56+
linkerSettings: [
57+
.linkedLibrary("c++")
58+
]
59+
)
5560
]
5661

5762
let env = getenv("EXPERIMENTAL_SPM_BUILDS")
@@ -86,7 +91,7 @@ if let env = env, String(cString: env) == "1" {
8691
name: "SentryObjc",
8792
dependencies: ["SentrySwift"],
8893
path: "Sources",
89-
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration"],
94+
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper"],
9095
publicHeadersPath: "",
9196
cSettings: [
9297
.headerSearchPath("Sentry/include/HybridPublic"),

Samples/visionOS-SPM/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
/*.xcodeproj
5+
xcuserdata/
6+
DerivedData/
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Samples/visionOS-SPM/Package.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// swift-tools-version:5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "visionOS-SPM",
8+
platforms: [.visionOS(.v1)],
9+
products: [
10+
.executable(name: "visionOS-SPM", targets: ["visionOS-SPM"])
11+
],
12+
dependencies: [
13+
// branch is replaced in CI to the current sha
14+
.package(name: "Sentry", path: "../../../sentry-cocoa")
15+
],
16+
targets: [
17+
.executableTarget(
18+
name: "visionOS-SPM",
19+
dependencies: [.product(name: "Sentry", package: "Sentry")],
20+
swiftSettings: [
21+
.unsafeFlags(["-warnings-as-errors"])
22+
])
23+
]
24+
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import SwiftUI
2+
3+
struct ContentView: View {
4+
var body: some View {
5+
VStack {
6+
Text("Hello, world!")
7+
}
8+
.padding()
9+
}
10+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Foundation
2+
import Sentry
3+
import SwiftUI
4+
5+
struct VisionOSApp: App {
6+
7+
init() {
8+
SentrySDK.start { options in
9+
options.dsn = "https://[email protected]/5428557"
10+
options.debug = true
11+
}
12+
}
13+
14+
var body: some Scene {
15+
WindowGroup {
16+
ContentView()
17+
}
18+
}
19+
}

Sources/Configuration/SDK.xcconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ GCC_PREPROCESSOR_DEFINITIONS_Release = RELEASE=1
6666
GCC_PREPROCESSOR_DEFINITIONS_ReleaseV9 = SDK_V9=1 RELEASE=1
6767
GCC_PREPROCESSOR_DEFINITIONS_ReleaseWithoutUIKit = RELEASE=1 SENTRY_NO_UIKIT=1
6868
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_$(CONFIGURATION))
69-
SWIFT_OBJC_INTEROP_MODE[sdk=xr*]=objcxx
7069

7170
CODE_SIGN_IDENTITY = iPhone Developer
7271

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// No content needed, we just need this empty file

0 commit comments

Comments
 (0)