Skip to content

Commit 98e0ee8

Browse files
authored
ref: Convert SentrySwiftAsyncIntegration to Swift (#6932)
* ref: Convert SentrySwiftAsyncIntegration to Swift * Test removal * Revert "Test removal" This reverts commit 132afbf.
1 parent cb8199f commit 98e0ee8

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
@@ -876,8 +876,6 @@
876876
D84DAD582B1742A9003CF120 /* ExternalUIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */; };
877877
D84DAD592B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */; };
878878
D84DAD5A2B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
879-
D84F833D2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = D84F833B2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h */; };
880-
D84F833E2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = D84F833C2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m */; };
881879
D85596F3280580F10041FF8B /* SentryScreenshotIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = D85596F1280580F10041FF8B /* SentryScreenshotIntegration.m */; };
882880
D855AD62286ED6A4002573E1 /* SentryCrashTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D855AD61286ED6A4002573E1 /* SentryCrashTests.m */; };
883881
D855B3E827D652AF00BCED76 /* SentryCoreDataTrackingIntegrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D855B3E727D652AF00BCED76 /* SentryCoreDataTrackingIntegrationTest.swift */; };
@@ -1131,6 +1129,8 @@
11311129
FAC735232E25AA81006C5A64 /* SentryProfilingSwiftHelpersTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FAC735222E25AA7A006C5A64 /* SentryProfilingSwiftHelpersTests.m */; };
11321130
FACEED132E3179A10007B4AC /* SentryOptionsInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = FACEED122E3179A10007B4AC /* SentryOptionsInternal.m */; };
11331131
FAD882762EDA6EF50055AA44 /* SentrySDKInfo+Equality.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD882702EDA6EEF0055AA44 /* SentrySDKInfo+Equality.swift */; };
1132+
FAD882C22EDAADF90055AA44 /* SwiftAsyncIntegration.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD882C12EDAADF90055AA44 /* SwiftAsyncIntegration.swift */; };
1133+
FAD882C42EDB3F4C0055AA44 /* SentryCrashAsync.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD882C32EDB3F450055AA44 /* SentryCrashAsync.h */; };
11341134
FAE2DAB82E1F317900262307 /* SentryProfilingSwiftHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE2DAB72E1F317900262307 /* SentryProfilingSwiftHelpers.m */; };
11351135
FAE2DABA2E1F318900262307 /* SentryProfilingSwiftHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE2DAB92E1F318900262307 /* SentryProfilingSwiftHelpers.h */; };
11361136
FAE579842E7CF21800B710F9 /* SentryMigrateSessionInit.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE5797E2E7CF21300B710F9 /* SentryMigrateSessionInit.swift */; };
@@ -2244,8 +2244,6 @@
22442244
D84D2CDE2C2BF9370011AF8A /* SentryReplayType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryReplayType.swift; sourceTree = "<group>"; };
22452245
D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SentryTestUtilsDynamic.framework; sourceTree = BUILT_PRODUCTS_DIR; };
22462246
D84DAD4F2B17428D003CF120 /* SentryTestUtilsDynamic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryTestUtilsDynamic.h; sourceTree = "<group>"; };
2247-
D84F833B2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySwiftAsyncIntegration.h; path = include/SentrySwiftAsyncIntegration.h; sourceTree = "<group>"; };
2248-
D84F833C2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySwiftAsyncIntegration.m; sourceTree = "<group>"; };
22492247
D8511F722BAC8F750015E6FD /* Sentry.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = Sentry.modulemap; sourceTree = "<group>"; };
22502248
D85596F1280580F10041FF8B /* SentryScreenshotIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryScreenshotIntegration.m; sourceTree = "<group>"; };
22512249
D855AD61286ED6A4002573E1 /* SentryCrashTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashTests.m; sourceTree = "<group>"; };
@@ -2510,6 +2508,8 @@
25102508
FAC735222E25AA7A006C5A64 /* SentryProfilingSwiftHelpersTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilingSwiftHelpersTests.m; sourceTree = "<group>"; };
25112509
FACEED122E3179A10007B4AC /* SentryOptionsInternal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryOptionsInternal.m; sourceTree = "<group>"; };
25122510
FAD882702EDA6EEF0055AA44 /* SentrySDKInfo+Equality.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentrySDKInfo+Equality.swift"; sourceTree = "<group>"; };
2511+
FAD882C12EDAADF90055AA44 /* SwiftAsyncIntegration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftAsyncIntegration.swift; sourceTree = "<group>"; };
2512+
FAD882C32EDB3F450055AA44 /* SentryCrashAsync.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashAsync.h; path = include/SentryCrashAsync.h; sourceTree = "<group>"; };
25132513
FAE2DAB72E1F317900262307 /* SentryProfilingSwiftHelpers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilingSwiftHelpers.m; sourceTree = "<group>"; };
25142514
FAE2DAB92E1F318900262307 /* SentryProfilingSwiftHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingSwiftHelpers.h; path = Sources/Sentry/include/SentryProfilingSwiftHelpers.h; sourceTree = SOURCE_ROOT; };
25152515
FAE5797E2E7CF21300B710F9 /* SentryMigrateSessionInit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryMigrateSessionInit.swift; sourceTree = "<group>"; };
@@ -3672,15 +3672,14 @@
36723672
7BE0DC35272AE7BF004FA8B7 /* SentryCrash */ = {
36733673
isa = PBXGroup;
36743674
children = (
3675+
FAD882C32EDB3F450055AA44 /* SentryCrashAsync.h */,
36753676
FAAB95DD2EA1EB470030A2DB /* SentryDeviceContextKeys.h */,
36763677
7DC831082398283C0043DD9A /* SentryCrashIntegration.h */,
36773678
7DC831092398283C0043DD9A /* SentryCrashIntegration.m */,
36783679
7BCFBD6C2681D0A900BC27D8 /* SentryCrashScopeObserver.h */,
36793680
7BCFBD6E2681D0EE00BC27D8 /* SentryCrashScopeObserver.m */,
36803681
7B96571F26830C9100C66E25 /* SentryScopeSyncC.h */,
36813682
7B96572126830D2400C66E25 /* SentryScopeSyncC.c */,
3682-
D84F833B2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h */,
3683-
D84F833C2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m */,
36843683
);
36853684
name = SentryCrash;
36863685
sourceTree = "<group>";
@@ -4831,6 +4830,7 @@
48314830
children = (
48324831
FAB0073C2E9F47DE001C806A /* Session */,
48334832
FAE579B42E7DBE9400B710F9 /* SentryGlobalEventProcessor.swift */,
4833+
FAD882C12EDAADF90055AA44 /* SwiftAsyncIntegration.swift */,
48344834
D49064862DFAE1B700555785 /* Screenshot */,
48354835
D8739CF72BECFF92007D2F66 /* Performance */,
48364836
D8CAC02C2BA0663E00E38F34 /* SessionReplay */,
@@ -5143,6 +5143,7 @@
51435143
7B56D73124616CCD00B842DA /* SentryConcurrentRateLimitsDictionary.h in Headers */,
51445144
D456B4322D706BDF007068CB /* SentrySpanOperation.h in Headers */,
51455145
63FE714D20DA4C1100CDBAE8 /* SentryCrashJSONCodec.h in Headers */,
5146+
FAD882C42EDB3F4C0055AA44 /* SentryCrashAsync.h in Headers */,
51465147
7BAF3DD4243DD40F008A5414 /* SentryTransportFactory.h in Headers */,
51475148
63FE717F20DA4C1100CDBAE8 /* SentryCrashReportFields.h in Headers */,
51485149
7BE912AB272162AF00E49E62 /* SentryNoOpSpan.h in Headers */,
@@ -5176,7 +5177,6 @@
51765177
A8AFFCCD29069C3E00967CD7 /* SentryHttpStatusCodeRange.h in Headers */,
51775178
FAAB95DE2EA1EB470030A2DB /* SentryDeviceContextKeys.h in Headers */,
51785179
D83D079B2B7F9D1C00CC9674 /* SentryMsgPackSerializer.h in Headers */,
5179-
D84F833D2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h in Headers */,
51805180
15E0A8EA240F2C9000F044E3 /* SentrySerialization.h in Headers */,
51815181
63FE70EF20DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.h in Headers */,
51825182
635B3F381EBC6E2500A6176D /* SentryAsynchronousOperation.h in Headers */,
@@ -5754,7 +5754,6 @@
57545754
F48F78692E61DE28009D4E7D /* SentryReachability.swift in Sources */,
57555755
D8739D142BEE5049007D2F66 /* SentryRRWebSpanEvent.swift in Sources */,
57565756
FAAB2F972E4D345800FE8B7E /* SentryUIDeviceWrapper.swift in Sources */,
5757-
D84F833E2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m in Sources */,
57585757
7B6438AB26A70F24000D0F65 /* UIViewController+Sentry.m in Sources */,
57595758
84302A812B5767A50027A629 /* SentryLaunchProfiling.m in Sources */,
57605759
63AA76A31EB9CBAA00D153DE /* SentryDsn.m in Sources */,
@@ -5933,6 +5932,7 @@
59335932
FA67DCF82DDBD4EA00896B02 /* SentryProfileOptions.swift in Sources */,
59345933
FA67DCF92DDBD4EA00896B02 /* HTTPHeaderSanitizer.swift in Sources */,
59355934
FA67DCFA2DDBD4EA00896B02 /* SentryViewRendererV2.swift in Sources */,
5935+
FAD882C22EDAADF90055AA44 /* SwiftAsyncIntegration.swift in Sources */,
59365936
FAAB30F32E4E8F2C00FE8B7E /* SentryInAppLogic.swift in Sources */,
59375937
FA67DCFC2DDBD4EA00896B02 /* SentryFramesDelayResult.swift in Sources */,
59385938
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)