Skip to content

Commit 7210241

Browse files
committed
feat: Add SPM sample
1 parent c79fd90 commit 7210241

File tree

18 files changed

+222
-13
lines changed

18 files changed

+222
-13
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
6161
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
6262
- name: Only keep distribution lib and target in Package.swift
63-
run: ./scripts/prepare-package.sh --only-keep-distribution true
63+
run: ./scripts/prepare-package.sh --remove-binary-targets true
6464

6565
- run: ./scripts/ci-select-xcode.sh 16.4
6666
- name: Setup Ruby
@@ -126,7 +126,7 @@ jobs:
126126
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
127127
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
128128
- name: Only keep distribution lib and target in Package.swift
129-
run: ./scripts/prepare-package.sh --only-keep-distribution true
129+
run: ./scripts/prepare-package.sh --remove-binary-targets true
130130

131131
- run: ./scripts/ci-select-xcode.sh 16.4
132132
- run: make init-ci-build

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ jobs:
207207
--is-pr "${{ github.event_name == 'pull_request' }}" \
208208
--change-path true
209209
- run: ./scripts/ci-select-xcode.sh 16.4
210-
- run: swift build
210+
- run: swift build --target SentrySwiftUI
211211
- name: Run CI Diagnostics
212212
if: failure()
213213
run: ./scripts/ci-diagnostics.sh

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ jobs:
116116
--package-file Package.swift \
117117
--is-pr "${{ github.event_name == 'pull_request' }}" \
118118
--remove-duplicate true \
119-
--change-path false
119+
--change-path false \
120+
--remove-binary-targets true
120121
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
121122
- run: set -o pipefail && NSUnbufferedIO=YES SKIP_BINARIES=1 xcodebuild test -scheme Sentry-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16 Pro' | tee raw-test-output-distribution.log | xcbeautify --preserve-unbeautified
122123
shell: sh

.github/workflows/testflight.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
5656
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
5757
- name: Only keep distribution lib and target in Package.swift
58-
run: ./scripts/prepare-package.sh --only-keep-distribution true
58+
run: ./scripts/prepare-package.sh --remove-binary-targets true
5959

6060
- run: make init-ci-build
6161
- run: make xcode-ci

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Samples/visionOS-Swift/visionOS-Swift.xcodeproj
9595
Samples/watchOS-Swift/watchOS-Swift.xcodeproj
9696
Samples/SentrySampleShared/SentrySampleShared.xcodeproj
9797
Samples/DistributionSample/DistributionSample.xcodeproj
98+
Samples/SPM/SPM.xcodeproj
9899
TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj
99100
TestSamples/SwiftUICrashTest/SwiftUICrashTest.xcodeproj
100101

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ xcode:
184184
open Sentry.xcworkspace
185185

186186
xcode-ci:
187+
xcodegen --spec Samples/SPM/SPM.yml
187188
xcodegen --spec Samples/SentrySampleShared/SentrySampleShared.yml
188189
xcodegen --spec Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.yml
189190
xcodegen --spec Samples/iOS-ObjectiveC/iOS-ObjectiveC.yml

Package.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ var targets: [Target] = [
7474
.testTarget(name: "SentryDistributionTests", dependencies: ["SentryDistribution"], path: "Sources/SentryDistributionTests")
7575
]
7676

77-
let env = getenv("EXPERIMENTAL_SPM_BUILDS")
78-
if let env = env, String(cString: env, encoding: .utf8) == "1" {
7977
products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"]))
8078
targets.append(contentsOf: [
8179
// At least one source file is required, therefore we use a dummy class to satisfy the SPM build system
@@ -114,7 +112,6 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
114112
.headerSearchPath("SentryCrash/Reporting/Filters"),
115113
.headerSearchPath("SentryCrash/Reporting/Filters/Tools")])
116114
])
117-
}
118115

119116
let package = Package(
120117
name: "Sentry",

Samples/SPM/SPM.xcconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "../Shared/Config/_Common.xcconfig"
2+
3+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.sample.SPM
4+
INFOPLIST_FILE = SPM/Info.plist
5+
CODE_SIGN_ENTITLEMENTS = SPM/SPM.entitlements
6+
7+
PROVISIONING_PROFILE_SPECIFIER_Debug = match Development io.sentry.sample.SPM
8+
PROVISIONING_PROFILE_SPECIFIER_Release = match AppStore io.sentry.sample.SPM
9+
PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*] = $(PROVISIONING_PROFILE_SPECIFIER_$(CONFIGURATION))
10+
PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*] =
11+
12+
CODE_SIGN_STYLE = Manual
13+
14+
SUPPORTED_PLATFORMS = iphoneos iphonesimulator

Samples/SPM/SPM.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# yaml-language-server: $schema=../../schema/xcodegen.schema.json
2+
3+
name: SPM
4+
createIntermediateGroups: true
5+
generateEmptyDirectories: true
6+
configs:
7+
Debug: debug
8+
Release: release
9+
fileGroups:
10+
- SPM.yml
11+
options:
12+
bundleIdPrefix: io.sentry
13+
packages:
14+
Sentry:
15+
path: ../../
16+
targets:
17+
SPM:
18+
type: application
19+
platform: auto
20+
sources:
21+
- SPM
22+
dependencies:
23+
- package: Sentry
24+
products:
25+
- SentrySwift
26+
configFiles:
27+
Debug: SPM.xcconfig
28+
Release: SPM.xcconfig
29+
schemes:
30+
SPM:
31+
templates:
32+
- SampleAppScheme
33+
build:
34+
targets:
35+
SPM: all
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors": [
3+
{
4+
"idiom": "universal"
5+
}
6+
],
7+
"info": {
8+
"author": "xcode",
9+
"version": 1
10+
}
11+
}

0 commit comments

Comments
 (0)