Skip to content

Commit fddeb9e

Browse files
nekrichbrustolin
andauthored
fix: SentrySwiftUI Carthage build import (#3817)
tl;dr; Fixed SentrySwiftUI Carthage build import. Since there is no modulemap for the SentrySwiftUI declaring exported submodules: For Carthage build make @_implementationOnly import SentryInternal. Import SentrySwiftUI xcframework Samples/Carthage-Validation/XCFramework project to check imports. Co-authored-by: Dhiogo Brustolin <[email protected]>
1 parent 2384e6d commit fddeb9e

File tree

7 files changed

+39
-2
lines changed

7 files changed

+39
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Carthage/Build
4545
Carthage/Checkouts
4646
Carthage
4747
Sentry.Carthage.json
48+
SentrySwiftUI.Carthage.json
4849
Sentry.framework.zip
4950
Sentry.xcframework.zip
5051

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ more about how to use the Metrics API.
1515
- Don't run onCrashedLastSession for nil Events (#3785)
1616
- Redistributable static libraries should never be built with module debugging enabled (#3800)
1717
- Fixed certain views getting loaded twice when adding a child view controller (#3753)
18+
- Fixed broken imports in SentrySwiftUI Carthage build (#3817)
1819
- Fix NSInvalidArgumentException for `NSError sentryErrorWithDomain` (#3819)
1920
- Again fix runtime error when including Sentry as a static lib (#3820)
2021
- Fix crash in hasUnfinishedChildSpansToWaitFor (#3821)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
binary "../Sentry.Carthage.json" ~> 1.0
2+
binary "../SentrySwiftUI.Carthage.json" ~> 1.0

Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
1573CAE42BBCA5660018A2B7 /* SentrySwiftUI.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1573CAE22BBCA4820018A2B7 /* SentrySwiftUI.xcframework */; };
11+
1573CAE52BBCA5660018A2B7 /* SentrySwiftUI.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1573CAE22BBCA4820018A2B7 /* SentrySwiftUI.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12+
1573CAE72BBCA8260018A2B7 /* CheckTracedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1573CAE62BBCA8260018A2B7 /* CheckTracedView.swift */; };
1013
7BA13E32267B3F5200DEE308 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BA13E31267B3F5200DEE308 /* AppDelegate.swift */; };
1114
7BA13E34267B3F5200DEE308 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BA13E33267B3F5200DEE308 /* SceneDelegate.swift */; };
1215
7BA13E36267B3F5200DEE308 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BA13E35267B3F5200DEE308 /* ContentView.swift */; };
@@ -24,6 +27,7 @@
2427
dstPath = "";
2528
dstSubfolderSpec = 10;
2629
files = (
30+
1573CAE52BBCA5660018A2B7 /* SentrySwiftUI.xcframework in Embed Frameworks */,
2731
7BA13E48267B4A2D00DEE308 /* Sentry.xcframework in Embed Frameworks */,
2832
);
2933
name = "Embed Frameworks";
@@ -32,6 +36,8 @@
3236
/* End PBXCopyFilesBuildPhase section */
3337

3438
/* Begin PBXFileReference section */
39+
1573CAE22BBCA4820018A2B7 /* SentrySwiftUI.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SentrySwiftUI.xcframework; path = Carthage/Build/SentrySwiftUI.xcframework; sourceTree = "<group>"; };
40+
1573CAE62BBCA8260018A2B7 /* CheckTracedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckTracedView.swift; sourceTree = "<group>"; };
3541
7BA13E2E267B3F5200DEE308 /* XCFramework.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XCFramework.app; sourceTree = BUILT_PRODUCTS_DIR; };
3642
7BA13E31267B3F5200DEE308 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3743
7BA13E33267B3F5200DEE308 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -48,6 +54,7 @@
4854
isa = PBXFrameworksBuildPhase;
4955
buildActionMask = 2147483647;
5056
files = (
57+
1573CAE42BBCA5660018A2B7 /* SentrySwiftUI.xcframework in Frameworks */,
5158
7BA13E47267B4A2D00DEE308 /* Sentry.xcframework in Frameworks */,
5259
);
5360
runOnlyForDeploymentPostprocessing = 0;
@@ -78,6 +85,7 @@
7885
7BA13E31267B3F5200DEE308 /* AppDelegate.swift */,
7986
7BA13E33267B3F5200DEE308 /* SceneDelegate.swift */,
8087
7BA13E35267B3F5200DEE308 /* ContentView.swift */,
88+
1573CAE62BBCA8260018A2B7 /* CheckTracedView.swift */,
8189
7BA13E37267B3F5400DEE308 /* Assets.xcassets */,
8290
7BA13E3C267B3F5400DEE308 /* LaunchScreen.storyboard */,
8391
7BA13E3F267B3F5400DEE308 /* Info.plist */,
@@ -98,6 +106,7 @@
98106
isa = PBXGroup;
99107
children = (
100108
7BA13E46267B4A2D00DEE308 /* Sentry.xcframework */,
109+
1573CAE22BBCA4820018A2B7 /* SentrySwiftUI.xcframework */,
101110
);
102111
name = Frameworks;
103112
sourceTree = "<group>";
@@ -174,6 +183,7 @@
174183
buildActionMask = 2147483647;
175184
files = (
176185
7BA13E32267B3F5200DEE308 /* AppDelegate.swift in Sources */,
186+
1573CAE72BBCA8260018A2B7 /* CheckTracedView.swift in Sources */,
177187
7BA13E34267B3F5200DEE308 /* SceneDelegate.swift in Sources */,
178188
7BA13E36267B3F5200DEE308 /* ContentView.swift in Sources */,
179189
);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Foundation
2+
import SentrySwiftUI
3+
import SwiftUI
4+
5+
public struct CheckTracedView<Content: View>: View {
6+
public let content: () -> Content
7+
8+
public init(content: @escaping () -> Content) {
9+
self.content = content
10+
}
11+
12+
public var body: some View {
13+
SentryTracedView {
14+
content()
15+
}
16+
}
17+
}
18+
19+
extension View {
20+
public func traceView(_ viewName: String? = nil) -> some View {
21+
sentryTrace(viewName)
22+
}
23+
}

Sources/SentrySwiftUI/SentryTracedView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import Sentry
3-
#if SWIFT_PACKAGE || CARTHAGE
4-
import SentryInternal
3+
#if CARTHAGE || SWIFT_PACKAGE
4+
@_implementationOnly import SentryInternal
55
#endif
66
import SwiftUI
77

scripts/create-carthage-json.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
set -euo pipefail
33

44
echo "{ \"1.0\": \"file:///$(pwd)/Sentry.framework.zip?alt=file:///$(pwd)/Sentry.xcframework.zip\" }" > ./Samples/Carthage-Validation/Sentry.Carthage.json
5+
echo "{ \"1.0\": \"file:///$(pwd)/SentrySwiftUI.framework.zip?alt=file:///$(pwd)/SentrySwiftUI.xcframework.zip\" }" > ./Samples/Carthage-Validation/SentrySwiftUI.Carthage.json

0 commit comments

Comments
 (0)