Skip to content

Commit da7ce75

Browse files
committed
PR feedback
1 parent 82f12fe commit da7ce75

File tree

7 files changed

+62
-46
lines changed

7 files changed

+62
-46
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ jobs:
363363
ios-swift-release,
364364
build-sample,
365365
build-distribution,
366-
build-distribution-sample,
367366
build-spm,
368367
build-v9,
369368
check-debug-without-UIKit,

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ jobs:
9999
steps:
100100
- uses: actions/checkout@v5
101101
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
102-
- run: set -o pipefail && NSUnbufferedIO=YES xcodebuild test -scheme SentryDistributionTests -sdk iphoneos -destination 'generic/platform=iphoneos' | tee raw-test-output-spm.log | xcbeautify
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-spm.log | xcbeautify --preserve-unbeautified
103103
shell: sh
104-
- name: Upload SPM Test Logs
104+
- name: Upload Distribution Test Logs
105105
uses: actions/upload-artifact@v4
106106
if: ${{ failure() || cancelled() }}
107107
with:
108-
name: raw-test-output-spm
108+
name: raw-test-output-distribution
109109
path: |
110-
raw-test-output-spm.log
110+
raw-test-output-distribution.log
111111
112112
unit-tests:
113113
name: Unit ${{matrix.name}}

Package.swift

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ 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"]),
1814
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"]),
1915
.library(name: "SentryDistribution", targets: ["SentryDistribution"])
2016
]
@@ -25,26 +21,6 @@ var targets: [Target] = [
2521
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry.xcframework.zip",
2622
checksum: "ecc100b59f2044800650f17786c33f071ea580cb318d82e8ce1d403b643555a4" //Sentry-Static
2723
),
28-
.binaryTarget(
29-
name: "Sentry-Dynamic",
30-
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-Dynamic.xcframework.zip",
31-
checksum: "509cdbc89e4409614f6d584464ef7e1d26c47ad8afe3abc2bd1e1d71c068be1e" //Sentry-Dynamic
32-
),
33-
.binaryTarget(
34-
name: "Sentry-Dynamic-WithARM64e",
35-
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-Dynamic-WithARM64e.xcframework.zip",
36-
checksum: "d62a5ced65465c7c63962ed40d06a9aadd8675b8d0909089f89f65bf233e38c3" //Sentry-Dynamic-WithARM64e
37-
),
38-
.binaryTarget(
39-
name: "Sentry-WithoutUIKitOrAppKit",
40-
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-WithoutUIKitOrAppKit.xcframework.zip",
41-
checksum: "4abfe912bb543eedb7d7dd015df04c93c2b8e49437962046137653d4cf737d38" //Sentry-WithoutUIKitOrAppKit
42-
),
43-
.binaryTarget(
44-
name: "Sentry-WithoutUIKitOrAppKit-WithARM64e",
45-
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.0/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip",
46-
checksum: "0b6b454b48614f8cd2430cdc75e524ded46308309b95e73fdd9a90da81622e77" //Sentry-WithoutUIKitOrAppKit-WithARM64e
47-
),
4824
.target (
4925
name: "SentrySwiftUI",
5026
dependencies: ["Sentry", "SentryInternal"],
@@ -69,9 +45,42 @@ var targets: [Target] = [
6945
]
7046
),
7147
.target(name: "SentryDistribution", path: "Sources/SentryDistribution"),
72-
.testTarget(name: "SentryDistributionTests", path: "Sources/SentryDistributionTests")
48+
.testTarget(name: "SentryDistributionTests", dependencies: ["SentryDistribution"], path: "Sources/SentryDistributionTests")
7349
]
7450

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+
7584
let env = getenv("EXPERIMENTAL_SPM_BUILDS")
7685
if let env = env, String(cString: env, encoding: .utf8) == "1" {
7786
products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"]))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.DistributionSample
1+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.sample.DistributionSample
22
INFOPLIST_FILE = DistributionSample/Info.plist
33
SUPPORTED_PLATFORMS = iphoneos iphonesimulator
44
IPHONEOS_DEPLOYMENT_TARGET = 15.0

Samples/DistributionSample/DistributionSample.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ configs:
55
Debug: debug
66
Release: release
77
options:
8-
bundleIdPrefix: io.sentry
8+
bundleIdPrefix: io.sentry.sample.
99
packages:
1010
Sentry:
1111
path: ../../

Samples/DistributionSample/DistributionSample/UpdateUtil.swift

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ enum UpdateUtil {
1111
}
1212
}
1313

14-
@MainActor
1514
static func handleUpdateResult(result: Result<UpdateCheckResponse, Error>) {
1615
guard case let .success(releaseInfo) = result else {
1716
if case let .failure(error) = result {
@@ -27,23 +26,13 @@ enum UpdateUtil {
2726

2827
UpdateUtil.installRelease(releaseInfo: releaseInfo)
2928
}
30-
31-
@MainActor
29+
3230
private static func installRelease(releaseInfo: ReleaseInfo) {
3331
guard let url = Updater.buildUrlForInstall(releaseInfo.downloadUrl) else {
3432
return
3533
}
3634
DispatchQueue.main.async {
37-
UIApplication.shared.open(url) { _ in
38-
// Post notification event before closing the app
39-
NotificationCenter.default.post(name: UIApplication.willTerminateNotification, object: nil)
40-
41-
// Close the app after a slight delay so it has time to execute code for the notification
42-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
43-
// We need to exit since iOS doesn't start the install until the app exits
44-
exit(0)
45-
}
46-
}
35+
Updater.install(url: url)
4736
}
4837
}
4938
}

Sources/SentryDistribution/Updater.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import Foundation
2+
#if canImport(UIKit)
23
import UIKit
4+
#endif
35

46
/// A class for checking and installing app updates from Sentry's distribution service.
57
public final class Updater {
@@ -36,9 +38,26 @@ public final class Updater {
3638
}
3739
}
3840

41+
#if canImport(UIKit)
42+
/// Install an update from the provided URL
43+
/// - Parameter url: The itms-services URL
44+
@MainActor public static func install(url: URL) {
45+
UIApplication.shared.open(url) { _ in
46+
// Post notification event before closing the app
47+
NotificationCenter.default.post(name: UIApplication.willTerminateNotification, object: nil)
48+
49+
// Close the app after a slight delay so it has time to execute code for the notification
50+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
51+
// We need to exit since iOS doesn't start the install until the app exits
52+
exit(0)
53+
}
54+
}
55+
}
56+
#endif
57+
3958
/// Obtain a URL to install an IPA
4059
/// - Parameter plistUrl: The URL to the plist containing the IPA information
41-
/// - Returns: a URL ready to install the IPA using Itunes Services
60+
/// - Returns: a URL ready to install the IPA using itms-services
4261
public static func buildUrlForInstall(_ plistUrl: String) -> URL? {
4362
guard var components = URLComponents(string: "itms-services://") else {
4463
return nil

0 commit comments

Comments
 (0)