From e9f219c2726f2bb9eb4f4dcb8c65a48c76e0e2df Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 30 Sep 2024 08:44:20 +0200 Subject: [PATCH 01/10] ref: Add ANRTracker protocol (#4360) Add a protocol for the ANRTracker in preparation for switching between V1 and V2. Furthermore, remove the ANRTrackerV2 integration as it would contain mostly duplicated code from ANTTrackerV1. --- Sentry.xcodeproj/project.pbxproj | 40 ++- ...entryANRTracker.m => SentryANRTrackerV1.m} | 6 +- Sources/Sentry/SentryANRTrackingIntegration.m | 6 +- .../Sentry/SentryANRTrackingIntegrationV2.m | 130 ---------- Sources/Sentry/SentryDependencyContainer.m | 20 +- Sources/Sentry/SentryOptions.m | 1 - ...ryWatchdogTerminationTrackingIntegration.m | 6 +- .../HybridPublic/SentryDependencyContainer.h | 6 +- ...entryANRTracker.h => SentryANRTrackerV1.h} | 9 +- Sources/Sentry/include/SentryANRTrackerV2.h | 9 +- .../include/SentryANRTrackingIntegration.h | 2 +- .../include/SentryANRTrackingIntegrationV2.h | 23 -- ...ryWatchdogTerminationTrackingIntegration.h | 2 - .../Integrations/ANR/SentryANRTracker.swift | 12 + ...ts.swift => SentryANRTrackerV1Tests.swift} | 20 +- .../ANR/SentryANRTrackerV2Tests.swift | 52 ++-- .../SentryANRTrackingIntegrationTests.swift | 2 +- .../SentryANRTrackingIntegrationV2Tests.swift | 234 ------------------ .../SentryTests/SentryTests-Bridging-Header.h | 3 +- 19 files changed, 92 insertions(+), 491 deletions(-) rename Sources/Sentry/{SentryANRTracker.m => SentryANRTrackerV1.m} (98%) delete mode 100644 Sources/Sentry/SentryANRTrackingIntegrationV2.m rename Sources/Sentry/include/{SentryANRTracker.h => SentryANRTrackerV1.h} (88%) delete mode 100644 Sources/Sentry/include/SentryANRTrackingIntegrationV2.h create mode 100644 Sources/Swift/Integrations/ANR/SentryANRTracker.swift rename Tests/SentryTests/Integrations/ANR/{SentryANRTrackerTests.swift => SentryANRTrackerV1Tests.swift} (94%) delete mode 100644 Tests/SentryTests/Integrations/ANR/SentryANRTrackingIntegrationV2Tests.swift diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 0b5a30c2bab..70964f92086 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -76,9 +76,6 @@ 620203B22C59025E0008317C /* SentryFileContents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 620203B12C59025E0008317C /* SentryFileContents.swift */; }; 620379DB2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h in Headers */ = {isa = PBXBuildFile; fileRef = 620379DA2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h */; }; 620379DD2AFE1432005AC0C1 /* SentryBuildAppStartSpans.m in Sources */ = {isa = PBXBuildFile; fileRef = 620379DC2AFE1432005AC0C1 /* SentryBuildAppStartSpans.m */; }; - 621A9D5A2C64F18900B5D7D6 /* SentryANRTrackingIntegrationV2.h in Headers */ = {isa = PBXBuildFile; fileRef = 621A9D592C64F18900B5D7D6 /* SentryANRTrackingIntegrationV2.h */; }; - 621A9D5C2C64F1AE00B5D7D6 /* SentryANRTrackingIntegrationV2.m in Sources */ = {isa = PBXBuildFile; fileRef = 621A9D5B2C64F1AE00B5D7D6 /* SentryANRTrackingIntegrationV2.m */; }; - 621A9D5F2C64F3BC00B5D7D6 /* SentryANRTrackingIntegrationV2Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621A9D5D2C64F3B700B5D7D6 /* SentryANRTrackingIntegrationV2Tests.swift */; }; 621AE74B2C626C230012E730 /* SentryANRTrackerV2.h in Headers */ = {isa = PBXBuildFile; fileRef = 621AE74A2C626C230012E730 /* SentryANRTrackerV2.h */; }; 621AE74D2C626C510012E730 /* SentryANRTrackerV2.m in Sources */ = {isa = PBXBuildFile; fileRef = 621AE74C2C626C510012E730 /* SentryANRTrackerV2.m */; }; 621D9F2F2B9B0320003D94DE /* SentryCurrentDateProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */; }; @@ -145,6 +142,7 @@ 62F05D2B2C0DB1F100916E3F /* SentryLogTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 62F05D2A2C0DB1F100916E3F /* SentryLogTestHelper.m */; }; 62F226B729A37C120038080D /* SentryBooleanSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 62F226B629A37C120038080D /* SentryBooleanSerialization.m */; }; 62F4DDA12C04CB9700588890 /* SentryBaggageSerializationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62F4DDA02C04CB9700588890 /* SentryBaggageSerializationTests.swift */; }; + 62FC18AF2C9D5FAC008803CD /* SentryANRTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FC18AE2C9D5FAC008803CD /* SentryANRTracker.swift */; }; 62FC69362BEDFF18002D3EF2 /* SentryLogExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FC69352BEDFF18002D3EF2 /* SentryLogExtensions.swift */; }; 630435FE1EBCA9D900C4D3FA /* SentryNSURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 630435FC1EBCA9D900C4D3FA /* SentryNSURLRequest.h */; }; 630435FF1EBCA9D900C4D3FA /* SentryNSURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 630435FD1EBCA9D900C4D3FA /* SentryNSURLRequest.m */; }; @@ -364,7 +362,7 @@ 7B18DE4228D9F794004845C6 /* SentryNSNotificationCenterWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B18DE4128D9F794004845C6 /* SentryNSNotificationCenterWrapper.m */; }; 7B18DE4A28DA0C8B004845C6 /* SentryNSNotificationCenterWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B18DE4928DA0C8B004845C6 /* SentryNSNotificationCenterWrapperTests.swift */; }; 7B26BBFB24C0A66D00A79CCC /* SentrySdkInfoNilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B26BBFA24C0A66D00A79CCC /* SentrySdkInfoNilTests.m */; }; - 7B2A70D827D5F080008B0D15 /* SentryANRTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B2A70D727D5F07F008B0D15 /* SentryANRTrackerTests.swift */; }; + 7B2A70D827D5F080008B0D15 /* SentryANRTrackerV1Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B2A70D727D5F07F008B0D15 /* SentryANRTrackerV1Tests.swift */; }; 7B2A70DB27D607CF008B0D15 /* SentryThreadWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B2A70DA27D607CF008B0D15 /* SentryThreadWrapper.h */; }; 7B2A70DD27D6083D008B0D15 /* SentryThreadWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B2A70DC27D6083D008B0D15 /* SentryThreadWrapper.m */; }; 7B2A70DF27D60904008B0D15 /* SentryTestThreadWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B2A70DE27D60904008B0D15 /* SentryTestThreadWrapper.swift */; }; @@ -548,7 +546,7 @@ 7BC9A20228F41350001E7C4C /* SentryMeasurementUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC9A20128F41350001E7C4C /* SentryMeasurementUnit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7BC9A20428F4166D001E7C4C /* SentryMeasurementValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC9A20328F4166D001E7C4C /* SentryMeasurementValue.m */; }; 7BC9A20628F41781001E7C4C /* SentryMeasurementUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC9A20528F41781001E7C4C /* SentryMeasurementUnit.m */; }; - 7BCFA71627D0BB50008C662C /* SentryANRTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BCFA71527D0BB50008C662C /* SentryANRTracker.m */; }; + 7BCFA71627D0BB50008C662C /* SentryANRTrackerV1.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BCFA71527D0BB50008C662C /* SentryANRTrackerV1.m */; }; 7BCFBD672681C95000BC27D8 /* SentryScopeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BCFBD662681C95000BC27D8 /* SentryScopeObserver.h */; }; 7BCFBD6D2681D0A900BC27D8 /* SentryCrashScopeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BCFBD6C2681D0A900BC27D8 /* SentryCrashScopeObserver.h */; }; 7BCFBD6F2681D0EE00BC27D8 /* SentryCrashScopeObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BCFBD6E2681D0EE00BC27D8 /* SentryCrashScopeObserver.m */; }; @@ -878,7 +876,7 @@ D880E3A728573E87008A90DB /* SentryBaggageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D880E3A628573E87008A90DB /* SentryBaggageTests.swift */; }; D884A20527C80F6300074664 /* SentryCoreDataTrackerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D884A20327C80F2700074664 /* SentryCoreDataTrackerTest.swift */; }; D885266427739D01001269FC /* SentryFileIOTrackingIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D885266327739D01001269FC /* SentryFileIOTrackingIntegrationTests.swift */; }; - D8853C842833EABC00700D64 /* SentryANRTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BCFA71427D0BAB7008C662C /* SentryANRTracker.h */; }; + D8853C842833EABC00700D64 /* SentryANRTrackerV1.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BCFA71427D0BAB7008C662C /* SentryANRTrackerV1.h */; }; D88817D826D7149100BF2251 /* SentryTraceContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D88817D626D7149100BF2251 /* SentryTraceContext.m */; }; D88817DA26D72AB800BF2251 /* SentryTraceContext.h in Headers */ = {isa = PBXBuildFile; fileRef = D88817D926D72AB800BF2251 /* SentryTraceContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; D88817DD26D72BA500BF2251 /* SentryTraceStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D88817DB26D72B7B00BF2251 /* SentryTraceStateTests.swift */; }; @@ -1085,9 +1083,6 @@ 620203B12C59025E0008317C /* SentryFileContents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryFileContents.swift; sourceTree = ""; }; 620379DA2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryBuildAppStartSpans.h; path = include/SentryBuildAppStartSpans.h; sourceTree = ""; }; 620379DC2AFE1432005AC0C1 /* SentryBuildAppStartSpans.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryBuildAppStartSpans.m; sourceTree = ""; }; - 621A9D592C64F18900B5D7D6 /* SentryANRTrackingIntegrationV2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryANRTrackingIntegrationV2.h; path = include/SentryANRTrackingIntegrationV2.h; sourceTree = ""; }; - 621A9D5B2C64F1AE00B5D7D6 /* SentryANRTrackingIntegrationV2.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryANRTrackingIntegrationV2.m; sourceTree = ""; }; - 621A9D5D2C64F3B700B5D7D6 /* SentryANRTrackingIntegrationV2Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryANRTrackingIntegrationV2Tests.swift; sourceTree = ""; }; 621AE74A2C626C230012E730 /* SentryANRTrackerV2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryANRTrackerV2.h; path = include/SentryANRTrackerV2.h; sourceTree = ""; }; 621AE74C2C626C510012E730 /* SentryANRTrackerV2.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryANRTrackerV2.m; sourceTree = ""; }; 621AE74E2C626CF70012E730 /* SentryANRTrackerV2Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryANRTrackerV2Tests.swift; sourceTree = ""; }; @@ -1157,6 +1152,7 @@ 62F226B629A37C120038080D /* SentryBooleanSerialization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryBooleanSerialization.m; sourceTree = ""; }; 62F226B829A37C270038080D /* SentryBooleanSerialization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryBooleanSerialization.h; sourceTree = ""; }; 62F4DDA02C04CB9700588890 /* SentryBaggageSerializationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryBaggageSerializationTests.swift; sourceTree = ""; }; + 62FC18AE2C9D5FAC008803CD /* SentryANRTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryANRTracker.swift; sourceTree = ""; }; 62FC69352BEDFF18002D3EF2 /* SentryLogExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryLogExtensions.swift; sourceTree = ""; }; 630435FC1EBCA9D900C4D3FA /* SentryNSURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryNSURLRequest.h; path = include/SentryNSURLRequest.h; sourceTree = ""; }; 630435FD1EBCA9D900C4D3FA /* SentryNSURLRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryNSURLRequest.m; sourceTree = ""; }; @@ -1388,7 +1384,7 @@ 7B18DE4328D9F8F6004845C6 /* TestNSNotificationCenterWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestNSNotificationCenterWrapper.swift; sourceTree = ""; }; 7B18DE4928DA0C8B004845C6 /* SentryNSNotificationCenterWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSNotificationCenterWrapperTests.swift; sourceTree = ""; }; 7B26BBFA24C0A66D00A79CCC /* SentrySdkInfoNilTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySdkInfoNilTests.m; sourceTree = ""; }; - 7B2A70D727D5F07F008B0D15 /* SentryANRTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryANRTrackerTests.swift; sourceTree = ""; }; + 7B2A70D727D5F07F008B0D15 /* SentryANRTrackerV1Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryANRTrackerV1Tests.swift; sourceTree = ""; }; 7B2A70DA27D607CF008B0D15 /* SentryThreadWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryThreadWrapper.h; path = include/SentryThreadWrapper.h; sourceTree = ""; }; 7B2A70DC27D6083D008B0D15 /* SentryThreadWrapper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryThreadWrapper.m; sourceTree = ""; }; 7B2A70DE27D60904008B0D15 /* SentryTestThreadWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTestThreadWrapper.swift; sourceTree = ""; }; @@ -1594,8 +1590,8 @@ 7BC9A20328F4166D001E7C4C /* SentryMeasurementValue.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryMeasurementValue.m; sourceTree = ""; }; 7BC9A20528F41781001E7C4C /* SentryMeasurementUnit.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryMeasurementUnit.m; sourceTree = ""; }; 7BC9CD4326A99F660047518E /* SentryUIViewControllerSwizzling+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryUIViewControllerSwizzling+Test.h"; sourceTree = ""; }; - 7BCFA71427D0BAB7008C662C /* SentryANRTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryANRTracker.h; path = include/SentryANRTracker.h; sourceTree = ""; }; - 7BCFA71527D0BB50008C662C /* SentryANRTracker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryANRTracker.m; sourceTree = ""; }; + 7BCFA71427D0BAB7008C662C /* SentryANRTrackerV1.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryANRTrackerV1.h; path = include/SentryANRTrackerV1.h; sourceTree = ""; }; + 7BCFA71527D0BB50008C662C /* SentryANRTrackerV1.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryANRTrackerV1.m; sourceTree = ""; }; 7BCFBD662681C95000BC27D8 /* SentryScopeObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryScopeObserver.h; path = include/SentryScopeObserver.h; sourceTree = ""; }; 7BCFBD6C2681D0A900BC27D8 /* SentryCrashScopeObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashScopeObserver.h; path = include/SentryCrashScopeObserver.h; sourceTree = ""; }; 7BCFBD6E2681D0EE00BC27D8 /* SentryCrashScopeObserver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashScopeObserver.m; sourceTree = ""; }; @@ -2202,6 +2198,7 @@ isa = PBXGroup; children = ( 6294774B2C6F255F00846CBC /* SentryANRTrackerV2Delegate.swift */, + 62FC18AE2C9D5FAC008803CD /* SentryANRTracker.swift */, ); path = ANR; sourceTree = ""; @@ -2910,10 +2907,8 @@ children = ( 7B127B0C27CF6F2300A71ED2 /* SentryANRTrackingIntegration.h */, 7B127B0E27CF6F4700A71ED2 /* SentryANRTrackingIntegration.m */, - 7BCFA71427D0BAB7008C662C /* SentryANRTracker.h */, - 7BCFA71527D0BB50008C662C /* SentryANRTracker.m */, - 621A9D592C64F18900B5D7D6 /* SentryANRTrackingIntegrationV2.h */, - 621A9D5B2C64F1AE00B5D7D6 /* SentryANRTrackingIntegrationV2.m */, + 7BCFA71427D0BAB7008C662C /* SentryANRTrackerV1.h */, + 7BCFA71527D0BB50008C662C /* SentryANRTrackerV1.m */, 621AE74A2C626C230012E730 /* SentryANRTrackerV2.h */, 621AE74C2C626C510012E730 /* SentryANRTrackerV2.m */, ); @@ -2923,10 +2918,9 @@ 7B2A70D627D5F06C008B0D15 /* ANR */ = { isa = PBXGroup; children = ( - 7B2A70D727D5F07F008B0D15 /* SentryANRTrackerTests.swift */, + 7B2A70D727D5F07F008B0D15 /* SentryANRTrackerV1Tests.swift */, 621AE74E2C626CF70012E730 /* SentryANRTrackerV2Tests.swift */, 7BFA69F527E0840400233199 /* SentryANRTrackingIntegrationTests.swift */, - 621A9D5D2C64F3B700B5D7D6 /* SentryANRTrackingIntegrationV2Tests.swift */, ); path = ANR; sourceTree = ""; @@ -4109,7 +4103,6 @@ 03F84D2727DD414C008FE43F /* SentryMachLogging.hpp in Headers */, 63295AF51EF3C7DB002D4490 /* SentryNSDictionarySanitize.h in Headers */, D8739D172BEEA33F007D2F66 /* SentryLevelHelper.h in Headers */, - 621A9D5A2C64F18900B5D7D6 /* SentryANRTrackingIntegrationV2.h in Headers */, 8E4A037825F6F52100000D77 /* SentrySampleDecision.h in Headers */, 63FE717920DA4C1100CDBAE8 /* SentryCrashReportStore.h in Headers */, 0AAE202128ED9BCC00D0CD80 /* SentryReachability.h in Headers */, @@ -4255,7 +4248,7 @@ 7B5CAF7127F5953400ED0DB6 /* SentryEnvelope+Private.h in Headers */, 63FE713320DA4C1100CDBAE8 /* SentryCrashCPU.h in Headers */, 6271ADF32BA06D9B0098D2E9 /* SentryInternalSerializable.h in Headers */, - D8853C842833EABC00700D64 /* SentryANRTracker.h in Headers */, + D8853C842833EABC00700D64 /* SentryANRTrackerV1.h in Headers */, 63FE715B20DA4C1100CDBAE8 /* SentryCrashSignalInfo.h in Headers */, 63FE70E520DA4C1000CDBAE8 /* SentryCrashMonitor_CPPException.h in Headers */, 7B127B0D27CF6F2300A71ED2 /* SentryANRTrackingIntegration.h in Headers */, @@ -4656,7 +4649,7 @@ 7B63459F280EBA7200CFA05A /* SentryUIEventTracker.m in Sources */, 7BF9EF782722B35D00B5BBEF /* SentrySubClassFinder.m in Sources */, D80CD8D32B751447002F710B /* SentryMXCallStackTree.swift in Sources */, - 7BCFA71627D0BB50008C662C /* SentryANRTracker.m in Sources */, + 7BCFA71627D0BB50008C662C /* SentryANRTrackerV1.m in Sources */, 8459FCC02BD73EB20038E9C9 /* SentryProfilerSerialization.mm in Sources */, 63EED6C02237923600E02400 /* SentryOptions.m in Sources */, D8CB741B2947286500A5F964 /* SentryEnvelopeItemHeader.m in Sources */, @@ -4675,7 +4668,6 @@ 8ECC674725C23A20000E2BF6 /* SentrySpanContext.m in Sources */, 7B18DE4228D9F794004845C6 /* SentryNSNotificationCenterWrapper.m in Sources */, 639FCFA91EBC80CC00778193 /* SentryFrame.m in Sources */, - 621A9D5C2C64F1AE00B5D7D6 /* SentryANRTrackingIntegrationV2.m in Sources */, D858FA672A29EAB3002A3503 /* SentryBinaryImageCache.m in Sources */, D8AFC0572BDA895400118BE1 /* UIRedactBuilder.swift in Sources */, 8E564AEA267AF22600FE117D /* SentryNetworkTracker.m in Sources */, @@ -4709,6 +4701,7 @@ 7D082B8323C628790029866B /* SentryMeta.m in Sources */, D8CAC02F2BA0663E00E38F34 /* SentryVideoInfo.swift in Sources */, 63FE710720DA4C1000CDBAE8 /* SentryCrashStackCursor_SelfThread.m in Sources */, + 62FC18AF2C9D5FAC008803CD /* SentryANRTracker.swift in Sources */, 63FE711120DA4C1000CDBAE8 /* SentryCrashDebug.c in Sources */, 7B883F49253D714C00879E62 /* SentryCrashUUIDConversion.c in Sources */, 63FE716720DA4C1100CDBAE8 /* SentryCrashCPU.c in Sources */, @@ -5095,7 +5088,7 @@ 15E0A8F0240F638200F044E3 /* SentrySerializationNilTests.m in Sources */, 0A2D8D8728992260008720F6 /* SentryBaseIntegrationTests.swift in Sources */, 7B6D135C27F4605D00331ED2 /* TestEnvelopeRateLimitDelegate.swift in Sources */, - 7B2A70D827D5F080008B0D15 /* SentryANRTrackerTests.swift in Sources */, + 7B2A70D827D5F080008B0D15 /* SentryANRTrackerV1Tests.swift in Sources */, 63FE722120DA66EC00CDBAE8 /* SentryCrashDynamicLinker_Tests.m in Sources */, 62A2F4442BA9BF08000C9FDD /* GaugeMetricTests.swift in Sources */, 63FE720120DA66EC00CDBAE8 /* RFC3339UTFString_Tests.m in Sources */, @@ -5137,7 +5130,6 @@ 7BB7E7C729267A28004BF96B /* EmptyIntegration.swift in Sources */, 7B965728268321CD00C66E25 /* SentryCrashScopeObserverTests.swift in Sources */, 626866742BA89683006995EA /* BucketMetricsAggregatorTests.swift in Sources */, - 621A9D5F2C64F3BC00B5D7D6 /* SentryANRTrackingIntegrationV2Tests.swift in Sources */, 7BD86ECB264A6DB5005439DB /* TestSysctl.swift in Sources */, D861301C2BB5A267004C0F5E /* SentrySessionReplayTests.swift in Sources */, 7B0DC73428869BF40039995F /* NSMutableDictionarySentryTests.swift in Sources */, diff --git a/Sources/Sentry/SentryANRTracker.m b/Sources/Sentry/SentryANRTrackerV1.m similarity index 98% rename from Sources/Sentry/SentryANRTracker.m rename to Sources/Sentry/SentryANRTrackerV1.m index a374fcc0953..8c8365a504f 100644 --- a/Sources/Sentry/SentryANRTracker.m +++ b/Sources/Sentry/SentryANRTrackerV1.m @@ -1,4 +1,4 @@ -#import "SentryANRTracker.h" +#import "SentryANRTrackerV1.h" #import "SentryCrashWrapper.h" #import "SentryDependencyContainer.h" #import "SentryDispatchQueueWrapper.h" @@ -16,7 +16,7 @@ typedef NS_ENUM(NSInteger, SentryANRTrackerState) { kSentryANRTrackerStopping }; -@interface SentryANRTracker () +@interface SentryANRTrackerV1 () @property (nonatomic, strong) SentryCrashWrapper *crashWrapper; @property (nonatomic, strong) SentryDispatchQueueWrapper *dispatchQueueWrapper; @@ -26,7 +26,7 @@ @interface SentryANRTracker () @end -@implementation SentryANRTracker { +@implementation SentryANRTrackerV1 { NSObject *threadLock; SentryANRTrackerState state; } diff --git a/Sources/Sentry/SentryANRTrackingIntegration.m b/Sources/Sentry/SentryANRTrackingIntegration.m index dd4b50b7f94..35fa65cb1fd 100644 --- a/Sources/Sentry/SentryANRTrackingIntegration.m +++ b/Sources/Sentry/SentryANRTrackingIntegration.m @@ -1,5 +1,4 @@ #import "SentryANRTrackingIntegration.h" -#import "SentryANRTracker.h" #import "SentryClient+Private.h" #import "SentryCrashMachineContext.h" #import "SentryCrashWrapper.h" @@ -12,6 +11,7 @@ #import "SentryMechanism.h" #import "SentrySDK+Private.h" #import "SentryStacktrace.h" +#import "SentrySwift.h" #import "SentryThread.h" #import "SentryThreadInspector.h" #import "SentryThreadWrapper.h" @@ -26,7 +26,7 @@ @interface SentryANRTrackingIntegration () -@property (nonatomic, strong) SentryANRTracker *tracker; +@property (nonatomic, strong) id tracker; @property (nonatomic, strong) SentryOptions *options; @property (atomic, assign) BOOL reportAppHangs; @@ -41,7 +41,7 @@ - (BOOL)installWithOptions:(SentryOptions *)options } self.tracker = - [SentryDependencyContainer.sharedInstance getANRTracker:options.appHangTimeoutInterval]; + [SentryDependencyContainer.sharedInstance getANRTrackerV1:options.appHangTimeoutInterval]; [self.tracker addListener:self]; self.options = options; diff --git a/Sources/Sentry/SentryANRTrackingIntegrationV2.m b/Sources/Sentry/SentryANRTrackingIntegrationV2.m deleted file mode 100644 index aeef925c895..00000000000 --- a/Sources/Sentry/SentryANRTrackingIntegrationV2.m +++ /dev/null @@ -1,130 +0,0 @@ -#import "SentryANRTrackingIntegrationV2.h" - -#if SENTRY_HAS_UIKIT - -# import "SentryANRTrackerV2.h" -# import "SentryClient+Private.h" -# import "SentryCrashMachineContext.h" -# import "SentryCrashWrapper.h" -# import "SentryDependencyContainer.h" -# import "SentryDispatchQueueWrapper.h" -# import "SentryEvent.h" -# import "SentryException.h" -# import "SentryHub+Private.h" -# import "SentryLog.h" -# import "SentryMechanism.h" -# import "SentrySDK+Private.h" -# import "SentryStacktrace.h" -# import "SentryThread.h" -# import "SentryThreadInspector.h" -# import "SentryThreadWrapper.h" -# import "SentryUIApplication.h" -# import -# import - -NS_ASSUME_NONNULL_BEGIN - -@interface SentryANRTrackingIntegrationV2 () - -@property (nonatomic, strong) SentryANRTrackerV2 *tracker; -@property (nonatomic, strong) SentryOptions *options; -@property (atomic, assign) BOOL reportAppHangs; - -@end - -@implementation SentryANRTrackingIntegrationV2 - -- (BOOL)installWithOptions:(SentryOptions *)options -{ - if (![super installWithOptions:options]) { - return NO; - } - - self.tracker = - [SentryDependencyContainer.sharedInstance getANRTrackerV2:options.appHangTimeoutInterval]; - - [self.tracker addListener:self]; - self.options = options; - self.reportAppHangs = YES; - - return YES; -} - -- (SentryIntegrationOption)integrationOptions -{ - return kIntegrationOptionEnableAppHangTrackingV2 | kIntegrationOptionDebuggerNotAttached; -} - -- (void)pauseAppHangTracking -{ - self.reportAppHangs = NO; -} - -- (void)resumeAppHangTracking -{ - self.reportAppHangs = YES; -} - -- (void)uninstall -{ - [self.tracker removeListener:self]; -} - -- (void)dealloc -{ - [self uninstall]; -} - -- (void)anrDetectedWithType:(enum SentryANRType)type -{ - if (self.reportAppHangs == NO) { - SENTRY_LOG_DEBUG(@"AppHangTracking paused. Ignoring reported app hang.") - return; - } - - // If the app is not active, the main thread may be blocked or too busy. - // Since there is no UI for the user to interact, there is no need to report app hang. - if (SentryDependencyContainer.sharedInstance.application.applicationState - != UIApplicationStateActive) { - return; - } - - SentryThreadInspector *threadInspector = SentrySDK.currentHub.getClient.threadInspector; - - NSArray *threads = [threadInspector getCurrentThreadsWithStackTrace]; - - if (threads.count == 0) { - SENTRY_LOG_WARN(@"Getting current thread returned an empty list. Can't create AppHang " - @"event without a stacktrace."); - return; - } - - NSString *message = [NSString stringWithFormat:@"App hanging for at least %li ms.", - (long)(self.options.appHangTimeoutInterval * 1000)]; - SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentryLevelError]; - SentryException *sentryException = - [[SentryException alloc] initWithValue:message type:SentryANRExceptionTypeV2]; - - sentryException.mechanism = [[SentryMechanism alloc] initWithType:@"AppHang"]; - sentryException.stacktrace = [threads[0] stacktrace]; - sentryException.stacktrace.snapshot = @(YES); - - [threads enumerateObjectsUsingBlock:^(SentryThread *_Nonnull obj, NSUInteger idx, - BOOL *_Nonnull stop) { obj.current = [NSNumber numberWithBool:idx == 0]; }]; - - event.exceptions = @[ sentryException ]; - event.threads = threads; - - [SentrySDK captureEvent:event]; -} - -- (void)anrStopped -{ - // We dont report when an ANR ends. -} - -@end - -NS_ASSUME_NONNULL_END - -#endif // SENTRY_HAS_UIKIT diff --git a/Sources/Sentry/SentryDependencyContainer.m b/Sources/Sentry/SentryDependencyContainer.m index 50256a2ac33..7d32483cad3 100644 --- a/Sources/Sentry/SentryDependencyContainer.m +++ b/Sources/Sentry/SentryDependencyContainer.m @@ -1,4 +1,4 @@ -#import "SentryANRTracker.h" +#import "SentryANRTrackerV1.h" #import "SentryANRTrackerV2.h" #import "SentryBinaryImageCache.h" #import "SentryDispatchFactory.h" @@ -348,22 +348,22 @@ - (SentrySwizzleWrapper *)swizzleWrapper SENTRY_DISABLE_THREAD_SANITIZER( } #endif // SENTRY_UIKIT_AVAILABLE -- (SentryANRTracker *)getANRTracker:(NSTimeInterval)timeout +- (SentryANRTrackerV1 *)getANRTrackerV1:(NSTimeInterval)timeout SENTRY_DISABLE_THREAD_SANITIZER("double-checked lock produce false alarms") { - if (_anrTracker == nil) { + if (_anrTrackerV1 == nil) { @synchronized(sentryDependencyContainerLock) { - if (_anrTracker == nil) { - _anrTracker = - [[SentryANRTracker alloc] initWithTimeoutInterval:timeout - crashWrapper:self.crashWrapper - dispatchQueueWrapper:self.dispatchQueueWrapper - threadWrapper:self.threadWrapper]; + if (_anrTrackerV1 == nil) { + _anrTrackerV1 = + [[SentryANRTrackerV1 alloc] initWithTimeoutInterval:timeout + crashWrapper:self.crashWrapper + dispatchQueueWrapper:self.dispatchQueueWrapper + threadWrapper:self.threadWrapper]; } } } - return _anrTracker; + return _anrTrackerV1; } - (SentryNSProcessInfoWrapper *)processInfoWrapper SENTRY_DISABLE_THREAD_SANITIZER( diff --git a/Sources/Sentry/SentryOptions.m b/Sources/Sentry/SentryOptions.m index a7fad532cce..b0da7a19088 100644 --- a/Sources/Sentry/SentryOptions.m +++ b/Sources/Sentry/SentryOptions.m @@ -1,4 +1,3 @@ -#import "SentryANRTracker.h" #import "SentryANRTrackingIntegration.h" #import "SentryAutoBreadcrumbTrackingIntegration.h" #import "SentryAutoSessionTrackingIntegration.h" diff --git a/Sources/Sentry/SentryWatchdogTerminationTrackingIntegration.m b/Sources/Sentry/SentryWatchdogTerminationTrackingIntegration.m index a4497c35dbd..850530b12d2 100644 --- a/Sources/Sentry/SentryWatchdogTerminationTrackingIntegration.m +++ b/Sources/Sentry/SentryWatchdogTerminationTrackingIntegration.m @@ -3,6 +3,7 @@ #if SENTRY_HAS_UIKIT # import "SentryScope+Private.h" +# import # import # import # import @@ -12,6 +13,7 @@ # import # import # import +# import # import # import # import @@ -21,7 +23,7 @@ @interface SentryWatchdogTerminationTrackingIntegration () @property (nonatomic, strong) SentryWatchdogTerminationTracker *tracker; -@property (nonatomic, strong) SentryANRTracker *anrTracker; +@property (nonatomic, strong) id anrTracker; @property (nullable, nonatomic, copy) NSString *testConfigurationFilePath; @property (nonatomic, strong) SentryAppStateManager *appStateManager; @@ -72,7 +74,7 @@ - (BOOL)installWithOptions:(SentryOptions *)options [self.tracker start]; self.anrTracker = - [SentryDependencyContainer.sharedInstance getANRTracker:options.appHangTimeoutInterval]; + [SentryDependencyContainer.sharedInstance getANRTrackerV1:options.appHangTimeoutInterval]; [self.anrTracker addListener:self]; self.appStateManager = appStateManager; diff --git a/Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h b/Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h index f36e8d2e9e0..e9e817f1aa5 100644 --- a/Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h +++ b/Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h @@ -1,6 +1,6 @@ #import "SentryDefines.h" -@class SentryANRTracker; +@class SentryANRTrackerV1; @class SentryANRTrackerV2; @class SentryAppStateManager; @class SentryBinaryImageCache; @@ -63,7 +63,7 @@ SENTRY_NO_INIT @property (nonatomic, strong) SentryDispatchQueueWrapper *dispatchQueueWrapper; @property (nonatomic, strong) SentryNSNotificationCenterWrapper *notificationCenterWrapper; @property (nonatomic, strong) SentryDebugImageProvider *debugImageProvider; -@property (nonatomic, strong) SentryANRTracker *anrTracker; +@property (nonatomic, strong) SentryANRTrackerV1 *anrTrackerV1; @property (nonatomic, strong) SentryANRTrackerV2 *anrTrackerV2; @property (nonatomic, strong) SentryNSProcessInfoWrapper *processInfoWrapper; @property (nonatomic, strong) SentrySystemWrapper *systemWrapper; @@ -90,7 +90,7 @@ SENTRY_NO_INIT @property (nonatomic, strong) SentryReachability *reachability; #endif // !TARGET_OS_WATCH -- (SentryANRTracker *)getANRTracker:(NSTimeInterval)timeout; +- (SentryANRTrackerV1 *)getANRTrackerV1:(NSTimeInterval)timeout; #if SENTRY_UIKIT_AVAILABLE - (SentryANRTrackerV2 *)getANRTrackerV2:(NSTimeInterval)timeout; #endif // SENTRY_UIKIT_AVAILABLE diff --git a/Sources/Sentry/include/SentryANRTracker.h b/Sources/Sentry/include/SentryANRTrackerV1.h similarity index 88% rename from Sources/Sentry/include/SentryANRTracker.h rename to Sources/Sentry/include/SentryANRTrackerV1.h index 99b742f9394..3e53021d577 100644 --- a/Sources/Sentry/include/SentryANRTracker.h +++ b/Sources/Sentry/include/SentryANRTrackerV1.h @@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN * seconds, and it executes all events in time. Instead, what matters is how long the main thread * needs to execute a newly added event to the run loop. */ -@interface SentryANRTracker : NSObject +@interface SentryANRTrackerV1 : NSObject SENTRY_NO_INIT - (instancetype)initWithTimeoutInterval:(NSTimeInterval)timeoutInterval @@ -29,13 +29,6 @@ SENTRY_NO_INIT dispatchQueueWrapper:(SentryDispatchQueueWrapper *)dispatchQueueWrapper threadWrapper:(SentryThreadWrapper *)threadWrapper; -- (void)addListener:(id)listener; - -- (void)removeListener:(id)listener; - -// Function used for tests -- (void)clear; - @end NS_ASSUME_NONNULL_END diff --git a/Sources/Sentry/include/SentryANRTrackerV2.h b/Sources/Sentry/include/SentryANRTrackerV2.h index a8ad0cff598..cf3bc3d8762 100644 --- a/Sources/Sentry/include/SentryANRTrackerV2.h +++ b/Sources/Sentry/include/SentryANRTrackerV2.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN * seconds, it can still respond to user input to navigate to a different screen, for example. In * that scenario, the frame delay is around 97%. */ -@interface SentryANRTrackerV2 : NSObject +@interface SentryANRTrackerV2 : NSObject SENTRY_NO_INIT - (instancetype)initWithTimeoutInterval:(NSTimeInterval)timeoutInterval @@ -29,13 +29,6 @@ SENTRY_NO_INIT threadWrapper:(SentryThreadWrapper *)threadWrapper framesTracker:(SentryFramesTracker *)framesTracker; -- (void)addListener:(id)listener; - -- (void)removeListener:(id)listener; - -// Function used for tests -- (void)clear; - @end NS_ASSUME_NONNULL_END diff --git a/Sources/Sentry/include/SentryANRTrackingIntegration.h b/Sources/Sentry/include/SentryANRTrackingIntegration.h index b71c18c5a1a..84a41cccf1f 100644 --- a/Sources/Sentry/include/SentryANRTrackingIntegration.h +++ b/Sources/Sentry/include/SentryANRTrackingIntegration.h @@ -1,4 +1,4 @@ -#import "SentryANRTracker.h" +#import "SentryANRTrackerV1.h" #import "SentryBaseIntegration.h" #import "SentrySwift.h" #import diff --git a/Sources/Sentry/include/SentryANRTrackingIntegrationV2.h b/Sources/Sentry/include/SentryANRTrackingIntegrationV2.h deleted file mode 100644 index 1b2e39e4655..00000000000 --- a/Sources/Sentry/include/SentryANRTrackingIntegrationV2.h +++ /dev/null @@ -1,23 +0,0 @@ -#import "SentryANRTrackerV2.h" - -#if SENTRY_HAS_UIKIT - -# import "SentryBaseIntegration.h" -# import "SentrySwift.h" -# import - -NS_ASSUME_NONNULL_BEGIN - -static NSString *const SentryANRExceptionTypeV2 = @"App Hanging"; - -@interface SentryANRTrackingIntegrationV2 - : SentryBaseIntegration - -- (void)pauseAppHangTracking; -- (void)resumeAppHangTracking; - -@end - -NS_ASSUME_NONNULL_END - -#endif // SENTRY_HAS_UIKIT diff --git a/Sources/Sentry/include/SentryWatchdogTerminationTrackingIntegration.h b/Sources/Sentry/include/SentryWatchdogTerminationTrackingIntegration.h index 7b39715a97e..97412905aea 100644 --- a/Sources/Sentry/include/SentryWatchdogTerminationTrackingIntegration.h +++ b/Sources/Sentry/include/SentryWatchdogTerminationTrackingIntegration.h @@ -1,8 +1,6 @@ #import "SentryDefines.h" #if SENTRY_HAS_UIKIT - -# import "SentryANRTracker.h" # import "SentryBaseIntegration.h" # import "SentrySwift.h" # import diff --git a/Sources/Swift/Integrations/ANR/SentryANRTracker.swift b/Sources/Swift/Integrations/ANR/SentryANRTracker.swift new file mode 100644 index 00000000000..d850a1276cd --- /dev/null +++ b/Sources/Swift/Integrations/ANR/SentryANRTracker.swift @@ -0,0 +1,12 @@ +import Foundation + +@objc +protocol SentryANRTracker { + @objc(addListener:) + func add(listener: SentryANRTrackerDelegate) + @objc(removeListener:) + func remove(listener: SentryANRTrackerDelegate) + + /// Only used for tests. + func clear() +} diff --git a/Tests/SentryTests/Integrations/ANR/SentryANRTrackerTests.swift b/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV1Tests.swift similarity index 94% rename from Tests/SentryTests/Integrations/ANR/SentryANRTrackerTests.swift rename to Tests/SentryTests/Integrations/ANR/SentryANRTrackerV1Tests.swift index 4f5cb7341f4..032eb0a0e31 100644 --- a/Tests/SentryTests/Integrations/ANR/SentryANRTrackerTests.swift +++ b/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV1Tests.swift @@ -3,7 +3,7 @@ import SentryTestUtils import XCTest #if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) -class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { +class SentryANRTrackerV1Tests: XCTestCase, SentryANRTrackerDelegate { private var sut: SentryANRTracker! private var fixture: Fixture! @@ -33,7 +33,7 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { fixture = Fixture() - sut = SentryANRTracker( + sut = SentryANRTrackerV1( timeoutInterval: fixture.timeoutInterval, crashWrapper: fixture.crashWrapper, dispatchQueueWrapper: fixture.dispatchQueue, @@ -50,7 +50,7 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { } func start() { - sut.addListener(self) + sut.add(listener: self) } func testContinuousANR_OneReported() { @@ -70,7 +70,7 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { } let secondListener = SentryANRTrackerTestDelegate() - sut.addListener(secondListener) + sut.add(listener: secondListener) start() @@ -134,7 +134,7 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { let mainBlockExpectation = expectation(description: "Main Block") fixture.dispatchQueue.blockBeforeMainBlock = { - self.sut.removeListener(self) + self.sut.remove(listener: self) mainBlockExpectation.fulfill() return true } @@ -160,7 +160,7 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { return true } - sut.addListener(secondListener) + sut.add(listener: secondListener) start() wait(for: [anrDetectedExpectation, anrStoppedExpectation, mainBlockExpectation, secondListener.anrStoppedExpectation, secondListener.anrDetectedExpectation], timeout: waitTimeout) @@ -174,13 +174,13 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { let addListenersCount = 10 func addListeners() { for _ in 0.. @@ -194,7 +194,7 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { let invocations = 10 for _ in 0.. (SentryANRTrackerV2, TestCurrentDateProvider, TestDisplayLinkWrapper, TestSentryCrashWrapper, SentryTestThreadWrapper, SentryFramesTracker) { + private func getSut() throws -> (SentryANRTracker, TestCurrentDateProvider, TestDisplayLinkWrapper, TestSentryCrashWrapper, SentryTestThreadWrapper, SentryFramesTracker) { let currentDate = TestCurrentDateProvider() let crashWrapper = TestSentryCrashWrapper.sharedInstance() @@ -60,7 +60,7 @@ class SentryANRTrackerV2Tests: XCTestCase { defer { sut.clear() } let listener = SentryANRTrackerV2TestDelegate() - sut.addListener(listener) + sut.add(listener: listener) // The app must hang for slightly over the timeoutInterval to report an app hang var advanced = 0.0 @@ -91,7 +91,7 @@ class SentryANRTrackerV2Tests: XCTestCase { let listener = SentryANRTrackerV2TestDelegate() - sut.addListener(listener) + sut.add(listener: listener) triggerNonFullyBlockingAppHang(displayLinkWrapper) @@ -114,7 +114,7 @@ class SentryANRTrackerV2Tests: XCTestCase { let listener = SentryANRTrackerV2TestDelegate(shouldANRBeDetected: false, shouldStoppedBeCalled: false) - sut.addListener(listener) + sut.add(listener: listener) displayLinkWrapper.frameWith(delay: 0.7) displayLinkWrapper.frameWith(delay: 0.7) @@ -136,7 +136,7 @@ class SentryANRTrackerV2Tests: XCTestCase { let listener = SentryANRTrackerV2TestDelegate(shouldANRBeDetected: false, shouldStoppedBeCalled: false) - sut.addListener(listener) + sut.add(listener: listener) for _ in 0..<100 { displayLinkWrapper.normalFrame() @@ -162,7 +162,7 @@ class SentryANRTrackerV2Tests: XCTestCase { let listener = SentryANRTrackerV2TestDelegate() - sut.addListener(listener) + sut.add(listener: listener) triggerFullyBlockingAppHang(dateProvider) @@ -188,12 +188,12 @@ class SentryANRTrackerV2Tests: XCTestCase { let firstListener = SentryANRTrackerV2TestDelegate() firstListener.anrDetectedExpectation.expectedFulfillmentCount = 2 firstListener.anrStoppedExpectation.expectedFulfillmentCount = 2 - sut.addListener(firstListener) + sut.add(listener: firstListener) let secondListener = SentryANRTrackerV2TestDelegate() secondListener.anrDetectedExpectation.assertForOverFulfill = false secondListener.anrStoppedExpectation.assertForOverFulfill = false - sut.addListener(secondListener) + sut.add(listener: secondListener) triggerFullyBlockingAppHang(currentDate) @@ -204,7 +204,7 @@ class SentryANRTrackerV2Tests: XCTestCase { wait(for: [secondListener.anrStoppedExpectation], timeout: waitTimeout) let thirdListener = SentryANRTrackerV2TestDelegate() - sut.addListener(thirdListener) + sut.add(listener: thirdListener) triggerFullyBlockingAppHang(currentDate) @@ -227,10 +227,10 @@ class SentryANRTrackerV2Tests: XCTestCase { defer { sut.clear() } let firstListener = SentryANRTrackerV2TestDelegate() - sut.addListener(firstListener) + sut.add(listener: firstListener) let secondListener = SentryANRTrackerV2TestDelegate() - sut.addListener(secondListener) + sut.add(listener: secondListener) triggerFullyBlockingAppHang(currentDate) triggerFullyBlockingAppHang(currentDate) @@ -239,7 +239,7 @@ class SentryANRTrackerV2Tests: XCTestCase { wait(for: [secondListener.anrDetectedExpectation], timeout: waitTimeout) let thirdListener = SentryANRTrackerV2TestDelegate(shouldANRBeDetected: false) - sut.addListener(thirdListener) + sut.add(listener: thirdListener) renderNormalFramesToStopAppHang(displayLinkWrapper) @@ -252,10 +252,10 @@ class SentryANRTrackerV2Tests: XCTestCase { let firstListener = SentryANRTrackerV2TestDelegate() - sut.addListener(firstListener) + sut.add(listener: firstListener) let secondListener = SentryANRTrackerV2TestDelegate() - sut.addListener(secondListener) + sut.add(listener: secondListener) triggerFullyBlockingAppHang(currentDate) @@ -274,7 +274,7 @@ class SentryANRTrackerV2Tests: XCTestCase { let listener = SentryANRTrackerV2TestDelegate(shouldANRBeDetected: false, shouldStoppedBeCalled: false) - sut.addListener(listener) + sut.add(listener: listener) triggerFullyBlockingAppHang(currentDate) @@ -297,7 +297,7 @@ class SentryANRTrackerV2Tests: XCTestCase { currentDate.setDate(date: currentDate.date().addingTimeInterval(delta)) } - sut.addListener(listener) + sut.add(listener: listener) triggerFullyBlockingAppHang(currentDate) @@ -313,13 +313,13 @@ class SentryANRTrackerV2Tests: XCTestCase { let mainBlockExpectation = expectation(description: "Main Block") threadWrapper.blockWhenSleeping = { - sut.removeListener(listener) + sut.remove(listener: listener) mainBlockExpectation.fulfill() } triggerFullyBlockingAppHang(currentDate) - sut.addListener(listener) + sut.add(listener: listener) wait(for: [listener.anrDetectedExpectation, listener.anrStoppedExpectation, mainBlockExpectation], timeout: waitTimeout) } @@ -341,8 +341,8 @@ class SentryANRTrackerV2Tests: XCTestCase { mainBlockExpectation.fulfill() } - sut.addListener(secondListener) - sut.addListener(firstListener) + sut.add(listener: secondListener) + sut.add(listener: firstListener) triggerFullyBlockingAppHang(currentDate) @@ -359,13 +359,13 @@ class SentryANRTrackerV2Tests: XCTestCase { let addListenersCount = 10 func addListeners() { for _ in 0.. diff --git a/Tests/SentryTests/Integrations/ANR/SentryANRTrackingIntegrationV2Tests.swift b/Tests/SentryTests/Integrations/ANR/SentryANRTrackingIntegrationV2Tests.swift deleted file mode 100644 index 5dfbfdede6b..00000000000 --- a/Tests/SentryTests/Integrations/ANR/SentryANRTrackingIntegrationV2Tests.swift +++ /dev/null @@ -1,234 +0,0 @@ -@testable import _SentryPrivate -@testable import Sentry -import SentryTestUtils -import XCTest - -#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) -class SentryANRTrackingIntegrationV2Tests: SentrySDKIntegrationTestsBase { - - private class Fixture { - let options: Options - - let currentDate = TestCurrentDateProvider() - - init() { - options = Options() - options.enableAppHangTrackingV2 = true - options.appHangTimeoutInterval = 4.5 - } - } - - private var fixture: Fixture! - private var sut: SentryANRTrackingIntegrationV2! - - override var options: Options { - self.fixture.options - } - - override func setUp() { - super.setUp() - fixture = Fixture() - } - - override func tearDown() { - sut?.uninstall() - clearTestState() - super.tearDown() - } - - func testWhenBeingTraced_TrackerNotInitialized() { - givenInitializedTracker(isBeingTraced: true) - XCTAssertNil(Dynamic(sut).tracker.asAnyObject) - } - - func testWhenNoDebuggerAttached_TrackerInitialized() { - givenInitializedTracker() - XCTAssertNotNil(Dynamic(sut).tracker.asAnyObject) - } - - func test_enableAppHangsTracking_Disabled() { - let options = Options() - options.enableAppHangTracking = false - - sut = SentryANRTrackingIntegrationV2() - let result = sut.install(with: options) - - XCTAssertFalse(result) - } - - func test_appHangsTimeoutInterval_Zero() { - let options = Options() - options.enableAppHangTracking = true - options.appHangTimeoutInterval = 0 - - sut = SentryANRTrackingIntegrationV2() - let result = sut.install(with: options) - - XCTAssertFalse(result) - } - - func testANRDetected_EventCaptured() throws { - givenInitializedTracker() - setUpThreadInspector() - - Dynamic(sut).anrDetectedWithType(SentryANRType.fullyBlocking) - - try assertEventWithScopeCaptured { event, _, _ in - XCTAssertNotNil(event) - guard let ex = event?.exceptions?.first else { - XCTFail("ANR Exception not found") - return - } - - XCTAssertEqual(ex.mechanism?.type, "AppHang") - XCTAssertEqual(ex.type, "App Hanging") - XCTAssertEqual(ex.value, "App hanging for at least 4500 ms.") - XCTAssertNotNil(ex.stacktrace) - XCTAssertEqual(ex.stacktrace?.frames.first?.function, "main") - XCTAssertEqual(ex.stacktrace?.snapshot?.boolValue, true) - XCTAssertEqual(try XCTUnwrap(event?.threads?.first).current?.boolValue, true) - XCTAssertEqual(event?.isAppHangEvent, true) - - guard let threads = event?.threads else { - XCTFail("ANR Exception not found") - return - } - - // Sometimes during tests its possible to have one thread without frames - // We just need to make sure we retrieve frame information for at least one other thread than the main thread - let threadsWithFrames = threads.filter { - ($0.stacktrace?.frames.count ?? 0) >= 1 - }.count - - XCTAssertTrue(threadsWithFrames > 1, "Not enough threads with frames") - } - } - - func testANRDetected_DetectingPaused_NoEventCaptured() { - givenInitializedTracker() - setUpThreadInspector() - sut.pauseAppHangTracking() - - Dynamic(sut).anrDetectedWithType(SentryANRType.fullyBlocking) - - assertNoEventCaptured() - } - - func testANRDetected_DetectingPausedResumed_EventCaptured() throws { - givenInitializedTracker() - setUpThreadInspector() - sut.pauseAppHangTracking() - sut.resumeAppHangTracking() - - Dynamic(sut).anrDetectedWithType(SentryANRType.fullyBlocking) - - try assertEventWithScopeCaptured { event, _, _ in - XCTAssertNotNil(event) - guard let ex = event?.exceptions?.first else { - XCTFail("ANR Exception not found") - return - } - - XCTAssertEqual(ex.mechanism?.type, "AppHang") - } - } - - func testCallPauseResumeOnMultipleThreads_DoesNotCrash() { - givenInitializedTracker() - - testConcurrentModifications(asyncWorkItems: 100, writeLoopCount: 10, writeWork: {_ in - self.sut.pauseAppHangTracking() - Dynamic(self.sut).anrDetectedWithType(SentryANRType.fullyBlocking) - }, readWork: { - self.sut.resumeAppHangTracking() - Dynamic(self.sut).anrDetectedWithType(SentryANRType.fullyBlocking) - }) - } - - func testANRDetected_ButNoThreads_EventNotCaptured() { - givenInitializedTracker() - setUpThreadInspector(addThreads: false) - - Dynamic(sut).anrDetectedWithType(SentryANRType.fullyBlocking) - - assertNoEventCaptured() - } -#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) - func testANRDetected_ButBackground_EventNotCaptured() { - - class BackgroundSentryUIApplication: SentryUIApplication { - override var applicationState: UIApplication.State { .background } - } - - givenInitializedTracker() - setUpThreadInspector() - SentryDependencyContainer.sharedInstance().application = BackgroundSentryUIApplication() - - Dynamic(sut).anrDetectedWithType(SentryANRType.fullyBlocking) - - assertNoEventCaptured() - } -#endif - - func testDealloc_CallsUninstall() { - givenInitializedTracker() - - // // So ARC deallocates the SentryANRTrackingIntegration - func initIntegration() { - self.crashWrapper.internalIsBeingTraced = false - let sut = SentryANRTrackingIntegration() - sut.install(with: self.options) - } - - initIntegration() - - let tracker = SentryDependencyContainer.sharedInstance().getANRTrackerV2(self.options.appHangTimeoutInterval) - - let listeners = Dynamic(tracker).listeners.asObject as? NSHashTable - - XCTAssertEqual(1, listeners?.count ?? 2) - } - - func testEventIsNotANR() { - XCTAssertFalse(Event().isAppHangEvent) - } - - private func givenInitializedTracker(isBeingTraced: Bool = false) { - givenSdkWithHub() - self.crashWrapper.internalIsBeingTraced = isBeingTraced - sut = SentryANRTrackingIntegrationV2() - sut.install(with: self.options) - } - - private func setUpThreadInspector(addThreads: Bool = true) { - let threadInspector = TestThreadInspector.instance - - if addThreads { - - let frame1 = Sentry.Frame() - frame1.function = "Second_frame_function" - - let thread1 = SentryThread(threadId: 0) - thread1.stacktrace = SentryStacktrace(frames: [frame1], registers: [:]) - thread1.current = true - - let frame2 = Sentry.Frame() - frame2.function = "main" - - let thread2 = SentryThread(threadId: 1) - thread2.stacktrace = SentryStacktrace(frames: [frame2], registers: [:]) - thread2.current = false - - threadInspector.allThreads = [ - thread2, - thread1 - ] - } else { - threadInspector.allThreads = [] - } - - SentrySDK.currentHub().getClient()?.threadInspector = threadInspector - } -} - -#endif // os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) diff --git a/Tests/SentryTests/SentryTests-Bridging-Header.h b/Tests/SentryTests/SentryTests-Bridging-Header.h index 5b8265c9863..e1cf2086be3 100644 --- a/Tests/SentryTests/SentryTests-Bridging-Header.h +++ b/Tests/SentryTests/SentryTests-Bridging-Header.h @@ -44,10 +44,9 @@ #import "NSMutableDictionary+Sentry.h" #import "PrivateSentrySDKOnly.h" #import "Sentry/Sentry-Swift.h" -#import "SentryANRTracker.h" +#import "SentryANRTrackerV1.h" #import "SentryANRTrackerV2.h" #import "SentryANRTrackingIntegration.h" -#import "SentryANRTrackingIntegrationV2.h" #import "SentryAppStartMeasurement.h" #import "SentryAppStartTracker.h" #import "SentryAppStartTrackingIntegration.h" From f3c07466b47f761ba5f49136000e357bcd65f038 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 30 Sep 2024 16:14:36 +0200 Subject: [PATCH 02/10] ci: Remove benchmarking schedule (#4378) Remove running the benchmarks at midnight, because nobody takes a look at the data. --- .github/workflows/benchmarking.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/benchmarking.yml b/.github/workflows/benchmarking.yml index 0897087e50a..7290089557c 100644 --- a/.github/workflows/benchmarking.yml +++ b/.github/workflows/benchmarking.yml @@ -1,7 +1,5 @@ name: Benchmarking on: - schedule: - - cron: '0 0 * * *' # every night at midnight UTC push: branches: - main From a3ce1a9c3108a71762d314e0964442d3f3983ab3 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 30 Sep 2024 16:41:56 +0200 Subject: [PATCH 03/10] impr: Stop canceling timer for manual transactions (#4380) Avoid canceling the deadline timer on the main thread when there is no deadline timer when finishing a transaction. --- CHANGELOG.md | 1 + Sources/Sentry/SentryTracer.m | 4 ++++ .../SentryTests/Transaction/SentryTracerTests.swift | 12 ++++++++++++ 3 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 847b582ecd5..4cfd03f3b23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Speed up HTTP tracking for multiple requests in parallel (#4366) - Slightly speed up SentryInAppLogic (#4370) +- Stop canceling timer for manual transactions (#4380) ## 8.37.0-beta.1 diff --git a/Sources/Sentry/SentryTracer.m b/Sources/Sentry/SentryTracer.m index 0e3f0d5a166..1a7b7e72629 100644 --- a/Sources/Sentry/SentryTracer.m +++ b/Sources/Sentry/SentryTracer.m @@ -307,6 +307,10 @@ - (void)deadlineTimerFired - (void)cancelDeadlineTimer { + if (self.deadlineTimer == nil) { + return; + } + // If the main thread is busy the tracer could be deallocated in between. __weak SentryTracer *weakSelf = self; diff --git a/Tests/SentryTests/Transaction/SentryTracerTests.swift b/Tests/SentryTests/Transaction/SentryTracerTests.swift index 7eb3c73e2bf..207d08043ac 100644 --- a/Tests/SentryTests/Transaction/SentryTracerTests.swift +++ b/Tests/SentryTests/Transaction/SentryTracerTests.swift @@ -349,6 +349,18 @@ class SentryTracerTests: XCTestCase { fixture.timerFactory.fire() } + + func testDeadlineTimerForManualTransaction_NoWorkQueuedOnMainQueue() { + let sut = fixture.getSut(waitForChildren: false, idleTimeout: 0.0) + + let invocationsBeforeFinish = fixture.dispatchQueue.blockOnMainInvocations.count + + sut.finish() + + let invocationsAfterFinish = fixture.dispatchQueue.blockOnMainInvocations.count + + XCTAssertEqual(invocationsBeforeFinish, invocationsAfterFinish) + } func testFramesofSpans_SetsDebugMeta() { let sut = fixture.getSut() From 81c218773ab43837a3f510e34f426197b60c748d Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Mon, 30 Sep 2024 16:50:52 -0800 Subject: [PATCH 04/10] chore: add first pre-commit hook to check tool versions (#4374) --- .gitignore | 1 - .pre-commit-config.yaml | 11 ++ Brewfile | 1 + Brewfile.lock.json | 296 ++++++++++++++++++++++++++++++ Makefile | 11 +- scripts/check-tooling-versions.sh | 17 ++ 6 files changed, 330 insertions(+), 7 deletions(-) create mode 100644 Brewfile.lock.json create mode 100755 scripts/check-tooling-versions.sh diff --git a/.gitignore b/.gitignore index 81ba39c9c87..4773a516c44 100644 --- a/.gitignore +++ b/.gitignore @@ -81,4 +81,3 @@ Package.resolved Cartfile.resolved *.log -Brewfile.lock.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f78f886f7fb..7a5a5fdb7d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,17 @@ ## You can find more hooks here https://pre-commit.com/hooks.html repos: + - repo: local + hooks: + - id: check-versions + name: Check development environment tooling versions + entry: make + language: system + types_or: ["swift", "objective-c", "objective-c++", "c", "c++" ] + fail_fast: true + args: + - "check-versions" + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: diff --git a/Brewfile b/Brewfile index 64eeca91273..8ffcfe6e9b8 100644 --- a/Brewfile +++ b/Brewfile @@ -4,3 +4,4 @@ brew 'carthage' brew 'rbenv' brew 'pre-commit' brew 'python3' +brew 'jq' diff --git a/Brewfile.lock.json b/Brewfile.lock.json new file mode 100644 index 00000000000..5542cf946d0 --- /dev/null +++ b/Brewfile.lock.json @@ -0,0 +1,296 @@ +{ + "entries": { + "brew": { + "clang-format": { + "version": "19.1.0", + "bottle": { + "rebuild": 0, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_sequoia": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:fd9f55ce1e7070804eedd3714d6bdcc51d603d5a485dc9bae070e8c61a40c7ba", + "sha256": "fd9f55ce1e7070804eedd3714d6bdcc51d603d5a485dc9bae070e8c61a40c7ba" + }, + "arm64_sonoma": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:7430daa8b4ed88ad80c6224a1529d9ca11a192bcc24f9056be4b0797256592ae", + "sha256": "7430daa8b4ed88ad80c6224a1529d9ca11a192bcc24f9056be4b0797256592ae" + }, + "arm64_ventura": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:dd47348ac5d1243cde53a6572bde91b4adde18ddfcc86df8e063d969305ad5ee", + "sha256": "dd47348ac5d1243cde53a6572bde91b4adde18ddfcc86df8e063d969305ad5ee" + }, + "sonoma": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:8db8fe084ab3090cdd83241f325de36549e4404382b4f79f624e41fe5209c136", + "sha256": "8db8fe084ab3090cdd83241f325de36549e4404382b4f79f624e41fe5209c136" + }, + "ventura": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:02ddcb526b715cb480296f2d7a930afc092e3fc44f1e966a03683ea5f595a1c2", + "sha256": "02ddcb526b715cb480296f2d7a930afc092e3fc44f1e966a03683ea5f595a1c2" + }, + "x86_64_linux": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:c59a311e84edc3575c055df2e48f95ba4a81709563151979d60786f3da9f40c4", + "sha256": "c59a311e84edc3575c055df2e48f95ba4a81709563151979d60786f3da9f40c4" + } + } + } + }, + "swiftlint": { + "version": "0.57.0", + "bottle": { + "rebuild": 0, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_sequoia": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:fd8609da0dbf8e9396f9f5697b2650c35217f6d5443310ab8b3aeb095cadc32e", + "sha256": "fd8609da0dbf8e9396f9f5697b2650c35217f6d5443310ab8b3aeb095cadc32e" + }, + "arm64_sonoma": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:cb14bb58a7fa8e390030b9890378c097385ac0d6bd50b1003946d24feb230b72", + "sha256": "cb14bb58a7fa8e390030b9890378c097385ac0d6bd50b1003946d24feb230b72" + }, + "arm64_ventura": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:52e8789623ac1ec907079762083591e1f21d90ff751da9754b3db52badfe94bc", + "sha256": "52e8789623ac1ec907079762083591e1f21d90ff751da9754b3db52badfe94bc" + }, + "sonoma": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:30e8f88c492f67ce3d08181044c5849f1b9075ad00aac615551a42aa253cbed9", + "sha256": "30e8f88c492f67ce3d08181044c5849f1b9075ad00aac615551a42aa253cbed9" + }, + "ventura": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:fe9e50ce478538598d5e85875ea9c0a1d61c24d83352362de02141f1467b5262", + "sha256": "fe9e50ce478538598d5e85875ea9c0a1d61c24d83352362de02141f1467b5262" + }, + "x86_64_linux": { + "cellar": "/home/linuxbrew/.linuxbrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:dec908e0f1cd2b332bcf678edc36e10f7030cfc9414e733629e763283b0ada40", + "sha256": "dec908e0f1cd2b332bcf678edc36e10f7030cfc9414e733629e763283b0ada40" + } + } + } + }, + "carthage": { + "version": "0.40.0", + "bottle": { + "rebuild": 0, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_sequoia": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/carthage/blobs/sha256:1ab671fcc4b39986c412e44002456ec71e5ee23ac9574bcbe653f2c7f1e0c3c8", + "sha256": "1ab671fcc4b39986c412e44002456ec71e5ee23ac9574bcbe653f2c7f1e0c3c8" + }, + "arm64_sonoma": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/carthage/blobs/sha256:01fa70c2d94efb0b4da3c593708f931e383f99a93e8461fda85804d08564815d", + "sha256": "01fa70c2d94efb0b4da3c593708f931e383f99a93e8461fda85804d08564815d" + }, + "arm64_ventura": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/carthage/blobs/sha256:48370b2f3289b9a3b1cfbdc41d0a7507cf12959f766aae5e26f99d03b92777aa", + "sha256": "48370b2f3289b9a3b1cfbdc41d0a7507cf12959f766aae5e26f99d03b92777aa" + }, + "arm64_monterey": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/carthage/blobs/sha256:576e684309365ad8e3d16a208267527747dbc97554c3646f78006d49843681f5", + "sha256": "576e684309365ad8e3d16a208267527747dbc97554c3646f78006d49843681f5" + }, + "sonoma": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/carthage/blobs/sha256:6e5ee2180ddfa8a7e3675a49ad20ab17d4ffe2ce5519653ec7b738e62665ca1a", + "sha256": "6e5ee2180ddfa8a7e3675a49ad20ab17d4ffe2ce5519653ec7b738e62665ca1a" + }, + "ventura": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/carthage/blobs/sha256:49ec2dc81b3753ea8d83f9b8e4308bf6603f1c8f674df847c7ec86f93d96c0ca", + "sha256": "49ec2dc81b3753ea8d83f9b8e4308bf6603f1c8f674df847c7ec86f93d96c0ca" + }, + "monterey": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/carthage/blobs/sha256:4f79410a86ad31251c4993ac3333181245633600ef66906634fbbf64e1c0661d", + "sha256": "4f79410a86ad31251c4993ac3333181245633600ef66906634fbbf64e1c0661d" + } + } + } + }, + "rbenv": { + "version": "1.3.0", + "bottle": { + "rebuild": 1, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "all": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/rbenv/blobs/sha256:8c1ae8d76748e0140a458cd4c83b2f6ed83da17777940f7878ce5348ede8aeff", + "sha256": "8c1ae8d76748e0140a458cd4c83b2f6ed83da17777940f7878ce5348ede8aeff" + } + } + } + }, + "pre-commit": { + "version": "3.8.0", + "bottle": { + "rebuild": 1, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_sequoia": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:f2bf0b048415d04f1d48c54e4fe77cdd0440ee0e9efa2ed1d1e8524d5f2123ed", + "sha256": "f2bf0b048415d04f1d48c54e4fe77cdd0440ee0e9efa2ed1d1e8524d5f2123ed" + }, + "arm64_sonoma": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:2ffbafa32980ef3054bca3c95510c954fd6fe66c048624846146fcd869ff2e87", + "sha256": "2ffbafa32980ef3054bca3c95510c954fd6fe66c048624846146fcd869ff2e87" + }, + "arm64_ventura": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:2f4d71e2f67449168c41bd43c3d1e4a75288ad2a04e5237e68fffd6a37121a4f", + "sha256": "2f4d71e2f67449168c41bd43c3d1e4a75288ad2a04e5237e68fffd6a37121a4f" + }, + "sonoma": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:6a3b81463887cf55ac97d40cc00d8e71e452c19dee1bb04fae6426a150e503a0", + "sha256": "6a3b81463887cf55ac97d40cc00d8e71e452c19dee1bb04fae6426a150e503a0" + }, + "ventura": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:05c375a7e7a15d389f28d1608a21976956241587e432d4de03f0587750eac6b6", + "sha256": "05c375a7e7a15d389f28d1608a21976956241587e432d4de03f0587750eac6b6" + }, + "x86_64_linux": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:07cd830e4efc6aedbb1669df2326ea2c8488ba98855c372acedcbd7dc8b21a47", + "sha256": "07cd830e4efc6aedbb1669df2326ea2c8488ba98855c372acedcbd7dc8b21a47" + } + } + } + }, + "python3": { + "version": "3.12.6", + "bottle": { + "rebuild": 0, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_sequoia": { + "cellar": "/opt/homebrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:27e2aeca98ebad5afc7a2937f9571826ee3c8bd724306f7d85de5e47d9dce571", + "sha256": "27e2aeca98ebad5afc7a2937f9571826ee3c8bd724306f7d85de5e47d9dce571" + }, + "arm64_sonoma": { + "cellar": "/opt/homebrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:00871488a4207f0265eab8e339146f63874e7454487169e819a1e4a5bd13a62b", + "sha256": "00871488a4207f0265eab8e339146f63874e7454487169e819a1e4a5bd13a62b" + }, + "arm64_ventura": { + "cellar": "/opt/homebrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:2d4c6e84be927a29d116e1f2bd5e09e0b00dab2141d58377f255949d363b5892", + "sha256": "2d4c6e84be927a29d116e1f2bd5e09e0b00dab2141d58377f255949d363b5892" + }, + "arm64_monterey": { + "cellar": "/opt/homebrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:d9c70d61697dc082c561f47bf8bde3cf2dcdb1070f0705a65d9acd67ff3acf65", + "sha256": "d9c70d61697dc082c561f47bf8bde3cf2dcdb1070f0705a65d9acd67ff3acf65" + }, + "sequoia": { + "cellar": "/usr/local/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:723e1c33533e84a6762051f25180b64f36942f47f988bccd9b1956c1852d39c4", + "sha256": "723e1c33533e84a6762051f25180b64f36942f47f988bccd9b1956c1852d39c4" + }, + "sonoma": { + "cellar": "/usr/local/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:ac351a070751905ceb68a1f570601ff0b712613830e2b6c14063c7243b2bb259", + "sha256": "ac351a070751905ceb68a1f570601ff0b712613830e2b6c14063c7243b2bb259" + }, + "ventura": { + "cellar": "/usr/local/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:8abd20343a066df8d2be5c81c4a2a968838003cf40da8838c052255747d704eb", + "sha256": "8abd20343a066df8d2be5c81c4a2a968838003cf40da8838c052255747d704eb" + }, + "monterey": { + "cellar": "/usr/local/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:594da1f2f1785d54cc85b646fe0520813071fc74fd7d610f4ecad4b55ce842c0", + "sha256": "594da1f2f1785d54cc85b646fe0520813071fc74fd7d610f4ecad4b55ce842c0" + }, + "x86_64_linux": { + "cellar": "/home/linuxbrew/.linuxbrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:e0c5b329ce19642fa0d54abf71fb33eae36cee265ff03479fe1ae929918a1329", + "sha256": "e0c5b329ce19642fa0d54abf71fb33eae36cee265ff03479fe1ae929918a1329" + } + } + } + }, + "jq": { + "version": "1.7.1", + "bottle": { + "rebuild": 1, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_sequoia": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:a10c82b07e393869d4467ad3e8ba26346d026b1ad3533d31dbb5e72abe9a7968", + "sha256": "a10c82b07e393869d4467ad3e8ba26346d026b1ad3533d31dbb5e72abe9a7968" + }, + "arm64_sonoma": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:7d01bc414859db57e055c814daa10e9c586626381ea329862ad4300f9fee78ce", + "sha256": "7d01bc414859db57e055c814daa10e9c586626381ea329862ad4300f9fee78ce" + }, + "arm64_ventura": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:b1a185e72ca020f08a8de22fabe1ad2425bf48d2e0378c5e07a6678020fa3e15", + "sha256": "b1a185e72ca020f08a8de22fabe1ad2425bf48d2e0378c5e07a6678020fa3e15" + }, + "arm64_monterey": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:8f8c06332f413f5259b360ed65dc3ef21b5d3f2fff35160bc12367e53cbd06bf", + "sha256": "8f8c06332f413f5259b360ed65dc3ef21b5d3f2fff35160bc12367e53cbd06bf" + }, + "sonoma": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:6bc01de99fd7f091b86880534842132a876f2d3043e3932ea75efc5f51c40aea", + "sha256": "6bc01de99fd7f091b86880534842132a876f2d3043e3932ea75efc5f51c40aea" + }, + "ventura": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:03227348d3845fe16ed261ad020402c1f23c56e73f65799ce278af4bac63c799", + "sha256": "03227348d3845fe16ed261ad020402c1f23c56e73f65799ce278af4bac63c799" + }, + "monterey": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:25aab2c539a41e4d67cd3d44353aac3cdd159ea815fec2b8dd82fbf038c559cc", + "sha256": "25aab2c539a41e4d67cd3d44353aac3cdd159ea815fec2b8dd82fbf038c559cc" + }, + "x86_64_linux": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:9559d8278cf20ad0294f2059855e1bc9d2bcabfd2bd5b5774c66006d1f201ad8", + "sha256": "9559d8278cf20ad0294f2059855e1bc9d2bcabfd2bd5b5774c66006d1f201ad8" + } + } + } + } + } + }, + "system": { + "macos": { + "sonoma": { + "HOMEBREW_VERSION": "4.3.24-119-g3b26dd8", + "HOMEBREW_PREFIX": "/opt/homebrew", + "Homebrew/homebrew-core": "api", + "CLT": "15.0.0.0.1.1694021235", + "Xcode": "15.4", + "macOS": "14.3.1" + } + } + } +} diff --git a/Makefile b/Makefile index aa2a1b91b43..d2621bedc41 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,15 @@ .PHONY: init -init: setup-git +init: which brew || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew bundle rbenv install --skip-existing rbenv exec gem update bundler rbenv exec bundle install - -.PHONY: setup-git -setup-git: -ifneq (, $(shell which pre-commit)) pre-commit install -endif + +.PHONY: check-versions +check-versions: + ./scripts/check-tooling-versions.sh lint: @echo "--> Running Swiftlint and Clang-Format" diff --git a/scripts/check-tooling-versions.sh b/scripts/check-tooling-versions.sh new file mode 100755 index 00000000000..fbe7f9b86b4 --- /dev/null +++ b/scripts/check-tooling-versions.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +BREW_CLANG_FORMAT_VERSION=$(jq '.entries.brew."clang-format".version' Brewfile.lock.json | sed s/'"'//g) +BREW_SWIFTLINT_VERSION=$(jq '.entries.brew.swiftlint.version' Brewfile.lock.json | sed s/'"'//g) +LOCAL_CLANG_FORMAT_VERSION=$(clang-format --version | awk '{print $3}') +LOCAL_SWIFTLINT_VERSION=$(swiftlint version) +RESOLUTION_MESSAGE="Please run \`make init\` to update your local dev tools. This may actually upgrade to a newer version than what is currently recorded in the lockfile; if that happens, please commit the update to the lockfile as well." + +if [ "${LOCAL_CLANG_FORMAT_VERSION}" == "${BREW_CLANG_FORMAT_VERSION}" ]; then + echo "clang-format version mismatch, expected: ${BREW_CLANG_FORMAT_VERSION}, but found: ${LOCAL_CLANG_FORMAT_VERSION}. ${RESOLUTION_MESSAGE}" + exit 1 +fi + +if [ "${LOCAL_SWIFTLINT_VERSION}" != "${BREW_SWIFTLINT_VERSION}" ]; then + echo "swiftlint version mismatch, expected: ${BREW_SWIFTLINT_VERSION}, but found: ${LOCAL_SWIFTLINT_VERSION}. ${RESOLUTION_MESSAGE}" + exit 1 +fi From cb7402f58ff33f3de5d7edbe8e906d207a72570e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:42:42 +0200 Subject: [PATCH 05/10] chore(deps): bump fastlane from 2.222.0 to 2.223.1 (#4382) Bumps [fastlane](https://github.com/fastlane/fastlane) from 2.222.0 to 2.223.1. - [Release notes](https://github.com/fastlane/fastlane/releases) - [Changelog](https://github.com/fastlane/fastlane/blob/master/CHANGELOG.latest.md) - [Commits](https://github.com/fastlane/fastlane/compare/fastlane/2.222.0...fastlane/2.223.1) --- updated-dependencies: - dependency-name: fastlane dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a4980db895f..06189f19ef2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,20 +24,20 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.959.0) - aws-sdk-core (3.201.3) + aws-partitions (1.981.0) + aws-sdk-core (3.209.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.8) + aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.88.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-kms (1.94.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.156.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-s3 (1.166.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.9.1) + aws-sigv4 (1.10.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) base64 (0.2.0) @@ -98,7 +98,7 @@ GEM ethon (0.16.0) ffi (>= 1.15.0) excon (0.111.0) - faraday (1.10.3) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -124,10 +124,10 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) fastimage (2.3.1) - fastlane (2.222.0) + fastlane (2.223.1) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -190,7 +190,7 @@ GEM google-apis-core (>= 0.11.0, < 2.a) google-apis-storage_v1 (0.31.0) google-apis-core (>= 0.11.0, < 2.a) - google-cloud-core (1.7.0) + google-cloud-core (1.7.1) google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) @@ -212,14 +212,14 @@ GEM signet (>= 0.16, < 2.a) highline (2.0.3) http-accept (1.7.0) - http-cookie (1.0.6) + http-cookie (1.0.7) domain_name (~> 0.5) httpclient (2.8.3) i18n (1.14.5) concurrent-ruby (~> 1.0) jmespath (1.6.2) json (2.7.2) - jwt (2.8.2) + jwt (2.9.1) base64 logger (1.6.1) mime-types (3.5.1) @@ -256,7 +256,7 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) retriable (3.1.2) - rexml (3.3.7) + rexml (3.3.8) rouge (2.0.7) ruby-macho (2.5.1) ruby2_keywords (0.0.5) @@ -290,7 +290,7 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) word_wrap (1.0.0) xcodeproj (1.25.0) CFPropertyList (>= 2.3.3, < 4.0) From 8c38fb1263a5f545f452b8445045102c4eb6235d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Andra=C5=A1ec?= Date: Tue, 1 Oct 2024 11:38:02 +0200 Subject: [PATCH 06/10] Use `Sentry.framework` instead of `Sentry.xcframework` (#4315) --- .github/workflows/build.yml | 18 +-- Makefile | 10 -- Samples/watchOS-Swift/README.md | 22 --- .../watchOS-Swift.xcodeproj/project.pbxproj | 135 +++++++++++++++++- .../watchOS-Swift WatchKit App.xcscheme | 3 +- Sources/Configuration/SDK.xcconfig | 1 - 6 files changed, 132 insertions(+), 57 deletions(-) delete mode 100644 Samples/watchOS-Swift/README.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12fee23456b..d8639d93275 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,6 +58,7 @@ jobs: scheme: - macOS-Swift - iOS13-Swift + - watchOS-Swift WatchKit App steps: - uses: actions/checkout@v4 @@ -73,23 +74,6 @@ jobs: CODE_SIGNING_ALLOWED="NO" build - build-watch-os-sample: - name: Sample watchOS - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - - run: ./scripts/ci-select-xcode.sh 13.4.1 - - run: make build-for-watchos - - # Disable code signing. We just want to make sure these compile. - - run: >- - env NSUnbufferedIO=YES - xcodebuild - -project Samples/watchOS-Swift/watchOS-Swift.xcodeproj - -configuration Debug - CODE_SIGNING_ALLOWED="NO" - build - build-xcframework: name: Build XCFramework # The macos-13 uses an Intel processor and doesn't compile the XCFramework for visionOS. diff --git a/Makefile b/Makefile index d2621bedc41..c72a4a80666 100644 --- a/Makefile +++ b/Makefile @@ -71,16 +71,6 @@ build-xcframework-sample: cd Samples/Carthage-Validation/XCFramework/ && carthage update --use-xcframeworks xcodebuild -project "Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj" -configuration Release CODE_SIGNING_ALLOWED="NO" build -## Build Sentry as a XCFramework that can be used with watchOS and save it to -## the watchOS sample. -watchOSLibPath = ./Samples/watchOS-Swift/libs -build-for-watchos: - @echo "--> Building Sentry as a XCFramework that can be used with watchOS" - rm -rf ${watchOSLibPath} - xcodebuild archive -scheme Sentry -destination="watchOS" -archivePath ${watchOSLibPath}/watchos.xcarchive -sdk watchos SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES - xcodebuild archive -scheme Sentry -destination="watch Simulator" -archivePath ${watchOSLibPath}//watchsimulator.xcarchive -sdk watchsimulator SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES - xcodebuild -create-xcframework -allow-internal-distribution -framework ${watchOSLibPath}/watchos.xcarchive/Products/Library/Frameworks/Sentry.framework -framework ${watchOSLibPath}/watchsimulator.xcarchive/Products/Library/Frameworks/Sentry.framework -output ${watchOSLibPath}//Sentry.xcframework - # call this like `make bump-version TO=5.0.0-rc.0` bump-version: clean-version-bump @echo "--> Bumping version from ${TO}" diff --git a/Samples/watchOS-Swift/README.md b/Samples/watchOS-Swift/README.md deleted file mode 100644 index f720379f479..00000000000 --- a/Samples/watchOS-Swift/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# watchOS-Swift Sample - -Run `make build-for-watchos` to build the Sentry.xcframework on which this -sample project depends on. - - -**Why XCFramework and not include a normal Framework as the other samples do it?** - -With the current project setup we can't add the Sentry.framework, like we do for the other sample projects, to a watchOS project. If we try to add it -we get the following error: - -``` -Building for watchOS Simulator, but the linked framework 'Sentry.framework' is building for iOS Simulator. You may need to configure 'Sentry.framework' to build for watchOS Simulator. -``` - -A solution would be to add Sentry via as a Swift Package, but this would -slow down the development cycle. - -A [XCFramework](https://help.apple.com/xcode/mac/11.4/#/dev6f6ac218b) can be -used on multiple platforms. As of July 2020 we need to manually create -XCFrameworkes with [xcodebuild](https://help.apple.com/xcode/mac/11.4/#/dev544efab96) and therefore we can't link directly to a XCFramework so -Xcode builds it for us. \ No newline at end of file diff --git a/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj b/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj index 315d0972d84..fdd54efdfdf 100644 --- a/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 498CC1A52C9217E20045143E /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 498CC1982C9217D50045143E /* Sentry.framework */; }; 7B34280225876DFC00056519 /* Tongariro.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 7B34280125876DFC00056519 /* Tongariro.jpg */; }; 7B82C48424C98A93002CA6D1 /* watchOS-Swift WatchKit App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 7B82C48324C98A93002CA6D1 /* watchOS-Swift WatchKit App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 7B82C48A24C98A93002CA6D1 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B82C48824C98A93002CA6D1 /* Interface.storyboard */; }; @@ -19,12 +20,60 @@ 7B82C4A024C98A95002CA6D1 /* NotificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B82C49F24C98A95002CA6D1 /* NotificationView.swift */; }; 7B82C4A224C98A96002CA6D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B82C4A124C98A96002CA6D1 /* Assets.xcassets */; }; 7B82C4A524C98A96002CA6D1 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B82C4A424C98A96002CA6D1 /* Preview Assets.xcassets */; }; - 7B82C4C624C993E6002CA6D1 /* Sentry.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B82C4BA24C98CFC002CA6D1 /* Sentry.xcframework */; }; - 7B82C4C724C993E6002CA6D1 /* Sentry.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B82C4BA24C98CFC002CA6D1 /* Sentry.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 9273C09E2C89E76B0006FD34 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9273C09C2C89E76B0006FD34 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 84BA72BB2C9369D70045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72B92C9369D70045B828 /* GitInjections.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 498CC1972C9217D50045143E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 498CC18E2C9217D50045143E /* Sentry.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 63AA759B1EB8AEF500D153DE; + remoteInfo = Sentry; + }; + 498CC1992C9217D50045143E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 498CC18E2C9217D50045143E /* Sentry.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 63AA76651EB8CB2F00D153DE; + remoteInfo = SentryTests; + }; + 498CC19B2C9217D50045143E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 498CC18E2C9217D50045143E /* Sentry.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D8199DAA29376E9B0074249E; + remoteInfo = SentrySwiftUI; + }; + 498CC19D2C9217D50045143E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 498CC18E2C9217D50045143E /* Sentry.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8431EFD929B27B1100D8DC56; + remoteInfo = SentryProfilerTests; + }; + 498CC19F2C9217D50045143E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 498CC18E2C9217D50045143E /* Sentry.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8431F00A29B284F200D8DC56; + remoteInfo = SentryTestUtils; + }; + 498CC1A12C9217D50045143E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 498CC18E2C9217D50045143E /* Sentry.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D84DAD4D2B17428D003CF120; + remoteInfo = SentryTestUtilsDynamic; + }; + 498CC1A32C9217DB0045143E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 498CC18E2C9217D50045143E /* Sentry.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 63AA759A1EB8AEF500D153DE; + remoteInfo = Sentry; + }; 7B82C48524C98A93002CA6D1 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 7B82C47924C98A93002CA6D1 /* Project object */; @@ -64,13 +113,13 @@ name = "Embed Watch Content"; runOnlyForDeploymentPostprocessing = 0; }; - 7B82C4C824C993E6002CA6D1 /* Embed Frameworks */ = { + 9273C09F2C89E76B0006FD34 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( - 7B82C4C724C993E6002CA6D1 /* Sentry.xcframework in Embed Frameworks */, + 9273C09E2C89E76B0006FD34 /* Sentry.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -78,6 +127,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 498CC18E2C9217D50045143E /* Sentry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sentry.xcodeproj; path = ../../Sentry.xcodeproj; sourceTree = ""; }; 7B34280125876DFC00056519 /* Tongariro.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Tongariro.jpg; sourceTree = ""; }; 7B82C47F24C98A93002CA6D1 /* watchOS-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 7B82C48324C98A93002CA6D1 /* watchOS-Swift WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-Swift WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -98,6 +148,7 @@ 7B82C4BA24C98CFC002CA6D1 /* Sentry.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Sentry.xcframework; path = libs/Sentry.xcframework; sourceTree = ""; }; 7B82C4BF24C99340002CA6D1 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7B82C4C224C9939A002CA6D1 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9273C09C2C89E76B0006FD34 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 84BA72B92C9369D70045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -106,16 +157,30 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 7B82C4C624C993E6002CA6D1 /* Sentry.xcframework in Frameworks */, + 498CC1A52C9217E20045143E /* Sentry.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 498CC18F2C9217D50045143E /* Products */ = { + isa = PBXGroup; + children = ( + 498CC1982C9217D50045143E /* Sentry.framework */, + 498CC19A2C9217D50045143E /* SentryTests.xctest */, + 498CC19C2C9217D50045143E /* SentrySwiftUI.framework */, + 498CC19E2C9217D50045143E /* SentryProfilerTests.xctest */, + 498CC1A02C9217D50045143E /* libSentryTestUtils.a */, + 498CC1A22C9217D50045143E /* SentryTestUtilsDynamic.framework */, + ); + name = Products; + sourceTree = ""; + }; 7B82C47824C98A93002CA6D1 = { isa = PBXGroup; children = ( + 498CC18E2C9217D50045143E /* Sentry.xcodeproj */, 84BA72BA2C9369D70045B828 /* Shared */, 7B82C48724C98A93002CA6D1 /* watchOS-Swift WatchKit App */, 7B82C49624C98A95002CA6D1 /* watchOS-Swift WatchKit Extension */, @@ -172,6 +237,7 @@ 7B82C4B524C98AF4002CA6D1 /* Frameworks */ = { isa = PBXGroup; children = ( + 9273C09C2C89E76B0006FD34 /* Sentry.framework */, 7B82C4C224C9939A002CA6D1 /* Sentry.framework */, 7B82C4BF24C99340002CA6D1 /* Sentry.framework */, 7B82C4BA24C98CFC002CA6D1 /* Sentry.xcframework */, @@ -234,12 +300,13 @@ 7B82C48F24C98A95002CA6D1 /* Frameworks */, 84BA72A32C9368660045B828 /* Inject Git information into Info.plist */, 7B82C49024C98A95002CA6D1 /* Resources */, - 7B82C4C824C993E6002CA6D1 /* Embed Frameworks */, + 9273C09F2C89E76B0006FD34 /* Embed Frameworks */, 84BA72A42C9368670045B828 /* Reset Git fields in Info.plist */, ); buildRules = ( ); dependencies = ( + 498CC1A42C9217DB0045143E /* PBXTargetDependency */, ); name = "watchOS-Swift WatchKit Extension"; productName = "watchOS-Swift WatchKit Extension"; @@ -278,6 +345,12 @@ mainGroup = 7B82C47824C98A93002CA6D1; productRefGroup = 7B82C48024C98A93002CA6D1 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 498CC18F2C9217D50045143E /* Products */; + ProjectRef = 498CC18E2C9217D50045143E /* Sentry.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 7B82C47E24C98A93002CA6D1 /* watchOS-Swift */, @@ -287,6 +360,51 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 498CC1982C9217D50045143E /* Sentry.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Sentry.framework; + remoteRef = 498CC1972C9217D50045143E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 498CC19A2C9217D50045143E /* SentryTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = SentryTests.xctest; + remoteRef = 498CC1992C9217D50045143E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 498CC19C2C9217D50045143E /* SentrySwiftUI.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = SentrySwiftUI.framework; + remoteRef = 498CC19B2C9217D50045143E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 498CC19E2C9217D50045143E /* SentryProfilerTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = SentryProfilerTests.xctest; + remoteRef = 498CC19D2C9217D50045143E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 498CC1A02C9217D50045143E /* libSentryTestUtils.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSentryTestUtils.a; + remoteRef = 498CC19F2C9217D50045143E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 498CC1A22C9217D50045143E /* SentryTestUtilsDynamic.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = SentryTestUtilsDynamic.framework; + remoteRef = 498CC1A12C9217D50045143E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 7B82C47D24C98A93002CA6D1 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -372,6 +490,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 498CC1A42C9217DB0045143E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Sentry; + targetProxy = 498CC1A32C9217DB0045143E /* PBXContainerItemProxy */; + }; 7B82C48624C98A93002CA6D1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7B82C48224C98A93002CA6D1 /* watchOS-Swift WatchKit App */; diff --git a/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/xcshareddata/xcschemes/watchOS-Swift WatchKit App.xcscheme b/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/xcshareddata/xcschemes/watchOS-Swift WatchKit App.xcscheme index 4979d444df6..29485b9eb40 100644 --- a/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/xcshareddata/xcschemes/watchOS-Swift WatchKit App.xcscheme +++ b/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/xcshareddata/xcschemes/watchOS-Swift WatchKit App.xcscheme @@ -53,7 +53,8 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" - allowLocationSimulation = "YES"> + allowLocationSimulation = "YES" + notificationPayloadFile = "watchOS-Swift WatchKit Extension/PushNotificationPayload.apns"> Date: Wed, 2 Oct 2024 11:21:38 +0200 Subject: [PATCH 07/10] chore: Update clang-format from 19.1.0 to 19.1.1 (#4389) --- Brewfile.lock.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Brewfile.lock.json b/Brewfile.lock.json index 5542cf946d0..9ae9cc6b22e 100644 --- a/Brewfile.lock.json +++ b/Brewfile.lock.json @@ -2,40 +2,40 @@ "entries": { "brew": { "clang-format": { - "version": "19.1.0", + "version": "19.1.1", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "arm64_sequoia": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:fd9f55ce1e7070804eedd3714d6bdcc51d603d5a485dc9bae070e8c61a40c7ba", - "sha256": "fd9f55ce1e7070804eedd3714d6bdcc51d603d5a485dc9bae070e8c61a40c7ba" + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:7b5f8c066c04e831f51f2abf16312084e3fa098b0ff76abc6480967a2860bd24", + "sha256": "7b5f8c066c04e831f51f2abf16312084e3fa098b0ff76abc6480967a2860bd24" }, "arm64_sonoma": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:7430daa8b4ed88ad80c6224a1529d9ca11a192bcc24f9056be4b0797256592ae", - "sha256": "7430daa8b4ed88ad80c6224a1529d9ca11a192bcc24f9056be4b0797256592ae" + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:e7ba64f5fba3cf0ceadaa3c520a2208642ce1169bffac8db1e9b56569195148e", + "sha256": "e7ba64f5fba3cf0ceadaa3c520a2208642ce1169bffac8db1e9b56569195148e" }, "arm64_ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:dd47348ac5d1243cde53a6572bde91b4adde18ddfcc86df8e063d969305ad5ee", - "sha256": "dd47348ac5d1243cde53a6572bde91b4adde18ddfcc86df8e063d969305ad5ee" + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:ce317db950e3d268110f2bc62c5f1aa07cbb50dafd2603e168e363718a9d9e21", + "sha256": "ce317db950e3d268110f2bc62c5f1aa07cbb50dafd2603e168e363718a9d9e21" }, "sonoma": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:8db8fe084ab3090cdd83241f325de36549e4404382b4f79f624e41fe5209c136", - "sha256": "8db8fe084ab3090cdd83241f325de36549e4404382b4f79f624e41fe5209c136" + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:43bcbde28012da49f5679bec7ba8d2c341771cee9909bddde1ec2e29e1fd8320", + "sha256": "43bcbde28012da49f5679bec7ba8d2c341771cee9909bddde1ec2e29e1fd8320" }, "ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:02ddcb526b715cb480296f2d7a930afc092e3fc44f1e966a03683ea5f595a1c2", - "sha256": "02ddcb526b715cb480296f2d7a930afc092e3fc44f1e966a03683ea5f595a1c2" + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:80ac7aac07528efb14db1928d1268db16033dcbaf73a0fa5c1d08817d3bf3ab4", + "sha256": "80ac7aac07528efb14db1928d1268db16033dcbaf73a0fa5c1d08817d3bf3ab4" }, "x86_64_linux": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:c59a311e84edc3575c055df2e48f95ba4a81709563151979d60786f3da9f40c4", - "sha256": "c59a311e84edc3575c055df2e48f95ba4a81709563151979d60786f3da9f40c4" + "url": "https://ghcr.io/v2/homebrew/core/clang-format/blobs/sha256:f8318eea6c50bf91462397af31ee5c20413dfb1a6625aa8b73d524f4b7396180", + "sha256": "f8318eea6c50bf91462397af31ee5c20413dfb1a6625aa8b73d524f4b7396180" } } } @@ -284,12 +284,12 @@ "system": { "macos": { "sonoma": { - "HOMEBREW_VERSION": "4.3.24-119-g3b26dd8", + "HOMEBREW_VERSION": "4.4.0", "HOMEBREW_PREFIX": "/opt/homebrew", "Homebrew/homebrew-core": "api", - "CLT": "15.0.0.0.1.1694021235", - "Xcode": "15.4", - "macOS": "14.3.1" + "CLT": "16.0.0.0.1.1724870825", + "Xcode": "16.0", + "macOS": "14.6.1" } } } From e88fe9a6190bb6b79b2098965badaee4d135d2d4 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 2 Oct 2024 11:21:48 +0200 Subject: [PATCH 08/10] chore: Fix check tooling versions (#4390) Comparing the clang versions should be != and not ==. --- scripts/check-tooling-versions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-tooling-versions.sh b/scripts/check-tooling-versions.sh index fbe7f9b86b4..8f382698f08 100755 --- a/scripts/check-tooling-versions.sh +++ b/scripts/check-tooling-versions.sh @@ -6,7 +6,7 @@ LOCAL_CLANG_FORMAT_VERSION=$(clang-format --version | awk '{print $3}') LOCAL_SWIFTLINT_VERSION=$(swiftlint version) RESOLUTION_MESSAGE="Please run \`make init\` to update your local dev tools. This may actually upgrade to a newer version than what is currently recorded in the lockfile; if that happens, please commit the update to the lockfile as well." -if [ "${LOCAL_CLANG_FORMAT_VERSION}" == "${BREW_CLANG_FORMAT_VERSION}" ]; then +if [ "${LOCAL_CLANG_FORMAT_VERSION}" != "${BREW_CLANG_FORMAT_VERSION}" ]; then echo "clang-format version mismatch, expected: ${BREW_CLANG_FORMAT_VERSION}, but found: ${LOCAL_CLANG_FORMAT_VERSION}. ${RESOLUTION_MESSAGE}" exit 1 fi From fd458ae46092dfcdfb6984cd2ac8b0d4cedebd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Andra=C5=A1ec?= Date: Wed, 2 Oct 2024 13:37:27 +0200 Subject: [PATCH 09/10] Add mergeable libraries support to dynamic libraries (#4381) --- .github/workflows/build.yml | 2 +- CHANGELOG.md | 1 + scripts/build-xcframework.sh | 46 +++++++++++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8639d93275..6573959ad82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ on: - Sentry.xcodeproj/** - Gemfile.lock - 'Package.swift' - - 'scripts/build-xcframework' + - 'scripts/build-xcframework.sh' # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value concurrency: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cfd03f3b23..4e3e5ec6554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Added breadcrumb.origin private field (#4358) - Custom redact modifier for SwiftUI (#4362) +- Add mergeable libraries support to dynamic libraries (#4381) ### Improvements diff --git a/scripts/build-xcframework.sh b/scripts/build-xcframework.sh index 6259b7595c8..85bab81b972 100755 --- a/scripts/build-xcframework.sh +++ b/scripts/build-xcframework.sh @@ -19,7 +19,8 @@ generate_xcframework() { local resolved_configuration="Release$configuration_suffix" local resolved_product_name="$scheme$configuration_suffix" - + local OTHER_LDFLAGS="" + if [ "$MACH_O_TYPE" = "staticlib" ]; then #For static framework we disabled symbols because they are not distributed in the framework causing warnings. GCC_GENERATE_DEBUGGING_SYMBOLS="NO" @@ -30,7 +31,27 @@ generate_xcframework() { for sdk in "${sdks[@]}"; do if grep -q "${sdk}" <<< "$ALL_SDKS"; then - xcodebuild archive -project Sentry.xcodeproj/ -scheme "$scheme" -configuration "$resolved_configuration" -sdk "$sdk" -archivePath "./Carthage/archive/${scheme}${suffix}/${sdk}.xcarchive" CODE_SIGNING_REQUIRED=NO SKIP_INSTALL=NO CODE_SIGN_IDENTITY= CARTHAGE=YES MACH_O_TYPE="$MACH_O_TYPE" ENABLE_CODE_COVERAGE=NO GCC_GENERATE_DEBUGGING_SYMBOLS="$GCC_GENERATE_DEBUGGING_SYMBOLS" + ## watchos, watchsimulator dont support make_mergeable: ld: unknown option: -make_mergeable + if [[ "$sdk" == "watchos" || "$sdk" == "watchsimulator" ]]; then + OTHER_LDFLAGS="" + elif [ "$MACH_O_TYPE" != "staticlib" ]; then + OTHER_LDFLAGS="-Wl,-make_mergeable" + fi + + xcodebuild archive \ + -project Sentry.xcodeproj/ \ + -scheme "$scheme" \ + -configuration "$resolved_configuration" \ + -sdk "$sdk" \ + -archivePath "./Carthage/archive/${scheme}${suffix}/${sdk}.xcarchive" \ + CODE_SIGNING_REQUIRED=NO \ + SKIP_INSTALL=NO \ + CODE_SIGN_IDENTITY= \ + CARTHAGE=YES \ + MACH_O_TYPE="$MACH_O_TYPE" \ + ENABLE_CODE_COVERAGE=NO \ + GCC_GENERATE_DEBUGGING_SYMBOLS="$GCC_GENERATE_DEBUGGING_SYMBOLS" \ + OTHER_LDFLAGS="$OTHER_LDFLAGS" createxcframework+="-framework Carthage/archive/${scheme}${suffix}/${sdk}.xcarchive/Products/Library/Frameworks/${resolved_product_name}.framework " @@ -55,8 +76,27 @@ generate_xcframework() { fi done + # for the case that watch* sdks are last in list + if [ "$MACH_O_TYPE" != "staticlib" ]; then + OTHER_LDFLAGS="-Wl,-make_mergeable" + fi + #Create framework for mac catalyst - xcodebuild -project Sentry.xcodeproj/ -scheme "$scheme" -configuration "$resolved_configuration" -sdk iphoneos -destination 'platform=macOS,variant=Mac Catalyst' -derivedDataPath ./Carthage/DerivedData CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES MACH_O_TYPE="$MACH_O_TYPE" SUPPORTS_MACCATALYST=YES ENABLE_CODE_COVERAGE=NO GCC_GENERATE_DEBUGGING_SYMBOLS="$GCC_GENERATE_DEBUGGING_SYMBOLS" + xcodebuild \ + -project Sentry.xcodeproj/ \ + -scheme "$scheme" \ + -configuration "$resolved_configuration" \ + -sdk iphoneos \ + -destination 'platform=macOS,variant=Mac Catalyst' \ + -derivedDataPath ./Carthage/DerivedData \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGN_IDENTITY= \ + CARTHAGE=YES \ + MACH_O_TYPE="$MACH_O_TYPE" \ + SUPPORTS_MACCATALYST=YES \ + ENABLE_CODE_COVERAGE=NO \ + GCC_GENERATE_DEBUGGING_SYMBOLS="$GCC_GENERATE_DEBUGGING_SYMBOLS" \ + OTHER_LDFLAGS="$OTHER_LDFLAGS" if [ "$MACH_O_TYPE" = "staticlib" ]; then local infoPlist="Carthage/DerivedData/Build/Products/$resolved_configuration-maccatalyst/${scheme}.framework/Resources/Info.plist" From 4eea4d126249061e4f8e641195c0b0b21911fbf8 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 2 Oct 2024 14:07:58 +0200 Subject: [PATCH 10/10] Chore: Fix the versioning to support app release with Beta versions (#4368) * Update main.swift * Fixing xcconfig version * Update main.swift * Update SentryTests.m * Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ Sources/Configuration/SDK.xcconfig | 2 +- Sources/Configuration/SentrySwiftUI.xcconfig | 2 +- Tests/SentryTests/SentryTests.m | 15 ------------ Utils/VersionBump/main.swift | 25 ++++++++++++++++---- 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e3e5ec6554..74c4f42213b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ - Slightly speed up SentryInAppLogic (#4370) - Stop canceling timer for manual transactions (#4380) +### Fixes + +- Fix the versioning to support app release with Beta versions (#4368) + ## 8.37.0-beta.1 ### Features diff --git a/Sources/Configuration/SDK.xcconfig b/Sources/Configuration/SDK.xcconfig index 8787c17df8c..e25be24877a 100644 --- a/Sources/Configuration/SDK.xcconfig +++ b/Sources/Configuration/SDK.xcconfig @@ -10,7 +10,7 @@ DYLIB_INSTALL_NAME_BASE = @rpath MACH_O_TYPE = mh_dylib FRAMEWORK_VERSION = A -CURRENT_PROJECT_VERSION = 8.37.0-beta.1 +CURRENT_PROJECT_VERSION = 8.37.0 ALWAYS_SEARCH_USER_PATHS = NO CLANG_ENABLE_OBJC_ARC = YES diff --git a/Sources/Configuration/SentrySwiftUI.xcconfig b/Sources/Configuration/SentrySwiftUI.xcconfig index fb5410ac6f3..6c76b66635e 100644 --- a/Sources/Configuration/SentrySwiftUI.xcconfig +++ b/Sources/Configuration/SentrySwiftUI.xcconfig @@ -1,5 +1,5 @@ PRODUCT_NAME = SentrySwiftUI -CURRENT_PROJECT_VERSION = 7.31.3 +CURRENT_PROJECT_VERSION = 8.37.0 MACOSX_DEPLOYMENT_TARGET = 10.15 IPHONEOS_DEPLOYMENT_TARGET = 13.0 diff --git a/Tests/SentryTests/SentryTests.m b/Tests/SentryTests/SentryTests.m index 74162b2853c..a539838e442 100644 --- a/Tests/SentryTests/SentryTests.m +++ b/Tests/SentryTests/SentryTests.m @@ -31,21 +31,6 @@ - (void)setUp [SentrySDK.currentHub bindClient:nil]; } -- (void)testVersion -{ - NSDictionary *info = [[NSBundle bundleForClass:[SentryClient class]] infoDictionary]; - NSString *version = [NSString stringWithFormat:@"%@", info[@"CFBundleShortVersionString"]]; - if ([info[@"CFBundleIdentifier"] isEqualToString:@"io.sentry.Sentry"]) { - // This test is running on a bundle that is not the SDK - // (code was loaded inside an app for example) - // in this case, we don't care about asserting our hard coded value matches - // since this will be the app version instead of our SDK version. - XCTAssert([version isEqualToString:SentryMeta.versionString], - @"Version of bundle:%@ not equal to version of SentryMeta:%@", version, - SentryMeta.versionString); - } -} - - (void)testSharedClient { NSError *error = nil; diff --git a/Utils/VersionBump/main.swift b/Utils/VersionBump/main.swift index 64b46487c71..e4cda5fc465 100644 --- a/Utils/VersionBump/main.swift +++ b/Utils/VersionBump/main.swift @@ -10,12 +10,17 @@ let files = [ "./SentryPrivate.podspec", "./SentrySwiftUI.podspec", "./Sources/Sentry/SentryMeta.m", - "./Sources/Configuration/SDK.xcconfig", - "./Sources/Configuration/SentrySwiftUI.xcconfig", "./Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj", "./Tests/HybridSDKTest/HybridPod.podspec" ] +// Files that only accept the format x.x.x in order to release an app using the framework. +// This will enable publishing apps with SDK beta version. +let restrictFiles = [ + "./Sources/Configuration/SDK.xcconfig", + "./Sources/Configuration/SentrySwiftUI.xcconfig" +] + let args = CommandLine.arguments let semver: StaticString = "([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?" @@ -28,12 +33,19 @@ let fromVersionFileHandler = try open(fromVersionFile) let fromFileContent: String = fromVersionFileHandler.read() if let match = Regex(semver, options: [.dotMatchesLineSeparators]).firstMatch(in: fromFileContent) { - let fromVersion = match.matchedString - let toVersion = args[1] + var fromVersion = match.matchedString + var toVersion = args[1] for file in files { try updateVersion(file, fromVersion, toVersion) } + + fromVersion = extractVersionOnly(fromVersion) + toVersion = extractVersionOnly(toVersion) + + for file in restrictFiles { + try updateVersion(file, fromVersion, toVersion) + } } func updateVersion(_ file: String, _ fromVersion: String, _ toVersion: String) throws { @@ -44,3 +56,8 @@ func updateVersion(_ file: String, _ fromVersion: String, _ toVersion: String) t overwriteFile.write(newContents) overwriteFile.close() } + +func extractVersionOnly(_ version: String) -> String { + guard let indexOfHypen = version.firstIndex(of: "-") else { return version } + return String(version.prefix(upTo: indexOfHypen)) +}