Skip to content

Commit 609afa7

Browse files
committed
feat: Add SentryDistribution
m
1 parent 4f5b2c9 commit 609afa7

26 files changed

+662
-28
lines changed

.github/actions/prepare-package.swift/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ runs:
2626
run: |
2727
sed -i '' '/Sentry-Dynamic-WithARM64e/d' $PACKAGE_FILE
2828
sed -i '' '/Sentry-WithoutUIKitOrAppKit-WithARM64e/d' $PACKAGE_FILE
29-
sed -i '' '/^[[:space:]]*\.binaryTarget($/{N;/\n[[:space:]]*),$/d;}' $PACKAGE_FILE
29+
sed -i '' '/^[[:space:]]*\.binaryTarget($/{N;/\n[[:space:]]*),\{0,1\}$/d;}' $PACKAGE_FILE
3030
- name: Change path of the framework
3131
shell: bash
3232
env:

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ jobs:
9898
config: DebugV9
9999
- scheme: iOS-ObjectiveC
100100
config: DebugV9
101+
- scheme: DistributionSample
102+
config: Debug
101103

102104
steps:
103105
- uses: actions/checkout@v5
@@ -129,6 +131,26 @@ jobs:
129131
if: ${{ failure() || cancelled() }}
130132
run: ./scripts/ci-diagnostics.sh
131133

134+
build-distribution:
135+
name: Build the distribution framework
136+
runs-on: macos-15
137+
needs: files-changed
138+
steps:
139+
- uses: actions/checkout@v5
140+
141+
- run: ./scripts/ci-select-xcode.sh 16.4
142+
shell: sh
143+
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
144+
- run: set -o pipefail && NSUnbufferedIO=YES xcodebuild build -scheme SentryDistribution -sdk iphoneos -destination 'generic/platform=iphoneos' | tee raw-build-output-spm.log | xcbeautify
145+
shell: sh
146+
- name: Upload SPM Build Logs
147+
uses: actions/upload-artifact@v4
148+
if: ${{ failure() || cancelled() }}
149+
with:
150+
name: raw-build-output-spm
151+
path: |
152+
raw-build-output-spm.log
153+
132154
build-spm:
133155
name: Build with SPM
134156
runs-on: macos-15
@@ -340,6 +362,7 @@ jobs:
340362
files-changed,
341363
ios-swift-release,
342364
build-sample,
365+
build-distribution,
343366
build-spm,
344367
build-v9,
345368
check-debug-without-UIKit,

.github/workflows/test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@ jobs:
9292
if: failure()
9393
run: ./scripts/ci-diagnostics.sh
9494

95+
distribution-tests:
96+
name: Distribution Tests
97+
runs-on: macos-15
98+
needs: files-changed
99+
steps:
100+
- uses: actions/checkout@v5
101+
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
102+
- 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
103+
shell: sh
104+
- name: Upload Distribution Test Logs
105+
uses: actions/upload-artifact@v4
106+
if: ${{ failure() || cancelled() }}
107+
with:
108+
name: raw-test-output-distribution
109+
path: |
110+
raw-test-output-distribution.log
111+
95112
unit-tests:
96113
name: Unit ${{matrix.name}}
97114
runs-on: ${{matrix.runs-on}}
@@ -351,6 +368,7 @@ jobs:
351368
[
352369
files-changed,
353370
build-test-server,
371+
distribution-tests,
354372
unit-tests,
355373
]
356374
name: Unit Tests

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,4 @@ xcode-ci:
189189
xcodegen --spec Samples/watchOS-Swift/watchOS-Swift.yml
190190
xcodegen --spec TestSamples/SwiftUITestSample/SwiftUITestSample.yml
191191
xcodegen --spec TestSamples/SwiftUICrashTest/SwiftUICrashTest.yml
192+
xcodegen --spec Samples/DistributionSample/DistributionSample.yml

Package.swift

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ import PackageDescription
1111

1212
var products: [Product] = [
1313
.library(name: "Sentry", targets: ["Sentry", "SentryCppHelper"]),
14-
.library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]),
15-
.library(name: "Sentry-Dynamic-WithARM64e", targets: ["Sentry-Dynamic-WithARM64e"]),
16-
.library(name: "Sentry-WithoutUIKitOrAppKit", targets: ["Sentry-WithoutUIKitOrAppKit", "SentryCppHelper"]),
17-
.library(name: "Sentry-WithoutUIKitOrAppKit-WithARM64e", targets: ["Sentry-WithoutUIKitOrAppKit-WithARM64e", "SentryCppHelper"]),
18-
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"])
14+
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"]),
15+
.library(name: "SentryDistribution", targets: ["SentryDistribution"])
1916
]
2017

2118
var targets: [Target] = [
@@ -24,26 +21,6 @@ var targets: [Target] = [
2421
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry.xcframework.zip",
2522
checksum: "ecc100b59f2044800650f17786c33f071ea580cb318d82e8ce1d403b643555a4" //Sentry-Static
2623
),
27-
.binaryTarget(
28-
name: "Sentry-Dynamic",
29-
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-Dynamic.xcframework.zip",
30-
checksum: "509cdbc89e4409614f6d584464ef7e1d26c47ad8afe3abc2bd1e1d71c068be1e" //Sentry-Dynamic
31-
),
32-
.binaryTarget(
33-
name: "Sentry-Dynamic-WithARM64e",
34-
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-Dynamic-WithARM64e.xcframework.zip",
35-
checksum: "d62a5ced65465c7c63962ed40d06a9aadd8675b8d0909089f89f65bf233e38c3" //Sentry-Dynamic-WithARM64e
36-
),
37-
.binaryTarget(
38-
name: "Sentry-WithoutUIKitOrAppKit",
39-
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-WithoutUIKitOrAppKit.xcframework.zip",
40-
checksum: "4abfe912bb543eedb7d7dd015df04c93c2b8e49437962046137653d4cf737d38" //Sentry-WithoutUIKitOrAppKit
41-
),
42-
.binaryTarget(
43-
name: "Sentry-WithoutUIKitOrAppKit-WithARM64e",
44-
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip",
45-
checksum: "0b6b454b48614f8cd2430cdc75e524ded46308309b95e73fdd9a90da81622e77" //Sentry-WithoutUIKitOrAppKit-WithARM64e
46-
),
4724
.target (
4825
name: "SentrySwiftUI",
4926
dependencies: ["Sentry", "SentryInternal"],
@@ -66,9 +43,44 @@ var targets: [Target] = [
6643
linkerSettings: [
6744
.linkedLibrary("c++")
6845
]
69-
)
46+
),
47+
.target(name: "SentryDistribution", path: "Sources/SentryDistribution"),
48+
.testTarget(name: "SentryDistributionTests", dependencies: ["SentryDistribution"], path: "Sources/SentryDistributionTests")
7049
]
7150

51+
let skipBinaries = getenv("SKIP_BINARIES").map { String(cString: $0, encoding: .utf8) }
52+
if skipBinaries != "1" {
53+
products.append(contentsOf: [
54+
.library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]),
55+
.library(name: "Sentry-Dynamic-WithARM64e", targets: ["Sentry-Dynamic-WithARM64e"]),
56+
.library(name: "Sentry-WithoutUIKitOrAppKit", targets: ["Sentry-WithoutUIKitOrAppKit", "SentryCppHelper"]),
57+
.library(name: "Sentry-WithoutUIKitOrAppKit-WithARM64e", targets: ["Sentry-WithoutUIKitOrAppKit-WithARM64e", "SentryCppHelper"])
58+
])
59+
60+
targets.append(contentsOf: [
61+
.binaryTarget(
62+
name: "Sentry-Dynamic",
63+
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-Dynamic.xcframework.zip",
64+
checksum: "509cdbc89e4409614f6d584464ef7e1d26c47ad8afe3abc2bd1e1d71c068be1e" //Sentry-Dynamic
65+
),
66+
.binaryTarget(
67+
name: "Sentry-Dynamic-WithARM64e",
68+
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-Dynamic-WithARM64e.xcframework.zip",
69+
checksum: "d62a5ced65465c7c63962ed40d06a9aadd8675b8d0909089f89f65bf233e38c3" //Sentry-Dynamic-WithARM64e
70+
),
71+
.binaryTarget(
72+
name: "Sentry-WithoutUIKitOrAppKit",
73+
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-WithoutUIKitOrAppKit.xcframework.zip",
74+
checksum: "4abfe912bb543eedb7d7dd015df04c93c2b8e49437962046137653d4cf737d38" //Sentry-WithoutUIKitOrAppKit
75+
),
76+
.binaryTarget(
77+
name: "Sentry-WithoutUIKitOrAppKit-WithARM64e",
78+
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip",
79+
checksum: "0b6b454b48614f8cd2430cdc75e524ded46308309b95e73fdd9a90da81622e77" //Sentry-WithoutUIKitOrAppKit-WithARM64e
80+
)
81+
])
82+
}
83+
7284
let env = getenv("EXPERIMENTAL_SPM_BUILDS")
7385
if let env = env, String(cString: env, encoding: .utf8) == "1" {
7486
products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"]))
@@ -101,7 +113,7 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
101113
name: "SentryObjc",
102114
dependencies: ["SentrySwift"],
103115
path: "Sources",
104-
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper"],
116+
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper", "SentryDistribution", "SentryDistributionTests"],
105117
cSettings: [
106118
.headerSearchPath("Sentry/include/HybridPublic"),
107119
.headerSearchPath("Sentry"),
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.sample.DistributionSample
2+
INFOPLIST_FILE = DistributionSample/Info.plist
3+
SUPPORTED_PLATFORMS = iphoneos iphonesimulator
4+
IPHONEOS_DEPLOYMENT_TARGET = 15.0
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: DistributionSample
2+
createIntermediateGroups: true
3+
generateEmptyDirectories: true
4+
configs:
5+
Debug: debug
6+
Release: release
7+
options:
8+
bundleIdPrefix: io.sentry.sample.
9+
packages:
10+
Sentry:
11+
path: ../../
12+
targets:
13+
DistributionSample:
14+
type: application
15+
platform: auto
16+
sources:
17+
- DistributionSample
18+
dependencies:
19+
- package: Sentry
20+
products:
21+
- SentryDistribution
22+
configFiles:
23+
Debug: DistributionSample.xcconfig
24+
Release: DistributionSample.xcconfig
25+
schemes:
26+
DistributionSample:
27+
templates:
28+
- SampleAppScheme
29+
build:
30+
targets:
31+
DistributionSample: all
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import SwiftUI
2+
3+
@main
4+
struct DemoAppApp: App {
5+
var body: some Scene {
6+
WindowGroup {
7+
ContentView()
8+
}
9+
}
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Foundation
2+
3+
enum Constants {
4+
static let accessToken = ""
5+
static let organization = ""
6+
static let project = ""
7+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import SwiftUI
2+
3+
struct ContentView: View {
4+
var body: some View {
5+
VStack(spacing: 20.0) {
6+
Button("Check For Update Swift") {
7+
UpdateUtil.checkForUpdates()
8+
}
9+
.padding()
10+
.background(.blue)
11+
.foregroundColor(.white)
12+
.cornerRadius(10)
13+
}
14+
.padding()
15+
}
16+
}
17+
18+
#Preview {
19+
ContentView()
20+
}

0 commit comments

Comments
 (0)