Skip to content

Commit f2d54a0

Browse files
committed
ref: Convert SentrySwiftAsyncIntegration to Swift
1 parent d6ab868 commit f2d54a0

File tree

10 files changed

+44
-43
lines changed

10 files changed

+44
-43
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,6 @@
878878
D84DAD582B1742A9003CF120 /* ExternalUIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */; };
879879
D84DAD592B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */; };
880880
D84DAD5A2B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
881-
D84F833D2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = D84F833B2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h */; };
882-
D84F833E2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = D84F833C2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m */; };
883881
D85596F3280580F10041FF8B /* SentryScreenshotIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = D85596F1280580F10041FF8B /* SentryScreenshotIntegration.m */; };
884882
D855AD62286ED6A4002573E1 /* SentryCrashTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D855AD61286ED6A4002573E1 /* SentryCrashTests.m */; };
885883
D855B3E827D652AF00BCED76 /* SentryCoreDataTrackingIntegrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D855B3E727D652AF00BCED76 /* SentryCoreDataTrackingIntegrationTest.swift */; };
@@ -1132,6 +1130,8 @@
11321130
FAC62B652E15A4100003909D /* SentrySDKThreadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC62B642E15A40C0003909D /* SentrySDKThreadTests.swift */; };
11331131
FAC735232E25AA81006C5A64 /* SentryProfilingSwiftHelpersTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FAC735222E25AA7A006C5A64 /* SentryProfilingSwiftHelpersTests.m */; };
11341132
FACEED132E3179A10007B4AC /* SentryOptionsInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = FACEED122E3179A10007B4AC /* SentryOptionsInternal.m */; };
1133+
FAD882C22EDAADF90055AA44 /* SwiftAsyncIntegration.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD882C12EDAADF90055AA44 /* SwiftAsyncIntegration.swift */; };
1134+
FAD882C42EDB3F4C0055AA44 /* SentryCrashAsync.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD882C32EDB3F450055AA44 /* SentryCrashAsync.h */; };
11351135
FAE2DAB82E1F317900262307 /* SentryProfilingSwiftHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE2DAB72E1F317900262307 /* SentryProfilingSwiftHelpers.m */; };
11361136
FAE2DABA2E1F318900262307 /* SentryProfilingSwiftHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE2DAB92E1F318900262307 /* SentryProfilingSwiftHelpers.h */; };
11371137
FAE579842E7CF21800B710F9 /* SentryMigrateSessionInit.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE5797E2E7CF21300B710F9 /* SentryMigrateSessionInit.swift */; };
@@ -2249,8 +2249,6 @@
22492249
D84D2CDE2C2BF9370011AF8A /* SentryReplayType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryReplayType.swift; sourceTree = "<group>"; };
22502250
D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SentryTestUtilsDynamic.framework; sourceTree = BUILT_PRODUCTS_DIR; };
22512251
D84DAD4F2B17428D003CF120 /* SentryTestUtilsDynamic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryTestUtilsDynamic.h; sourceTree = "<group>"; };
2252-
D84F833B2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySwiftAsyncIntegration.h; path = include/SentrySwiftAsyncIntegration.h; sourceTree = "<group>"; };
2253-
D84F833C2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySwiftAsyncIntegration.m; sourceTree = "<group>"; };
22542252
D8511F722BAC8F750015E6FD /* Sentry.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = Sentry.modulemap; sourceTree = "<group>"; };
22552253
D85596F1280580F10041FF8B /* SentryScreenshotIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryScreenshotIntegration.m; sourceTree = "<group>"; };
22562254
D855AD61286ED6A4002573E1 /* SentryCrashTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashTests.m; sourceTree = "<group>"; };
@@ -2515,6 +2513,8 @@
25152513
FAC62B642E15A40C0003909D /* SentrySDKThreadTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySDKThreadTests.swift; sourceTree = "<group>"; };
25162514
FAC735222E25AA7A006C5A64 /* SentryProfilingSwiftHelpersTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilingSwiftHelpersTests.m; sourceTree = "<group>"; };
25172515
FACEED122E3179A10007B4AC /* SentryOptionsInternal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryOptionsInternal.m; sourceTree = "<group>"; };
2516+
FAD882C12EDAADF90055AA44 /* SwiftAsyncIntegration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftAsyncIntegration.swift; sourceTree = "<group>"; };
2517+
FAD882C32EDB3F450055AA44 /* SentryCrashAsync.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashAsync.h; path = include/SentryCrashAsync.h; sourceTree = "<group>"; };
25182518
FAE2DAB72E1F317900262307 /* SentryProfilingSwiftHelpers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilingSwiftHelpers.m; sourceTree = "<group>"; };
25192519
FAE2DAB92E1F318900262307 /* SentryProfilingSwiftHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingSwiftHelpers.h; path = Sources/Sentry/include/SentryProfilingSwiftHelpers.h; sourceTree = SOURCE_ROOT; };
25202520
FAE5797E2E7CF21300B710F9 /* SentryMigrateSessionInit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryMigrateSessionInit.swift; sourceTree = "<group>"; };
@@ -3680,15 +3680,14 @@
36803680
7BE0DC35272AE7BF004FA8B7 /* SentryCrash */ = {
36813681
isa = PBXGroup;
36823682
children = (
3683+
FAD882C32EDB3F450055AA44 /* SentryCrashAsync.h */,
36833684
FAAB95DD2EA1EB470030A2DB /* SentryDeviceContextKeys.h */,
36843685
7DC831082398283C0043DD9A /* SentryCrashIntegration.h */,
36853686
7DC831092398283C0043DD9A /* SentryCrashIntegration.m */,
36863687
7BCFBD6C2681D0A900BC27D8 /* SentryCrashScopeObserver.h */,
36873688
7BCFBD6E2681D0EE00BC27D8 /* SentryCrashScopeObserver.m */,
36883689
7B96571F26830C9100C66E25 /* SentryScopeSyncC.h */,
36893690
7B96572126830D2400C66E25 /* SentryScopeSyncC.c */,
3690-
D84F833B2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h */,
3691-
D84F833C2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m */,
36923691
);
36933692
name = SentryCrash;
36943693
sourceTree = "<group>";
@@ -4840,6 +4839,7 @@
48404839
children = (
48414840
FAB0073C2E9F47DE001C806A /* Session */,
48424841
FAE579B42E7DBE9400B710F9 /* SentryGlobalEventProcessor.swift */,
4842+
FAD882C12EDAADF90055AA44 /* SwiftAsyncIntegration.swift */,
48434843
D49064862DFAE1B700555785 /* Screenshot */,
48444844
D8739CF72BECFF92007D2F66 /* Performance */,
48454845
D8CAC02C2BA0663E00E38F34 /* SessionReplay */,
@@ -5152,6 +5152,7 @@
51525152
7B56D73124616CCD00B842DA /* SentryConcurrentRateLimitsDictionary.h in Headers */,
51535153
D456B4322D706BDF007068CB /* SentrySpanOperation.h in Headers */,
51545154
63FE714D20DA4C1100CDBAE8 /* SentryCrashJSONCodec.h in Headers */,
5155+
FAD882C42EDB3F4C0055AA44 /* SentryCrashAsync.h in Headers */,
51555156
7BAF3DD4243DD40F008A5414 /* SentryTransportFactory.h in Headers */,
51565157
63FE717F20DA4C1100CDBAE8 /* SentryCrashReportFields.h in Headers */,
51575158
7BE912AB272162AF00E49E62 /* SentryNoOpSpan.h in Headers */,
@@ -5185,7 +5186,6 @@
51855186
A8AFFCCD29069C3E00967CD7 /* SentryHttpStatusCodeRange.h in Headers */,
51865187
FAAB95DE2EA1EB470030A2DB /* SentryDeviceContextKeys.h in Headers */,
51875188
D83D079B2B7F9D1C00CC9674 /* SentryMsgPackSerializer.h in Headers */,
5188-
D84F833D2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h in Headers */,
51895189
15E0A8EA240F2C9000F044E3 /* SentrySerialization.h in Headers */,
51905190
63FE70EF20DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.h in Headers */,
51915191
635B3F381EBC6E2500A6176D /* SentryAsynchronousOperation.h in Headers */,
@@ -5763,7 +5763,6 @@
57635763
F48F78692E61DE28009D4E7D /* SentryReachability.swift in Sources */,
57645764
D8739D142BEE5049007D2F66 /* SentryRRWebSpanEvent.swift in Sources */,
57655765
FAAB2F972E4D345800FE8B7E /* SentryUIDeviceWrapper.swift in Sources */,
5766-
D84F833E2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m in Sources */,
57675766
7B6438AB26A70F24000D0F65 /* UIViewController+Sentry.m in Sources */,
57685767
84302A812B5767A50027A629 /* SentryLaunchProfiling.m in Sources */,
57695768
63AA76A31EB9CBAA00D153DE /* SentryDsn.m in Sources */,
@@ -5942,6 +5941,7 @@
59425941
FA67DCF82DDBD4EA00896B02 /* SentryProfileOptions.swift in Sources */,
59435942
FA67DCF92DDBD4EA00896B02 /* HTTPHeaderSanitizer.swift in Sources */,
59445943
FA67DCFA2DDBD4EA00896B02 /* SentryViewRendererV2.swift in Sources */,
5944+
FAD882C22EDAADF90055AA44 /* SwiftAsyncIntegration.swift in Sources */,
59455945
FAAB30F32E4E8F2C00FE8B7E /* SentryInAppLogic.swift in Sources */,
59465946
FA67DCFC2DDBD4EA00896B02 /* SentryFramesDelayResult.swift in Sources */,
59475947
FA67DCFD2DDBD4EA00896B02 /* SentryANRTracker.swift in Sources */,

Sources/Sentry/SentrySDKInternal.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#import "SentrySerialization.h"
2424
#import "SentrySessionReplayIntegration.h"
2525
#import "SentrySwift.h"
26-
#import "SentrySwiftAsyncIntegration.h"
2726
#import "SentryTransactionContext.h"
2827
#import "SentryUseNSExceptionCallstackWrapper.h"
2928

@@ -530,8 +529,7 @@ + (void)endSession
530529
#endif // SENTRY_TARGET_REPLAY_SUPPORTED
531530
[SentryANRTrackingIntegration class], [SentryAutoBreadcrumbTrackingIntegration class],
532531
[SentryAutoSessionTrackingIntegration class], [SentryCoreDataTrackingIntegration class],
533-
[SentryFileIOTrackingIntegration class], [SentryNetworkTrackingIntegration class],
534-
[SentrySwiftAsyncIntegration class], nil];
532+
[SentryFileIOTrackingIntegration class], [SentryNetworkTrackingIntegration class], nil];
535533

536534
#if SENTRY_HAS_METRIC_KIT
537535
[defaultIntegrations addObject:[SentryMetricKitIntegration class]];

Sources/Sentry/SentrySwiftAsyncIntegration.m

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef SentryCrash_Async_h
2+
#define SentryCrash_Async_h
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
void sentrycrashsc_setSwiftAsyncStitching(bool enabled);
9+
10+
#ifdef __cplusplus
11+
}
12+
#endif
13+
14+
#endif

Sources/Sentry/include/SentryPrivate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#import "SentryBinaryImageCacheCallbacks.h"
1313
#import "SentryClient+Private.h"
1414
#import "SentryConcurrentRateLimitsDictionary.h"
15+
#import "SentryCrashAsync.h"
1516
#import "SentryCrashBinaryImageCache.h"
1617
#import "SentryCrashDynamicLinker.h"
1718
#import "SentryCrashExceptionApplicationHelper.h"

Sources/Sentry/include/SentrySwiftAsyncIntegration.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_SelfThread.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ extern "C" {
4242
*/
4343
void sentrycrashsc_initSelfThread(SentryCrashStackCursor *cursor, int skipEntries);
4444

45-
void sentrycrashsc_setSwiftAsyncStitching(bool enabled);
46-
4745
#ifdef __cplusplus
4846
}
4947
#endif

Sources/Swift/Core/Integrations/Integrations.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ private struct AnyIntegration {
3434
@_spi(Private) @objc public final class SentrySwiftIntegrationInstaller: NSObject {
3535
@objc public class func install(with options: Options) {
3636
let dependencies = SentryDependencyContainer.sharedInstance()
37+
let commonIntegrations: [AnyIntegration] = [.init(SwiftAsyncIntegration.self)]
3738
#if os(iOS) && !SENTRY_NO_UIKIT
38-
let integrations: [AnyIntegration] = [.init(UserFeedbackIntegration<SentryDependencyContainer>.self)]
39+
let integrations: [AnyIntegration] = commonIntegrations + [.init(UserFeedbackIntegration<SentryDependencyContainer>.self)]
3940
#else
40-
let integrations: [AnyIntegration] = []
41+
let integrations: [AnyIntegration] = commonIntegrations
4142
#endif
4243
integrations.forEach { anyIntegration in
4344
guard let integration = anyIntegration.install(options, dependencies) else { return }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@_implementationOnly import _SentryPrivate
2+
3+
final class SwiftAsyncIntegration<Dependencies>: NSObject, SwiftIntegration {
4+
init?(with options: Options, dependencies: Dependencies) {
5+
guard options.swiftAsyncStacktraces else { return nil }
6+
7+
sentrycrashsc_setSwiftAsyncStitching(true)
8+
}
9+
10+
func uninstall() {
11+
sentrycrashsc_setSwiftAsyncStitching(false)
12+
}
13+
14+
static var name: String {
15+
"SentrySwiftAsyncIntegration"
16+
}
17+
}

Tests/SentryTests/SentryTests-Bridging-Header.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@
162162
#import "SentryStacktraceBuilder.h"
163163
#import "SentrySubClassFinder.h"
164164
#import "SentrySwift.h"
165-
#import "SentrySwiftAsyncIntegration.h"
166165
#import "SentrySystemEventBreadcrumbs.h"
167166
#import "SentrySystemWrapper.h"
168167
#import "SentryTestIntegration.h"

0 commit comments

Comments
 (0)