Skip to content

Commit 92a02b8

Browse files
authored
refactor: Add dummy classes for SPM build system (#5777)
1 parent ad964ca commit 92a02b8

File tree

5 files changed

+52
-6
lines changed

5 files changed

+52
-6
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,22 @@ jobs:
112112
if: startsWith(github.ref, 'refs/heads/release/') == false
113113
steps:
114114
- uses: actions/checkout@v4
115-
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace && EXPERIMENTAL_SPM_BUILDS=1 xcodebuild build -scheme SentrySPM -sdk watchos -destination 'generic/platform=watchOS'
115+
116+
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
117+
- run: set -o pipefail && NSUnbufferedIO=YES EXPERIMENTAL_SPM_BUILDS=1 xcodebuild build -scheme SentrySPM -sdk watchos -destination 'generic/platform=watchOS' | tee raw-build-output-spm-watchos.log | xcbeautify
116118
shell: sh
117-
- run: EXPERIMENTAL_SPM_BUILDS=1 xcodebuild build -scheme SentrySPM -sdk iphoneos -destination 'generic/platform=iphoneos'
119+
- run: set -o pipefail && NSUnbufferedIO=YES EXPERIMENTAL_SPM_BUILDS=1 xcodebuild build -scheme SentrySPM -sdk iphoneos -destination 'generic/platform=iphoneos' | tee raw-build-output-spm-iphoneos.log | xcbeautify
118120
shell: sh
119121

122+
- name: Upload SPM Build Logs
123+
uses: actions/upload-artifact@v4
124+
if: ${{ failure() || cancelled() }}
125+
with:
126+
name: raw-build-output-spm
127+
path: |
128+
raw-build-output-spm-watchos.log
129+
raw-build-output-spm-iphoneos.log
130+
120131
build-v9:
121132
name: Build SDK v9
122133
runs-on: macos-15

Package.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,18 @@ let env = getenv("EXPERIMENTAL_SPM_BUILDS")
4747
if let env = env, String(cString: env, encoding: .utf8) == "1" {
4848
products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"]))
4949
targets.append(contentsOf: [
50-
// At least one source file is required
51-
.target(name: "SentryHeaders", path: "Sources/Sentry", sources: ["SentryDsn.m"], publicHeadersPath: "Public"),
50+
// At least one source file is required, therefore we use a dummy class to satisfy the SPM build system
51+
.target(
52+
name: "SentryHeaders",
53+
path: "Sources/Sentry",
54+
sources: ["SentryDummyPublicEmptyClass.m"],
55+
publicHeadersPath: "Public"
56+
),
5257
.target(
5358
name: "_SentryPrivate",
5459
dependencies: ["SentryHeaders"],
5560
path: "Sources/Sentry",
56-
sources: ["NSLocale+Sentry.m"],
61+
sources: ["SentryDummyPrivateEmptyClass.m"],
5762
publicHeadersPath: "include",
5863
cSettings: [.headerSearchPath("include/HybridPublic")]),
5964
.target(
@@ -70,7 +75,7 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
7075
name: "SentryObjc",
7176
dependencies: ["SentrySwift"],
7277
path: "Sources",
73-
exclude: ["Sentry/SentryDsn.m", "Sentry/NSLocale+Sentry.m", "Swift", "SentrySwiftUI", "Resources", "Configuration"],
78+
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration"],
7479
cSettings: [
7580
.headerSearchPath("Sentry/include/HybridPublic"),
7681
.headerSearchPath("Sentry"),

Sentry.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,8 @@
883883
D4CD2A812DE9F91900DA9F59 /* SentryRedactRegionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CD2A7D2DE9F91900DA9F59 /* SentryRedactRegionType.swift */; };
884884
D4E3F35D2D4A864600F79E2B /* SentryNSDictionarySanitizeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D42E48582D48FC8F00D251BC /* SentryNSDictionarySanitizeTests.swift */; };
885885
D4E3F35E2D4A877300F79E2B /* SentryNSDictionarySanitize+Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = D41909942D490006002B83D0 /* SentryNSDictionarySanitize+Tests.m */; };
886+
D4ECA4012E3CBEDE00C757EA /* SentryDummyPublicEmptyClass.m in Sources */ = {isa = PBXBuildFile; fileRef = D4ECA4002E3CBEDE00C757EA /* SentryDummyPublicEmptyClass.m */; };
887+
D4ECA4022E3CBEDE00C757EA /* SentryDummyPrivateEmptyClass.m in Sources */ = {isa = PBXBuildFile; fileRef = D4ECA3FF2E3CBEDE00C757EA /* SentryDummyPrivateEmptyClass.m */; };
886888
D4EDF9842D0B2A210071E7B3 /* Data+SentryTracing.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EDF9832D0B2A1D0071E7B3 /* Data+SentryTracing.swift */; };
887889
D4EE12D22DE9AC3800385BAF /* TestNSNotificationCenterWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EE12D12DE9AC3300385BAF /* TestNSNotificationCenterWrapperTests.swift */; };
888890
D4F2B5352D0C69D500649E42 /* SentryCrashCTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4F2B5342D0C69D100649E42 /* SentryCrashCTests.swift */; };
@@ -2205,6 +2207,8 @@
22052207
D4CBA2512DE06D1600581618 /* TestConstantTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestConstantTests.swift; sourceTree = "<group>"; };
22062208
D4CD2A7C2DE9F91900DA9F59 /* SentryRedactRegion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryRedactRegion.swift; sourceTree = "<group>"; };
22072209
D4CD2A7D2DE9F91900DA9F59 /* SentryRedactRegionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryRedactRegionType.swift; sourceTree = "<group>"; };
2210+
D4ECA3FF2E3CBEDE00C757EA /* SentryDummyPrivateEmptyClass.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryDummyPrivateEmptyClass.m; sourceTree = "<group>"; };
2211+
D4ECA4002E3CBEDE00C757EA /* SentryDummyPublicEmptyClass.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryDummyPublicEmptyClass.m; sourceTree = "<group>"; };
22082212
D4EDF9832D0B2A1D0071E7B3 /* Data+SentryTracing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+SentryTracing.swift"; sourceTree = "<group>"; };
22092213
D4EE12D12DE9AC3300385BAF /* TestNSNotificationCenterWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestNSNotificationCenterWrapperTests.swift; sourceTree = "<group>"; };
22102214
D4F2B5342D0C69D100649E42 /* SentryCrashCTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashCTests.swift; sourceTree = "<group>"; };
@@ -3087,6 +3091,8 @@
30873091
7B2BB0012966F55900A1E102 /* SentryOptionsInternal.h */,
30883092
7D9B079F23D1E89800C5FC8E /* SentryMeta.h */,
30893093
7D082B8023C628780029866B /* SentryMeta.m */,
3094+
D4ECA3FF2E3CBEDE00C757EA /* SentryDummyPrivateEmptyClass.m */,
3095+
D4ECA4002E3CBEDE00C757EA /* SentryDummyPublicEmptyClass.m */,
30903096
);
30913097
path = Sentry;
30923098
sourceTree = "<group>";
@@ -5787,6 +5793,8 @@
57875793
A8F17B2E2901765900990B25 /* SentryRequest.m in Sources */,
57885794
FABE8E172E307A7F0040809A /* Dependencies.swift in Sources */,
57895795
7BE1E33424F7E3CB009D3AD0 /* SentryMigrateSessionInit.m in Sources */,
5796+
D4ECA4012E3CBEDE00C757EA /* SentryDummyPublicEmptyClass.m in Sources */,
5797+
D4ECA4022E3CBEDE00C757EA /* SentryDummyPrivateEmptyClass.m in Sources */,
57905798
D80299502BA83A88000F0081 /* SentryPixelBuffer.swift in Sources */,
57915799
15E0A8F22411A45A00F044E3 /* SentrySession.m in Sources */,
57925800
844EDCE62947DC3100C86F34 /* SentryNSTimerFactory.m in Sources */,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#import <Foundation/Foundation.h>
2+
3+
// This class is required because SPM doesn't support header only targets
4+
5+
NS_ASSUME_NONNULL_BEGIN
6+
7+
@interface SentryPrivateDummyEmptyClass : NSObject
8+
9+
@end
10+
11+
NS_ASSUME_NONNULL_END
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#import <Foundation/Foundation.h>
2+
3+
// This class is required because SPM doesn't support header only targets
4+
5+
NS_ASSUME_NONNULL_BEGIN
6+
7+
@interface SentryPublicDummyEmptyClass : NSObject
8+
9+
@end
10+
11+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)