From 0d4faa631605a4e93c9764f4cf0f1e2e364b79a6 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Mon, 23 Nov 2026 18:18:42 +0100 Subject: [PATCH 1/5] ref: Add native utility and profiling targets --- .github/file-filters.yml | 28 ++ Makefile | 35 +- Package.swift | 46 ++- Package@swift-6.1.swift | 46 ++- Package@swift-6.2.swift | 46 ++- Plans/SentrySPM_Base.xctestplan | 16 + Plans/SentrySPM_Base_v10.xctestplan | 16 + Sentry.xcodeproj/project.pbxproj | 389 ++++++++++++++---- .../xcschemes/SentryNativeUtils.xcscheme | 15 + .../xcschemes/SentryProfiling.xcscheme | 15 + Sources/AGENTS.md | 7 + Sources/Configuration/SDK.xcconfig | 2 +- Sources/Configuration/Sentry.xcconfig | 9 +- .../Configuration/SentryNativeUtils.xcconfig | 20 + .../Configuration/SentryProfiling.xcconfig | 18 + Sources/Configuration/SentryV10.xcconfig | 6 +- Sources/Sentry/include/SentryPrivate.h | 1 - .../SentryNativeUtils/SentryNativeUtils.mm | 13 + .../SentryTime.mm | 5 - .../include/SentryNativeUtils.h | 13 + .../include/SentryTime.h | 10 +- .../include/module.modulemap | 4 + Sources/SentryProfiling/SentryProfiling.m | 13 + .../SentryProfilingSystemMetrics.m | 4 - .../SentryProfiling/include/SentryProfiling.h | 13 + .../include/SentryProfilingSystemMetrics.h | 9 +- .../SentryProfiling/include/module.modulemap | 4 + .../SentryUpdateLinkFrameSource.swift | 1 + .../AppHangTracking/SentryANRTrackerV2.swift | 1 + .../SentryTimeTests.swift | 73 ++++ .../Support/SentryTimeTestsAssertionHandler.m | 38 ++ .../include/SentryTimeTestsAssertionHandler.h | 9 + .../SentryProfilerSDKBackendValueTests.swift | 1 + .../SentryProfilingSystemMetricsTests.m | 37 ++ .../Helper/SentryTimeSwiftTests.swift | 21 - .../SentryFramesTrackerTests.swift | 1 + ...ryHttpTransportFlushIntegrationTests.swift | 1 + .../Networking/SentryHttpTransportTests.swift | 1 + .../SentryTests/ObjC/Helper/SentryTimeTests.m | 102 ----- develop-docs/ARCHITECTURE.md | 15 + develop-docs/BUILD.md | 8 + scripts/build-xcframework-slice.sh | 9 +- 42 files changed, 853 insertions(+), 268 deletions(-) create mode 100644 Sentry.xcodeproj/xcshareddata/xcschemes/SentryNativeUtils.xcscheme create mode 100644 Sentry.xcodeproj/xcshareddata/xcschemes/SentryProfiling.xcscheme create mode 100644 Sources/Configuration/SentryNativeUtils.xcconfig create mode 100644 Sources/Configuration/SentryProfiling.xcconfig create mode 100644 Sources/SentryNativeUtils/SentryNativeUtils.mm rename Sources/{Sentry => SentryNativeUtils}/SentryTime.mm (88%) create mode 100644 Sources/SentryNativeUtils/include/SentryNativeUtils.h rename Sources/{Sentry => SentryNativeUtils}/include/SentryTime.h (92%) create mode 100644 Sources/SentryNativeUtils/include/module.modulemap create mode 100644 Sources/SentryProfiling/SentryProfiling.m rename Sources/{Sentry/Profiling => SentryProfiling}/SentryProfilingSystemMetrics.m (85%) create mode 100644 Sources/SentryProfiling/include/SentryProfiling.h rename Sources/{Sentry => SentryProfiling}/include/SentryProfilingSystemMetrics.h (77%) create mode 100644 Sources/SentryProfiling/include/module.modulemap create mode 100644 Tests/SentryNativeUtilsTests/SentryTimeTests.swift create mode 100644 Tests/SentryNativeUtilsTests/Support/SentryTimeTestsAssertionHandler.m create mode 100644 Tests/SentryNativeUtilsTests/Support/include/SentryTimeTestsAssertionHandler.h create mode 100644 Tests/SentryProfilingTests/SentryProfilingSystemMetricsTests.m delete mode 100644 Tests/SentryTests/Helper/SentryTimeSwiftTests.swift delete mode 100644 Tests/SentryTests/ObjC/Helper/SentryTimeTests.m diff --git a/.github/file-filters.yml b/.github/file-filters.yml index e273c362cfd..ad0ea51d4b4 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -26,6 +26,8 @@ run_unit_tests_for_prs: &run_unit_tests_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryV10Configuration/**" - "Sources/SentryObjC/**" @@ -83,6 +85,8 @@ run_distribution_tests_for_prs: &run_distribution_tests_for_prs - "Sources/SentryDistribution/**" - "Sources/SentryDistributionTests/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/Swift/**" - "Sources/SentryV10Configuration/**" - "Sources/SentryObjC/**" @@ -91,6 +95,8 @@ run_distribution_tests_for_prs: &run_distribution_tests_for_prs - "Tests/SentryObjCCompatTests/**" - "Tests/SentryObjCTests/**" - "Tests/SentryProfilerTests/**" + - "Tests/SentryNativeUtilsTests/**" + - "Tests/SentryProfilingTests/**" - "Tests/SentryTests/**" - "Tests/Fixtures/**" - "Tests/SentryTestUtilsDynamic/**" @@ -128,6 +134,8 @@ run_api_stability_for_prs: &run_api_stability_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryObjC/**" - "Sources/SentryObjCCompat/**" @@ -251,6 +259,8 @@ run_release_for_prs: &run_release_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryV10Configuration/**" - "Sources/SentryObjC/**" @@ -385,6 +395,8 @@ run_lint_xcode_analyze_for_prs: &run_lint_xcode_analyze_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryObjC/**" - "Sources/SentryObjCCompat/**" @@ -416,6 +428,8 @@ run_crash_e2e_for_prs: - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/Swift/**" # Includes the app, Swift runner, and regression/live harness tests. @@ -537,6 +551,8 @@ run_testflight_for_pushes: &run_testflight_for_pushes - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryObjC/**" - "Sources/SentryObjCCompat/**" @@ -564,6 +580,8 @@ run_codeql_analysis_for_prs: &run_codeql_analysis_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryObjC/**" - "Sources/SentryObjCCompat/**" @@ -634,6 +652,8 @@ run_ui_tests_for_prs: &run_ui_tests_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryObjC/**" - "Sources/SentryObjCCompat/**" @@ -680,6 +700,8 @@ run_ui_tests_critical_for_prs: &run_ui_tests_critical_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryObjC/**" - "Sources/SentryObjCCompat/**" @@ -721,6 +743,8 @@ run_lint_swiftlint_for_prs: &run_lint_swiftlint_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryDistribution/**" - "Sources/SentryDistributionTests/**" @@ -773,6 +797,8 @@ run_size_analysis_for_prs: &run_size_analysis_for_prs - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryObjC/**" - "Sources/SentryObjCCompat/**" @@ -802,6 +828,8 @@ run_3rd_party_integrations_tests_for_prs: &run_3rd_party_integrations_tests_for_ - "Sources/include/**" - "Sources/Resources/**" - "Sources/Sentry/**" + - "Sources/SentryNativeUtils/**" + - "Sources/SentryProfiling/**" - "Sources/SentryCppHelper/**" - "Sources/SentryObjC/**" - "Sources/SentryObjCCompat/**" diff --git a/Makefile b/Makefile index 7faf0a35e0d..5e7d48eda85 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,9 @@ IOS_DEVICE_NAME ?= iPhone 16 Pro # Build configuration for the iOS source-package test app. IOS_SPM_BUILD_CONFIGURATION ?= Debug +# SDK or standalone native-library scheme used by platform build targets. +XCODE_SCHEME ?= SentryV10 + # tvOS Simulator OS version (defaults to 'latest', can be overridden via TVOS_SIMULATOR_OS=18.5) TVOS_SIMULATOR_OS ?= latest @@ -173,7 +176,7 @@ build-ios: --os $(IOS_SIMULATOR_OS) \ --device "$(IOS_DEVICE_NAME)" \ --command build \ - --scheme SentryV10 \ + --scheme "$(XCODE_SCHEME)" \ --configuration DebugV10 ## Build macOS target with SDK_V10 flag @@ -186,7 +189,7 @@ build-macos: --platform macOS \ --os latest \ --command build \ - --scheme SentryV10 \ + --scheme "$(XCODE_SCHEME)" \ --configuration DebugV10 ## Build Catalyst target with SDK_V10 flag @@ -199,7 +202,7 @@ build-catalyst: --platform Catalyst \ --os latest \ --command build \ - --scheme SentryV10 \ + --scheme "$(XCODE_SCHEME)" \ --configuration DebugV10 \ --xcconfig Tests/Configuration/SentryV10Catalyst.xcconfig @@ -214,7 +217,7 @@ build-tvos: --os $(TVOS_SIMULATOR_OS) \ --device "$(TVOS_DEVICE_NAME)" \ --command build \ - --scheme SentryV10 \ + --scheme "$(XCODE_SCHEME)" \ --configuration DebugV10 ## Build visionOS target with SDK_V10 flag @@ -228,7 +231,7 @@ build-visionos: --os $(VISIONOS_SIMULATOR_OS) \ --device "$(VISIONOS_DEVICE_NAME)" \ --command build \ - --scheme SentryV10 \ + --scheme "$(XCODE_SCHEME)" \ --configuration DebugV10 ## Build watchOS target with SDK_V10 flag @@ -239,7 +242,7 @@ build-watchos: @echo "[MAKE] $@: Building V10 for watchOS" set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild build \ -workspace Sentry.xcworkspace \ - -scheme SentryV10 \ + -scheme "$(XCODE_SCHEME)" \ -destination 'platform=watchOS Simulator,OS=$(WATCHOS_SIMULATOR_OS),name=$(WATCHOS_DEVICE_NAME)' \ -configuration DebugV10 \ CODE_SIGNING_ALLOWED="NO" 2>&1 | tee raw-build-output.log | xcbeautify $(XCBEAUTIFY_OUTPUT_FLAGS) @@ -420,6 +423,16 @@ build-xcframework-static: @echo "[MAKE] $@: Compressing SentryV10.xcframework" ./scripts/compress-xcframework.sh --xcframework "SentryV10.xcframework" +## Build the standalone native utility library on all platforms +.PHONY: build-native-utils +build-native-utils: + @"$(MAKE)" build XCODE_SCHEME=SentryNativeUtils + +## Build the standalone profiling library on all platforms +.PHONY: build-profiling +build-profiling: + @"$(MAKE)" build XCODE_SCHEME=SentryProfiling + # ============================================================================ # TEST APPS # ============================================================================ @@ -1148,6 +1161,16 @@ test-testapp-tvOS-Swift-ui: xcode-ci-tvOS-Swift -destination 'platform=tvOS Simulator,OS=$(TVOS_SIMULATOR_OS),name=$(TVOS_DEVICE_NAME)' \ CODE_SIGNING_ALLOWED="NO" 2>&1 | xcbeautify --preserve-unbeautified +## Run native utility package tests on all platforms +.PHONY: test-native-utils +test-native-utils: + @"$(MAKE)" test ONLY_TESTING=SentryNativeUtilsTests + +## Run profiling package tests on all platforms +.PHONY: test-profiling +test-profiling: + @"$(MAKE)" test ONLY_TESTING=SentryProfilingTests + # ============================================================================ # LINTING & FORMATTING # ============================================================================ diff --git a/Package.swift b/Package.swift index 8241f9fda42..4e4ec0b3b37 100644 --- a/Package.swift +++ b/Package.swift @@ -121,9 +121,14 @@ if sourceUsesSentryModule { } else { products.append(.library(name: "SentrySPM", targets: ["SentryObjCInternal"])) } +products += [ + .library(name: "SentryNativeUtils", type: .static, targets: ["SentryNativeUtils"]), + .library(name: "SentryProfiling", type: .static, targets: ["SentryProfiling"]) +] + let sentrySwiftTarget: Target = .target( name: sentrySwiftTargetName, - dependencies: ["_SentryPrivate", "SentryHeaders"], + dependencies: ["_SentryPrivate", "SentryHeaders", "SentryNativeUtils", "SentryProfiling"], path: "Sources/Swift", cSettings: cSettings, swiftSettings: swiftSettings @@ -148,7 +153,9 @@ let sentryObjCInternalExcludes = [ "SentryObjCCompat", "SentryTestUtils", "SentryTestUtilsObjC", - "SentryTestUtilsObjCpp" + "SentryTestUtilsObjCpp", + "SentryNativeUtils", + "SentryProfiling" ] let sentryObjCInternalCSettings: [CSetting] = [ @@ -160,6 +167,16 @@ let sentryPrivateDependencies: [Target.Dependency] = [ ] targets += [ + // Shared Objective-C++ utilities only. No Swift sources or Swift target dependencies. + .target( + name: "SentryNativeUtils", + publicHeadersPath: "include" + ), + .target( + name: "SentryProfiling", + dependencies: ["SentryNativeUtils"], + publicHeadersPath: "include" + ), // At least one source file is required, therefore we use a dummy class to satisfy the SPM build system .target( name: "SentryHeaders", @@ -176,7 +193,7 @@ targets += [ ), .target( name: "_SentryPrivate", - dependencies: sentryPrivateDependencies, + dependencies: sentryPrivateDependencies + ["SentryNativeUtils", "SentryProfiling"], path: "Sources/Sentry", sources: ["SentryDummyPrivateEmptyClass.m"], publicHeadersPath: "include", @@ -187,7 +204,7 @@ targets += [ ] let sentryObjCInternalDependencies: [Target.Dependency] = [ - .target(name: sentrySwiftTargetName), .product(name: "Recording", package: "KSCrash") + .target(name: sentrySwiftTargetName), "SentryNativeUtils", "SentryProfiling", .product(name: "Recording", package: "KSCrash") ] targets += [ @@ -227,6 +244,23 @@ targets += [ ] // END:OBJC_WRAPPER +targets += [ + .target( + name: "SentryNativeUtilsTestSupport", + path: "Tests/SentryNativeUtilsTests/Support", + publicHeadersPath: "include" + ), + .testTarget( + name: "SentryNativeUtilsTests", + dependencies: ["SentryNativeUtils", "SentryNativeUtilsTestSupport"], + exclude: ["Support"] + ), + .testTarget( + name: "SentryProfilingTests", + dependencies: ["SentryProfiling"] + ) +] + targets += [ .target( name: "SentryTestUtilsObjC", @@ -293,7 +327,7 @@ targets += [ dependencies: [ .product(name: "Recording", package: "KSCrash"), .product(name: "RecordingCore", package: "KSCrash"), - .target(name: sentrySwiftTargetName), "_SentryPrivate", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp", + .target(name: sentrySwiftTargetName), "_SentryPrivate", "SentryNativeUtils", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp", .product(name: "SentryTestUtilsDynamic", package: "SentryTestUtilsDynamic", condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .visionOS])) ], path: "Tests/SentryTests", @@ -349,7 +383,7 @@ if !envSelectsV10 { targets += [ .testTarget( name: "SentryProfilerTests", - dependencies: [.target(name: sentrySwiftTargetName), "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp"], + dependencies: [.target(name: sentrySwiftTargetName), "SentryProfiling", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp"], path: "Tests/SentryProfilerTests", exclude: ["ObjC"], cSettings: cSettings, diff --git a/Package@swift-6.1.swift b/Package@swift-6.1.swift index 0c0bbf30cfc..d94dec5ac50 100644 --- a/Package@swift-6.1.swift +++ b/Package@swift-6.1.swift @@ -128,11 +128,16 @@ if sourceUsesSentryModule { products.append(.library(name: "SentrySPM", targets: ["SentryObjCInternal"])) } +products += [ + .library(name: "SentryNativeUtils", type: .static, targets: ["SentryNativeUtils"]), + .library(name: "SentryProfiling", type: .static, targets: ["SentryProfiling"]) +] + let sentrySwiftTarget: Target = .target( name: sentrySwiftTargetName, dependencies: [ "_SentryPrivate", - "SentryHeaders" + "SentryHeaders", "SentryNativeUtils", "SentryProfiling" ] + kscrashSwiftDependencies, path: "Sources/Swift", cSettings: cSettings, @@ -155,7 +160,9 @@ let sentryObjCInternalExcludes = [ "SentryObjCCompat", "SentryTestUtils", "SentryTestUtilsObjC", - "SentryTestUtilsObjCpp" + "SentryTestUtilsObjCpp", + "SentryNativeUtils", + "SentryProfiling" ] let sentryObjCInternalCSettings: [CSetting] = [ @@ -167,6 +174,16 @@ let sentryObjCInternalCSettings: [CSetting] = [ let sentryPrivateDependencies: [Target.Dependency] = ["SentryHeaders"] + kscrashDependencies targets += [ + // Shared Objective-C++ utilities only. No Swift sources or Swift target dependencies. + .target( + name: "SentryNativeUtils", + publicHeadersPath: "include" + ), + .target( + name: "SentryProfiling", + dependencies: ["SentryNativeUtils"], + publicHeadersPath: "include" + ), // At least one source file is required, therefore we use a dummy class to satisfy the SPM build system .target( name: "SentryHeaders", @@ -183,7 +200,7 @@ targets += [ ), .target( name: "_SentryPrivate", - dependencies: sentryPrivateDependencies, + dependencies: sentryPrivateDependencies + ["SentryNativeUtils", "SentryProfiling"], path: "Sources/Sentry", sources: ["SentryDummyPrivateEmptyClass.m"], publicHeadersPath: "include", @@ -193,7 +210,7 @@ targets += [ sentrySwiftTarget ] -let sentryObjCInternalDependencies: [Target.Dependency] = [.target(name: sentrySwiftTargetName)] + kscrashDependencies +let sentryObjCInternalDependencies: [Target.Dependency] = [.target(name: sentrySwiftTargetName), "SentryNativeUtils", "SentryProfiling"] + kscrashDependencies targets += [ // The SDK's ObjC/C sources use KSCrash in every source-build configuration. @@ -236,6 +253,23 @@ targets += [ // END:OBJC_WRAPPER // Swift 6.1 needs smaller expressions to type-check the test targets. +targets += [ + .target( + name: "SentryNativeUtilsTestSupport", + path: "Tests/SentryNativeUtilsTests/Support", + publicHeadersPath: "include" + ), + .testTarget( + name: "SentryNativeUtilsTests", + dependencies: ["SentryNativeUtils", "SentryNativeUtilsTestSupport"], + exclude: ["Support"] + ), + .testTarget( + name: "SentryProfilingTests", + dependencies: ["SentryProfiling"] + ) +] + targets += [ .target( name: "SentryTestUtilsObjC", @@ -319,7 +353,7 @@ targets += [ dependencies: [ .product(name: "Recording", package: "KSCrash"), .product(name: "RecordingCore", package: "KSCrash"), - .target(name: sentrySwiftTargetName), "_SentryPrivate", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp", + .target(name: sentrySwiftTargetName), "_SentryPrivate", "SentryNativeUtils", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp", .product(name: "SentryTestUtilsDynamic", package: "SentryTestUtilsDynamic", condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .visionOS])) ], path: "Tests/SentryTests", @@ -387,7 +421,7 @@ if !envSelectsV10 { targets += [ .testTarget( name: "SentryProfilerTests", - dependencies: [.target(name: sentrySwiftTargetName), "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp"], + dependencies: [.target(name: sentrySwiftTargetName), "SentryProfiling", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp"], path: "Tests/SentryProfilerTests", exclude: ["ObjC"], // Keep Swift's Clang importer consistent with the NoUI SDK declarations. diff --git a/Package@swift-6.2.swift b/Package@swift-6.2.swift index 000b2c660bb..bb145e365d9 100644 --- a/Package@swift-6.2.swift +++ b/Package@swift-6.2.swift @@ -127,9 +127,14 @@ if sourceUsesSentryModule { products.append(.library(name: "SentrySPM", targets: ["SentryObjCInternal"])) } +products += [ + .library(name: "SentryNativeUtils", type: .static, targets: ["SentryNativeUtils"]), + .library(name: "SentryProfiling", type: .static, targets: ["SentryProfiling"]) +] + let sentrySwiftTarget: Target = .target( name: sentrySwiftTargetName, - dependencies: ["_SentryPrivate", "SentryHeaders"] + kscrashSwiftDependencies, + dependencies: ["_SentryPrivate", "SentryHeaders", "SentryNativeUtils", "SentryProfiling"] + kscrashSwiftDependencies, path: "Sources/Swift", cSettings: cSettings, swiftSettings: [ @@ -151,7 +156,9 @@ let sentryObjCInternalExcludes = [ "SentryObjCCompat", "SentryTestUtils", "SentryTestUtilsObjC", - "SentryTestUtilsObjCpp" + "SentryTestUtilsObjCpp", + "SentryNativeUtils", + "SentryProfiling" ] let sentryObjCInternalCSettings: [CSetting] = [ @@ -163,6 +170,16 @@ let sentryObjCInternalCSettings: [CSetting] = [ let sentryPrivateDependencies: [Target.Dependency] = ["SentryHeaders"] + kscrashDependencies targets += [ + // Shared Objective-C++ utilities only. No Swift sources or Swift target dependencies. + .target( + name: "SentryNativeUtils", + publicHeadersPath: "include" + ), + .target( + name: "SentryProfiling", + dependencies: ["SentryNativeUtils"], + publicHeadersPath: "include" + ), // At least one source file is required, therefore we use a dummy class to satisfy the SPM build system .target( name: "SentryHeaders", @@ -179,7 +196,7 @@ targets += [ ), .target( name: "_SentryPrivate", - dependencies: sentryPrivateDependencies, + dependencies: sentryPrivateDependencies + ["SentryNativeUtils", "SentryProfiling"], path: "Sources/Sentry", sources: ["SentryDummyPrivateEmptyClass.m"], publicHeadersPath: "include", @@ -189,7 +206,7 @@ targets += [ sentrySwiftTarget ] -let sentryObjCInternalDependencies: [Target.Dependency] = [.target(name: sentrySwiftTargetName)] + kscrashDependencies +let sentryObjCInternalDependencies: [Target.Dependency] = [.target(name: sentrySwiftTargetName), "SentryNativeUtils", "SentryProfiling"] + kscrashDependencies targets += [ // The SDK's ObjC/C sources use KSCrash in every source-build configuration. @@ -232,6 +249,23 @@ targets += [ // END:OBJC_WRAPPER // Swift 6.1 needs smaller expressions to type-check the test targets. +targets += [ + .target( + name: "SentryNativeUtilsTestSupport", + path: "Tests/SentryNativeUtilsTests/Support", + publicHeadersPath: "include" + ), + .testTarget( + name: "SentryNativeUtilsTests", + dependencies: ["SentryNativeUtils", "SentryNativeUtilsTestSupport"], + exclude: ["Support"] + ), + .testTarget( + name: "SentryProfilingTests", + dependencies: ["SentryProfiling"] + ) +] + targets += [ .target( name: "SentryTestUtilsObjC", @@ -311,7 +345,7 @@ targets += [ dependencies: [ .product(name: "Recording", package: "KSCrash"), .product(name: "RecordingCore", package: "KSCrash"), - .target(name: sentrySwiftTargetName), "_SentryPrivate", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp", + .target(name: sentrySwiftTargetName), "_SentryPrivate", "SentryNativeUtils", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp", .product(name: "SentryTestUtilsDynamic", package: "SentryTestUtilsDynamic", condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .visionOS])) ], path: "Tests/SentryTests", @@ -378,7 +412,7 @@ if !envSelectsV10 { targets += [ .testTarget( name: "SentryProfilerTests", - dependencies: [.target(name: sentrySwiftTargetName), "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp"], + dependencies: [.target(name: sentrySwiftTargetName), "SentryProfiling", "SentryTestUtils", "SentryTestUtilsObjC", "SentryTestUtilsObjCpp"], path: "Tests/SentryProfilerTests", exclude: ["ObjC"], // Keep Swift's Clang importer consistent with the NoUI SDK declarations. diff --git a/Plans/SentrySPM_Base.xctestplan b/Plans/SentrySPM_Base.xctestplan index 850a04380fe..ecc53171b75 100644 --- a/Plans/SentrySPM_Base.xctestplan +++ b/Plans/SentrySPM_Base.xctestplan @@ -18,6 +18,22 @@ "uiTestingScreenshotsLifetime" : "keepAlways" }, "testTargets" : [ + { + "parallelizable" : false, + "target" : { + "containerPath" : "container:", + "identifier" : "SentryNativeUtilsTests", + "name" : "SentryNativeUtilsTests" + } + }, + { + "parallelizable" : false, + "target" : { + "containerPath" : "container:", + "identifier" : "SentryProfilingTests", + "name" : "SentryProfilingTests" + } + }, { "parallelizable" : false, "target" : { diff --git a/Plans/SentrySPM_Base_v10.xctestplan b/Plans/SentrySPM_Base_v10.xctestplan index 1ed9cd1dd5d..51d6c76e2c4 100644 --- a/Plans/SentrySPM_Base_v10.xctestplan +++ b/Plans/SentrySPM_Base_v10.xctestplan @@ -18,6 +18,22 @@ "uiTestingScreenshotsLifetime" : "keepAlways" }, "testTargets" : [ + { + "parallelizable" : false, + "target" : { + "containerPath" : "container:", + "identifier" : "SentryNativeUtilsTests", + "name" : "SentryNativeUtilsTests" + } + }, + { + "parallelizable" : false, + "target" : { + "containerPath" : "container:", + "identifier" : "SentryProfilingTests", + "name" : "SentryProfilingTests" + } + }, { "parallelizable" : false, "target" : { diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 3ba8921664d..58a87bd6d26 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -10,8 +10,6 @@ 01F8480438964E6B9718EC9F /* SentryAppStartMeasurementProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = A71411BCABB1428EB4403ADF /* SentryAppStartMeasurementProvider.m */; }; 03244A18FAB65DD14EC57511 /* SentryThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 639FCF9A1EBC7F9500778193 /* SentryThread.h */; settings = {ATTRIBUTES = (Public, ); }; }; 0354A22B2A134D9C003C3A04 /* SentryProfilerState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0354A22A2A134D9C003C3A04 /* SentryProfilerState.h */; }; - 03BCC38A27E1BF49003232C7 /* SentryTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 03BCC38927E1BF49003232C7 /* SentryTime.h */; }; - 03BCC38C27E1C01A003232C7 /* SentryTime.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03BCC38B27E1C01A003232C7 /* SentryTime.mm */; }; 03BCC38E27E2A377003232C7 /* SentryProfilingConditionals.h in Headers */ = {isa = PBXBuildFile; fileRef = 03BCC38D27E2A377003232C7 /* SentryProfilingConditionals.h */; settings = {ATTRIBUTES = (Public, ); }; }; 03F84D1E27DD414C008FE43F /* SentryBacktrace.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 03F84D1227DD414C008FE43F /* SentryBacktrace.hpp */; }; 03F84D2027DD414C008FE43F /* SentryStackBounds.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 03F84D1427DD414C008FE43F /* SentryStackBounds.hpp */; }; @@ -78,7 +76,6 @@ 2D5E6368F243BD9E50F52DC9 /* SentryProfileConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 84A898532E163072009A551E /* SentryProfileConfiguration.m */; }; 2DBD9AF64DD8E07D37CDB0A8 /* SentryHttpTransport.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DB3A684238EA75E00A2D442 /* SentryHttpTransport.m */; }; 2F6D0BFEC4980798559B1A7D /* SentryDefaultThreadInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA61CC7247D125400C130A8 /* SentryDefaultThreadInspector.h */; }; - 2FB295E09131448825C530C3 /* SentryTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 03BCC38927E1BF49003232C7 /* SentryTime.h */; }; 306D48F8D28A01CAFCD6E749 /* SentryDebugMeta.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B818F81EC34639002FDF4C /* SentryDebugMeta.m */; }; 30F63048F38B8D35ADB0D46E /* SentryDependencyContainerSwiftHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = FA3734832E0F07A20091EF24 /* SentryDependencyContainerSwiftHelper.h */; }; 32232D58C9A6629EC064F913 /* SentryAppStartMeasurement.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BD86ED0264A7CF6005439DB /* SentryAppStartMeasurement.m */; }; @@ -110,7 +107,6 @@ 4596C3C28EF42D2595F4F5ED /* SentryUser+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 92F6726A29C8B7B000BFD34D /* SentryUser+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; 45C8E1DB8096EBB6CC44F684 /* SentryMechanism.h in Headers */ = {isa = PBXBuildFile; fileRef = 6334313F20AD9AE40077E581 /* SentryMechanism.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4657D7E89BD8C2E7E7E7D620 /* SentryDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AA76951EB9C1C200D153DE /* SentryDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4669F176407FCF4A76976B4F /* SentryTime.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03BCC38B27E1C01A003232C7 /* SentryTime.mm */; }; 4694776C9EFEB40B24B09929 /* SentryDefaultTelemetryProcessorTransport.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BAD9EEF039B46468356FDDF /* SentryDefaultTelemetryProcessorTransport.m */; }; 46CDD1D13C80883B495BEED7 /* SentryProfiledTracerConcurrency.h in Headers */ = {isa = PBXBuildFile; fileRef = 84AF45A429A7FFA500FBB177 /* SentryProfiledTracerConcurrency.h */; }; 47F8DAF67E750E7C5BFE24A2 /* SentrySerializable.h in Headers */ = {isa = PBXBuildFile; fileRef = 6304360F1EC0600A00C4D3FA /* SentrySerializable.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -411,7 +407,7 @@ C9E96614E8011093607892E5 /* SentryAsyncLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 92D957762E05A4F300E20E66 /* SentryAsyncLog.h */; }; CAF2B94000CE4A4BB296A709 /* SentryAppStartMeasurementProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = A71411BCABB1428EB4403ADF /* SentryAppStartMeasurementProvider.m */; }; CB9CDE5081494DE2C04B0D06 /* SentryLogC.h in Headers */ = {isa = PBXBuildFile; fileRef = D8AE48B12C5786AA0092A2A6 /* SentryLogC.h */; settings = {ATTRIBUTES = (Private, ); }; }; - CBD8422997BBBBA27BE641A3 /* include/SentryProfileCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = FA7206DE2E0B37780072FDD4 /* include/SentryProfileCollector.h */; }; + CBD8422997BBBBA27BE641A3 /* SentryProfileCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = FA7206DE2E0B37780072FDD4 /* SentryProfileCollector.h */; }; CC06530E81A0C707283F09AE /* SentryViewHierarchyProviderHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A2D8DA6289BC905008720F6 /* SentryViewHierarchyProviderHelper.h */; }; CC1E10CC01D99BC0CB2F71B9 /* SentrySpanDataKey.h in Headers */ = {isa = PBXBuildFile; fileRef = D456B4372D706BFB007068CB /* SentrySpanDataKey.h */; }; CC3BD10624944F47A7BFA6A6 /* SentryContinuousProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 848A45172BBF8D33006AAAEC /* SentryContinuousProfiler.h */; }; @@ -430,6 +426,8 @@ D431C8BC301251A000A2F0DE /* SentryObjCExceptionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = D431C8BA301251A000A2F0DE /* SentryObjCExceptionHelper.m */; }; D431C8C3301251AE00A2F0DE /* SentryObjCExceptionHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = D431C8C2301251AE00A2F0DE /* SentryObjCExceptionHelper.h */; }; D431C8C4301251AE00A2F0DE /* SentryObjCExceptionHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = D431C8C2301251AE00A2F0DE /* SentryObjCExceptionHelper.h */; }; + D437E8A830B4A23600E15BFA /* libSentryNativeUtils.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D437E89A30B4A20200E15BFA /* libSentryNativeUtils.a */; }; + D437E8AB30B4A23D00E15BFA /* libSentryNativeUtils.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D437E89A30B4A20200E15BFA /* libSentryNativeUtils.a */; }; D43A2A102DD47FB700114724 /* SentryWeakMap.h in Headers */ = {isa = PBXBuildFile; fileRef = D43A2A0F2DD47FB700114724 /* SentryWeakMap.h */; }; D43A2A122DD47FCE00114724 /* SentryWeakMap.m in Sources */ = {isa = PBXBuildFile; fileRef = D43A2A112DD47FCE00114724 /* SentryWeakMap.m */; }; D43B26D62D70964C007747FD /* SentrySpanOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D43B26D52D709648007747FD /* SentrySpanOperation.m */; }; @@ -551,7 +549,7 @@ FA4FB82B2ECB7D2A008C9EC3 /* SentryLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4FB8252ECB7D27008C9EC3 /* SentryLevel.h */; settings = {ATTRIBUTES = (Public, ); }; }; FA6555142E30181B009917BC /* SentrySDKInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6555132E30181B009917BC /* SentrySDKInternal.h */; }; FA6555162E30182B009917BC /* SentrySDKInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = FA6555152E30182B009917BC /* SentrySDKInternal.m */; }; - FA7206DF2E0B37850072FDD4 /* include/SentryProfileCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = FA7206DE2E0B37780072FDD4 /* include/SentryProfileCollector.h */; }; + FA7206DF2E0B37850072FDD4 /* SentryProfileCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = FA7206DE2E0B37780072FDD4 /* SentryProfileCollector.h */; }; FA7206E12E0B37C80072FDD4 /* SentryProfileCollector.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA7206E02E0B37C60072FDD4 /* SentryProfileCollector.mm */; }; FA8A36182DEAA1EB0058D883 /* SentryThread+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */; }; FA90B7447D7C632AB8778A2B /* SentryNoOpSpan.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BE912AA272162AF00E49E62 /* SentryNoOpSpan.h */; }; @@ -575,10 +573,6 @@ FBB10000000000000000006D /* SentryProfilerCancellation.h in Headers */ = {isa = PBXBuildFile; fileRef = FBB100000000000000000005 /* SentryProfilerCancellation.h */; }; FBB10000000000000000006E /* SentryProfilerCancellation.m in Sources */ = {isa = PBXBuildFile; fileRef = FBB100000000000000000006 /* SentryProfilerCancellation.m */; }; FBB10000000000000000006F /* SentryProfilerCancellation.m in Sources */ = {isa = PBXBuildFile; fileRef = FBB100000000000000000006 /* SentryProfilerCancellation.m */; }; - FBD100000000000000000064 /* SentryProfilingSystemMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = FBD100000000000000000001 /* SentryProfilingSystemMetrics.h */; }; - FBD100000000000000000065 /* SentryProfilingSystemMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = FBD100000000000000000001 /* SentryProfilingSystemMetrics.h */; }; - FBD100000000000000000066 /* SentryProfilingSystemMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = FBD100000000000000000002 /* SentryProfilingSystemMetrics.m */; }; - FBD100000000000000000067 /* SentryProfilingSystemMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = FBD100000000000000000002 /* SentryProfilingSystemMetrics.m */; }; FBE100000000000000000064 /* SentryDefaultProfilerSDKBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FBE100000000000000000001 /* SentryDefaultProfilerSDKBackend.h */; }; FBE100000000000000000065 /* SentryDefaultProfilerSDKBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FBE100000000000000000001 /* SentryDefaultProfilerSDKBackend.h */; }; FBE100000000000000000066 /* SentryDefaultProfilerSDKBackend.m in Sources */ = {isa = PBXBuildFile; fileRef = FBE100000000000000000002 /* SentryDefaultProfilerSDKBackend.m */; }; @@ -597,6 +591,8 @@ FBE952000000000000000004 /* SentryProfilingLog.h in Headers */ = {isa = PBXBuildFile; fileRef = FBE952000000000000000001 /* SentryProfilingLog.h */; }; FBE952000000000000000005 /* SentryProfilingLog.m in Sources */ = {isa = PBXBuildFile; fileRef = FBE952000000000000000002 /* SentryProfilingLog.m */; }; FBE952000000000000000006 /* SentryProfilingLog.m in Sources */ = {isa = PBXBuildFile; fileRef = FBE952000000000000000002 /* SentryProfilingLog.m */; }; + FBE960000000000000000101 /* libSentryProfiling.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D437F0E830B4A30000E15BFA /* libSentryProfiling.a */; }; + FBE960000000000000000102 /* libSentryProfiling.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D437F0E830B4A30000E15BFA /* libSentryProfiling.a */; }; FC1100000000000000000064 /* SentryProfilingConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = FC1100000000000000000001 /* SentryProfilingConfiguration.h */; }; FC1100000000000000000065 /* SentryProfilingConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = FC1100000000000000000001 /* SentryProfilingConfiguration.h */; }; FC1100000000000000000066 /* SentryProfilingTraceDecision.h in Headers */ = {isa = PBXBuildFile; fileRef = FC1100000000000000000002 /* SentryProfilingTraceDecision.h */; }; @@ -617,6 +613,27 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + D437E8A930B4A23600E15BFA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6327C5CA1EB8A783004E799B /* Project object */; + proxyType = 1; + remoteGlobalIDString = D437E89930B4A20200E15BFA; + remoteInfo = SentryNativeUtils; + }; + D437E8AC30B4A23D00E15BFA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6327C5CA1EB8A783004E799B /* Project object */; + proxyType = 1; + remoteGlobalIDString = D437E89930B4A20200E15BFA; + remoteInfo = SentryNativeUtils; + }; + D437F0F730B4A30600E15BFA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6327C5CA1EB8A783004E799B /* Project object */; + proxyType = 1; + remoteGlobalIDString = D437E89930B4A20200E15BFA; + remoteInfo = SentryNativeUtils; + }; D49BE48B302E006500FF88D3 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 6327C5CA1EB8A783004E799B /* Project object */; @@ -645,9 +662,41 @@ remoteGlobalIDString = D4D86B9C2F6D4CF00078153D; remoteInfo = SentryObjCBridge; }; + FBE960000000000000000301 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6327C5CA1EB8A783004E799B /* Project object */; + proxyType = 1; + remoteGlobalIDString = D437F0E730B4A30000E15BFA; + remoteInfo = SentryProfiling; + }; + FBE960000000000000000302 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6327C5CA1EB8A783004E799B /* Project object */; + proxyType = 1; + remoteGlobalIDString = D437F0E730B4A30000E15BFA; + remoteInfo = SentryProfiling; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + D437E89830B4A20200E15BFA /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D437F0E630B4A30000E15BFA /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D49BE48D302E006500FF88D3 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -696,8 +745,6 @@ /* Begin PBXFileReference section */ 0354A22A2A134D9C003C3A04 /* SentryProfilerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryProfilerState.h; path = Sources/Sentry/include/SentryProfilerState.h; sourceTree = SOURCE_ROOT; }; - 03BCC38927E1BF49003232C7 /* SentryTime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryTime.h; path = Sources/Sentry/include/SentryTime.h; sourceTree = SOURCE_ROOT; }; - 03BCC38B27E1C01A003232C7 /* SentryTime.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = SentryTime.mm; path = Sources/Sentry/SentryTime.mm; sourceTree = SOURCE_ROOT; }; 03BCC38D27E2A377003232C7 /* SentryProfilingConditionals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryProfilingConditionals.h; path = ../Public/SentryProfilingConditionals.h; sourceTree = ""; }; 03F84D1227DD414C008FE43F /* SentryBacktrace.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = SentryBacktrace.hpp; path = Sources/Sentry/include/SentryBacktrace.hpp; sourceTree = SOURCE_ROOT; }; 03F84D1427DD414C008FE43F /* SentryStackBounds.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = SentryStackBounds.hpp; path = Sources/Sentry/include/SentryStackBounds.hpp; sourceTree = SOURCE_ROOT; }; @@ -948,6 +995,8 @@ D36813946B580095D0A8C6D2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; D431C8BA301251A000A2F0DE /* SentryObjCExceptionHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryObjCExceptionHelper.m; sourceTree = ""; }; D431C8C2301251AE00A2F0DE /* SentryObjCExceptionHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryObjCExceptionHelper.h; path = include/SentryObjCExceptionHelper.h; sourceTree = ""; }; + D437E89A30B4A20200E15BFA /* libSentryNativeUtils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSentryNativeUtils.a; sourceTree = BUILT_PRODUCTS_DIR; }; + D437F0E830B4A30000E15BFA /* libSentryProfiling.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSentryProfiling.a; sourceTree = BUILT_PRODUCTS_DIR; }; D43A2A0F2DD47FB700114724 /* SentryWeakMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryWeakMap.h; path = include/SentryWeakMap.h; sourceTree = ""; }; D43A2A112DD47FCE00114724 /* SentryWeakMap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryWeakMap.m; sourceTree = ""; }; D43B26D52D709648007747FD /* SentrySpanOperation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySpanOperation.m; sourceTree = ""; }; @@ -1041,7 +1090,7 @@ FA4FB8252ECB7D27008C9EC3 /* SentryLevel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryLevel.h; path = Public/SentryLevel.h; sourceTree = ""; }; FA6555132E30181B009917BC /* SentrySDKInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySDKInternal.h; path = include/SentrySDKInternal.h; sourceTree = ""; }; FA6555152E30182B009917BC /* SentrySDKInternal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySDKInternal.m; sourceTree = ""; }; - FA7206DE2E0B37780072FDD4 /* include/SentryProfileCollector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = include/SentryProfileCollector.h; sourceTree = ""; }; + FA7206DE2E0B37780072FDD4 /* SentryProfileCollector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfileCollector.h; path = include/SentryProfileCollector.h; sourceTree = ""; }; FA7206E02E0B37C60072FDD4 /* SentryProfileCollector.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryProfileCollector.mm; sourceTree = ""; }; FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryThread+Private.h"; path = "include/SentryThread+Private.h"; sourceTree = ""; }; FA914E952ED61AA300C54BDD /* SentryFormatterSwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryFormatterSwift.h; path = include/SentryFormatterSwift.h; sourceTree = ""; }; @@ -1057,8 +1106,6 @@ FBB100000000000000000004 /* SentryProfilingFrameMeasurements.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilingFrameMeasurements.m; sourceTree = ""; }; FBB100000000000000000005 /* SentryProfilerCancellation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilerCancellation.h; path = ../include/SentryProfilerCancellation.h; sourceTree = ""; }; FBB100000000000000000006 /* SentryProfilerCancellation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilerCancellation.m; sourceTree = ""; }; - FBD100000000000000000001 /* SentryProfilingSystemMetrics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingSystemMetrics.h; path = ../include/SentryProfilingSystemMetrics.h; sourceTree = ""; }; - FBD100000000000000000002 /* SentryProfilingSystemMetrics.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilingSystemMetrics.m; sourceTree = ""; }; FBE100000000000000000001 /* SentryDefaultProfilerSDKBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryDefaultProfilerSDKBackend.h; path = include/SentryDefaultProfilerSDKBackend.h; sourceTree = ""; }; FBE100000000000000000002 /* SentryDefaultProfilerSDKBackend.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryDefaultProfilerSDKBackend.m; sourceTree = ""; }; FBE100000000000000000003 /* SentryProfilingDispatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingDispatch.h; path = ../include/SentryProfilingDispatch.h; sourceTree = ""; }; @@ -1068,6 +1115,8 @@ FBE951000000000000000002 /* SentryProfilingSample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilingSample.m; sourceTree = ""; }; FBE952000000000000000001 /* SentryProfilingLog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingLog.h; path = ../include/SentryProfilingLog.h; sourceTree = ""; }; FBE952000000000000000002 /* SentryProfilingLog.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilingLog.m; sourceTree = ""; }; + FBE960000000000000000001 /* SentryNativeUtils.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = SentryNativeUtils.xcconfig; path = Sources/Configuration/SentryNativeUtils.xcconfig; sourceTree = SOURCE_ROOT; }; + FBE960000000000000000002 /* SentryProfiling.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = SentryProfiling.xcconfig; path = Sources/Configuration/SentryProfiling.xcconfig; sourceTree = SOURCE_ROOT; }; FC1100000000000000000001 /* SentryProfilingConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingConfiguration.h; path = ../include/SentryProfilingConfiguration.h; sourceTree = ""; }; FC1100000000000000000002 /* SentryProfilingTraceDecision.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingTraceDecision.h; path = ../include/SentryProfilingTraceDecision.h; sourceTree = ""; }; FC1100000000000000000003 /* SentryProfilerConfigurationBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilerConfigurationBridge.h; path = include/SentryProfilerConfigurationBridge.h; sourceTree = ""; }; @@ -1290,6 +1339,8 @@ /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ + D437F93930B4A67A00E15BFA /* SentryNativeUtils */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SentryNativeUtils; sourceTree = ""; }; + D437F94030B4A67A00E15BFA /* SentryProfiling */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SentryProfiling; sourceTree = ""; }; D4CB395D2F6AEEE6005250F2 /* SentryObjC */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (D4CB399B2F6AEF99005250F2 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, D49B440B302E0DA500FF88D3 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = SentryObjC; sourceTree = ""; }; D4CB39972F6AEF01005250F2 /* SentryObjCCompat */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SentryObjCCompat; sourceTree = ""; }; FA2111C32F22CE8C00DFFABE /* Swift */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Swift; sourceTree = ""; }; @@ -1300,7 +1351,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FBE960000000000000000102 /* libSentryProfiling.a in Frameworks */, 5E97D595C205DFAA28813138 /* SystemConfiguration.framework in Frameworks */, + D437E8AB30B4A23D00E15BFA /* libSentryNativeUtils.a in Frameworks */, 1D39B749E2C0B09067076027 /* CoreData.framework in Frameworks */, 3CB64C903029D35800ED9B67 /* Recording in Frameworks */, B3418ABC1AC38F349A9E2CE6 /* libz.tbd in Frameworks */, @@ -1320,12 +1373,28 @@ buildActionMask = 2147483647; files = ( A83190000000000000000001 /* Recording in Frameworks */, + FBE960000000000000000101 /* libSentryProfiling.a in Frameworks */, 84F994E82A6894BD00EC0190 /* SystemConfiguration.framework in Frameworks */, + D437E8A830B4A23600E15BFA /* libSentryNativeUtils.a in Frameworks */, 84F994E62A6894B500EC0190 /* CoreData.framework in Frameworks */, 63AF656C1ED87B8C00EBCFF7 /* libz.tbd in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; + D437E89730B4A20200E15BFA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D437F0E530B4A30000E15BFA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D49BE427302DFF3000FF88D3 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1492,6 +1561,8 @@ 0787B53CA34AC1B3CF256F35 /* Sentry.framework */, D49BE436302DFF3000FF88D3 /* SentryObjCCompat.framework */, D49BE469302DFF3300FF88D3 /* SentryObjC.framework */, + D437E89A30B4A20200E15BFA /* libSentryNativeUtils.a */, + D437F0E830B4A30000E15BFA /* libSentryProfiling.a */, ); name = Products; sourceTree = ""; @@ -1616,6 +1687,8 @@ FA2111C32F22CE8C00DFFABE /* Swift */, 63AA75A31EB8AFDF00D153DE /* Configuration */, D8B0542F2A7D35F10056BAF6 /* Resources */, + D437F93930B4A67A00E15BFA /* SentryNativeUtils */, + D437F94030B4A67A00E15BFA /* SentryProfiling */, D4CB39972F6AEF01005250F2 /* SentryObjCCompat */, D4CB395D2F6AEEE6005250F2 /* SentryObjC */, ); @@ -1625,6 +1698,8 @@ 63AA75A31EB8AFDF00D153DE /* Configuration */ = { isa = PBXGroup; children = ( + FBE960000000000000000002 /* SentryProfiling.xcconfig */, + FBE960000000000000000001 /* SentryNativeUtils.xcconfig */, 84EACEDF2C3DCAE2009B8753 /* DeploymentTargets.xcconfig */, D8BD2E27292D1F7300D96C6A /* SDK.xcconfig */, 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */, @@ -1659,7 +1734,7 @@ D8B665BA2B95F54200BD0E7B /* SentryPrivate.h */, A7C0DE010000000000000004 /* SentryDeprecated+Private.h */, D8BBD32628FD9FBF0011F850 /* SentrySwift.h */, - FA7206DE2E0B37780072FDD4 /* include/SentryProfileCollector.h */, + FA7206DE2E0B37780072FDD4 /* SentryProfileCollector.h */, FA7206E02E0B37C60072FDD4 /* SentryProfileCollector.mm */, 63AA76941EB9C1C200D153DE /* SentryClient.h */, 63AA75ED1EB8B3C400D153DE /* SentryClient.m */, @@ -1827,8 +1902,6 @@ FC1100000000000000000001 /* SentryProfilingConfiguration.h */, FC1100000000000000000002 /* SentryProfilingTraceDecision.h */, FBE100000000000000000003 /* SentryProfilingDispatch.h */, - FBD100000000000000000001 /* SentryProfilingSystemMetrics.h */, - FBD100000000000000000002 /* SentryProfilingSystemMetrics.m */, FBB100000000000000000001 /* SentryProfilingTimestamp.h */, FBB100000000000000000002 /* SentryProfilingCancellation.h */, FBB100000000000000000003 /* SentryProfilingFrameMeasurements.h */, @@ -1864,8 +1937,6 @@ 03F84D2D27DD4191008FE43F /* SentryThreadMetadataCache.cpp */, 03F84D1A27DD414C008FE43F /* SentryThreadMetadataCache.hpp */, 03F84D1927DD414C008FE43F /* SentryThreadState.hpp */, - 03BCC38927E1BF49003232C7 /* SentryTime.h */, - 03BCC38B27E1C01A003232C7 /* SentryTime.mm */, F40C5EC52F3BC7EE00CAEC02 /* SentryProfileDebugLoggerHelper.h */, F40C5EC32F3BC7DE00CAEC02 /* SentryProfileDebugLoggerHelper.m */, ); @@ -2047,7 +2118,6 @@ 84354E1129BF944900CDBB8B /* SentryProfileTimeseries.h in Headers */, 0A2D8DA8289BC905008720F6 /* SentryViewHierarchyProviderHelper.h in Headers */, 8EAE980C261E9F530073B6B3 /* SentryDefaultUIViewControllerPerformanceTracker.h in Headers */, - 03BCC38A27E1BF49003232C7 /* SentryTime.h in Headers */, 33EB2A912C3412E4004FED3D /* SentryWithoutUIKit.h in Headers */, 639FCFAC1EBC811400778193 /* SentryUser.h in Headers */, 639FCFA41EBC809A00778193 /* SentryStacktrace.h in Headers */, @@ -2121,7 +2191,6 @@ FC1100000000000000000068 /* SentryProfilerConfigurationBridge.h in Headers */, FBE100000000000000000064 /* SentryDefaultProfilerSDKBackend.h in Headers */, FBE100000000000000000068 /* SentryProfilingDispatch.h in Headers */, - FBD100000000000000000064 /* SentryProfilingSystemMetrics.h in Headers */, FBB100000000000000000064 /* SentryProfilingTimestamp.h in Headers */, FBB100000000000000000066 /* SentryProfilingCancellation.h in Headers */, FBB100000000000000000068 /* SentryProfilingFrameMeasurements.h in Headers */, @@ -2163,7 +2232,7 @@ 7B4E375525822C4500059C93 /* SentryAttachment.h in Headers */, 639FCFA81EBC80CC00778193 /* SentryFrame.h in Headers */, 639889BB1EDED18400EA7442 /* SentrySwizzle.h in Headers */, - FA7206DF2E0B37850072FDD4 /* include/SentryProfileCollector.h in Headers */, + FA7206DF2E0B37850072FDD4 /* SentryProfileCollector.h in Headers */, 622C08DB29E554B9002571D4 /* SentrySpanContext+Private.h in Headers */, 84A898552E163072009A551E /* SentryProfileConfiguration.h in Headers */, FA24E02A2EBBF6F900EFD92E /* SentryOptionsObjC.h in Headers */, @@ -2240,7 +2309,6 @@ 44139C0AA43C64762928AD9C /* SentryProfileTimeseries.h in Headers */, CC06530E81A0C707283F09AE /* SentryViewHierarchyProviderHelper.h in Headers */, C913B433BE54EE153DD3F2D9 /* SentryDefaultUIViewControllerPerformanceTracker.h in Headers */, - 2FB295E09131448825C530C3 /* SentryTime.h in Headers */, 6E8D865F6F6E856575172B2F /* SentryWithoutUIKit.h in Headers */, CE5687964615B43269F8EB7B /* SentryUser.h in Headers */, 3A8CEED46B48729C712F82FE /* SentryStacktrace.h in Headers */, @@ -2315,7 +2383,6 @@ FC1100000000000000000069 /* SentryProfilerConfigurationBridge.h in Headers */, FBE100000000000000000065 /* SentryDefaultProfilerSDKBackend.h in Headers */, FBE100000000000000000069 /* SentryProfilingDispatch.h in Headers */, - FBD100000000000000000065 /* SentryProfilingSystemMetrics.h in Headers */, FBB100000000000000000065 /* SentryProfilingTimestamp.h in Headers */, FBB100000000000000000067 /* SentryProfilingCancellation.h in Headers */, FBB100000000000000000069 /* SentryProfilingFrameMeasurements.h in Headers */, @@ -2357,7 +2424,7 @@ CFE872CFAD1A1E4630CD8102 /* SentryAttachment.h in Headers */, E6C8D0A8A0DE911C2F35E45A /* SentryFrame.h in Headers */, 67302975F220F3342465788C /* SentrySwizzle.h in Headers */, - CBD8422997BBBBA27BE641A3 /* include/SentryProfileCollector.h in Headers */, + CBD8422997BBBBA27BE641A3 /* SentryProfileCollector.h in Headers */, 87FF3FC05644DE556004D3F0 /* SentrySpanContext+Private.h in Headers */, 1F822F24E23A949B5165C6CF /* SentryProfileConfiguration.h in Headers */, 3DC0F52DC65298EA3C0DDEA5 /* SentryOptionsObjC.h in Headers */, @@ -2401,6 +2468,8 @@ buildRules = ( ); dependencies = ( + FBE960000000000000000201 /* PBXTargetDependency */, + D437E8AA30B4A23600E15BFA /* PBXTargetDependency */, ); fileSystemSynchronizedGroups = ( FA2111C32F22CE8C00DFFABE /* Swift */, @@ -2436,6 +2505,51 @@ productReference = 6E190D66E13B263953A7FB3A /* SentryObjC.framework */; productType = "com.apple.product-type.framework"; }; + D437E89930B4A20200E15BFA /* SentryNativeUtils */ = { + isa = PBXNativeTarget; + buildConfigurationList = D437E8A730B4A20200E15BFA /* Build configuration list for PBXNativeTarget "SentryNativeUtils" */; + buildPhases = ( + D437E89630B4A20200E15BFA /* Sources */, + D437E89730B4A20200E15BFA /* Frameworks */, + D437E89830B4A20200E15BFA /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + D437F93930B4A67A00E15BFA /* SentryNativeUtils */, + ); + name = SentryNativeUtils; + packageProductDependencies = ( + ); + productName = SentryNativeUtils; + productReference = D437E89A30B4A20200E15BFA /* libSentryNativeUtils.a */; + productType = "com.apple.product-type.library.static"; + }; + D437F0E730B4A30000E15BFA /* SentryProfiling */ = { + isa = PBXNativeTarget; + buildConfigurationList = D437F0F530B4A30000E15BFA /* Build configuration list for PBXNativeTarget "SentryProfiling" */; + buildPhases = ( + D437F0E430B4A30000E15BFA /* Sources */, + D437F0E530B4A30000E15BFA /* Frameworks */, + D437F0E630B4A30000E15BFA /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + D437F0F830B4A30600E15BFA /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + D437F94030B4A67A00E15BFA /* SentryProfiling */, + ); + name = SentryProfiling; + packageProductDependencies = ( + ); + productName = SentryProfiling; + productReference = D437F0E830B4A30000E15BFA /* libSentryProfiling.a */; + productType = "com.apple.product-type.library.static"; + }; D49BE422302DFF3000FF88D3 /* SentryObjCCompatV10 */ = { isa = PBXNativeTarget; buildConfigurationList = D49BE42C302DFF3000FF88D3 /* Build configuration list for PBXNativeTarget "SentryObjCCompatV10" */; @@ -2518,6 +2632,8 @@ buildRules = ( ); dependencies = ( + FBE960000000000000000202 /* PBXTargetDependency */, + D437E8AD30B4A23D00E15BFA /* PBXTargetDependency */, ); fileSystemSynchronizedGroups = ( FA2111C32F22CE8C00DFFABE /* Swift */, @@ -2545,6 +2661,12 @@ LastSwiftMigration = 1410; ProvisioningStyle = Manual; }; + D437E89930B4A20200E15BFA = { + CreatedOnToolsVersion = 27.2; + }; + D437F0E730B4A30000E15BFA = { + CreatedOnToolsVersion = 27.2; + }; D4D86B9C2F6D4CF00078153D = { CreatedOnToolsVersion = 26.3; }; @@ -2572,6 +2694,8 @@ D49BE422302DFF3000FF88D3 /* SentryObjCCompatV10 */, 6ECCF11F627ECB41E3A0C7E3 /* SentryObjC */, D49BE455302DFF3300FF88D3 /* SentryObjCV10 */, + D437E89930B4A20200E15BFA /* SentryNativeUtils */, + D437F0E730B4A30000E15BFA /* SentryProfiling */, ); }; /* End PBXProject section */ @@ -2693,7 +2817,6 @@ F49D419E2DEA3D0600D9244E /* SentryNSExceptionCaptureHelper.m in Sources */, D8ACE3C82762187200F5A213 /* SentryFileIOTrackerHelper.m in Sources */, FA7206E12E0B37C80072FDD4 /* SentryProfileCollector.mm in Sources */, - 03BCC38C27E1C01A003232C7 /* SentryTime.mm in Sources */, 62C97D3A2CC64E6B00DDA204 /* SentryUncaughtNSExceptions.m in Sources */, 03F84D3727DD4191008FE43F /* SentrySamplingProfiler.cpp in Sources */, 8453421628BE8A9500C22EEC /* SentrySpanStatus.m in Sources */, @@ -2724,7 +2847,6 @@ FC2100000000000000000066 /* SentryProfilerDeliveryBridge.m in Sources */, FC110000000000000000006A /* SentryProfilerConfigurationBridge.m in Sources */, FBE100000000000000000066 /* SentryDefaultProfilerSDKBackend.m in Sources */, - FBD100000000000000000066 /* SentryProfilingSystemMetrics.m in Sources */, FBB10000000000000000006A /* SentryProfilingFrameMeasurements.m in Sources */, FBB10000000000000000006E /* SentryProfilerCancellation.m in Sources */, FBE950000000000000000005 /* SentryProfilingId.m in Sources */, @@ -2837,7 +2959,6 @@ 3BA6456A86B5D262DAFCEA6B /* SentryNSExceptionCaptureHelper.m in Sources */, 36793D66F487DEBEA04EE89D /* SentryFileIOTrackerHelper.m in Sources */, 0AACAEC18BF3A5EF9D0DDB0E /* SentryProfileCollector.mm in Sources */, - 4669F176407FCF4A76976B4F /* SentryTime.mm in Sources */, 14FAA7642027A1BAE8EA1180 /* SentryUncaughtNSExceptions.m in Sources */, 3C0B2C89E044195F8220E78E /* SentrySamplingProfiler.cpp in Sources */, 265DAE4B652CD3ADCB8135B0 /* SentrySpanStatus.m in Sources */, @@ -2868,7 +2989,6 @@ FC2100000000000000000067 /* SentryProfilerDeliveryBridge.m in Sources */, FC110000000000000000006B /* SentryProfilerConfigurationBridge.m in Sources */, FBE100000000000000000067 /* SentryDefaultProfilerSDKBackend.m in Sources */, - FBD100000000000000000067 /* SentryProfilingSystemMetrics.m in Sources */, FBB10000000000000000006B /* SentryProfilingFrameMeasurements.m in Sources */, FBB10000000000000000006F /* SentryProfilerCancellation.m in Sources */, FBE950000000000000000006 /* SentryProfilingId.m in Sources */, @@ -2957,6 +3077,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D437E89630B4A20200E15BFA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D437F0E430B4A30000E15BFA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D49BE426302DFF3000FF88D3 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2981,6 +3115,21 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + D437E8AA30B4A23600E15BFA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D437E89930B4A20200E15BFA /* SentryNativeUtils */; + targetProxy = D437E8A930B4A23600E15BFA /* PBXContainerItemProxy */; + }; + D437E8AD30B4A23D00E15BFA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D437E89930B4A20200E15BFA /* SentryNativeUtils */; + targetProxy = D437E8AC30B4A23D00E15BFA /* PBXContainerItemProxy */; + }; + D437F0F830B4A30600E15BFA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D437E89930B4A20200E15BFA /* SentryNativeUtils */; + targetProxy = D437F0F730B4A30600E15BFA /* PBXContainerItemProxy */; + }; D49BE48C302E006500FF88D3 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D49BE422302DFF3000FF88D3 /* SentryObjCCompatV10 */; @@ -3001,6 +3150,16 @@ target = D4D86B9C2F6D4CF00078153D /* SentryObjCCompat */; targetProxy = D4D86BB52F6D4D2E0078153D /* PBXContainerItemProxy */; }; + FBE960000000000000000201 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D437F0E730B4A30000E15BFA /* SentryProfiling */; + targetProxy = FBE960000000000000000301 /* PBXContainerItemProxy */; + }; + FBE960000000000000000202 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D437F0E730B4A30000E15BFA /* SentryProfiling */; + targetProxy = FBE960000000000000000302 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -3166,11 +3325,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 37D207F61D348FDFC964BCE0 /* SentryV10.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = ReleaseWithoutUIKit; }; @@ -3218,11 +3372,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 37D207F61D348FDFC964BCE0 /* SentryV10.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = DebugWithoutUIKit; }; @@ -3299,11 +3448,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = Debug; }; @@ -3311,11 +3455,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = Release; }; @@ -3323,11 +3462,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 37D207F61D348FDFC964BCE0 /* SentryV10.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = DebugV10; }; @@ -3477,11 +3611,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = DebugWithoutUIKit; }; @@ -3504,11 +3633,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = ReleaseWithoutUIKit; }; @@ -3516,11 +3640,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = DebugV10; }; @@ -3528,14 +3647,93 @@ isa = XCBuildConfiguration; baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = ReleaseV10; }; + D437E8A030B4A20200E15BFA /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000001 /* SentryNativeUtils.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + D437E8A130B4A20200E15BFA /* DebugWithoutUIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000001 /* SentryNativeUtils.xcconfig */; + buildSettings = { + }; + name = DebugWithoutUIKit; + }; + D437E8A230B4A20200E15BFA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000001 /* SentryNativeUtils.xcconfig */; + buildSettings = { + }; + name = Release; + }; + D437E8A330B4A20200E15BFA /* DebugV10 */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000001 /* SentryNativeUtils.xcconfig */; + buildSettings = { + }; + name = DebugV10; + }; + D437E8A430B4A20200E15BFA /* ReleaseV10 */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000001 /* SentryNativeUtils.xcconfig */; + buildSettings = { + }; + name = ReleaseV10; + }; + D437E8A530B4A20200E15BFA /* ReleaseWithoutUIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000001 /* SentryNativeUtils.xcconfig */; + buildSettings = { + }; + name = ReleaseWithoutUIKit; + }; + D437F0EE30B4A30000E15BFA /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000002 /* SentryProfiling.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + D437F0EF30B4A30000E15BFA /* DebugWithoutUIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000002 /* SentryProfiling.xcconfig */; + buildSettings = { + }; + name = DebugWithoutUIKit; + }; + D437F0F030B4A30000E15BFA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000002 /* SentryProfiling.xcconfig */; + buildSettings = { + }; + name = Release; + }; + D437F0F130B4A30000E15BFA /* DebugV10 */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000002 /* SentryProfiling.xcconfig */; + buildSettings = { + }; + name = DebugV10; + }; + D437F0F230B4A30000E15BFA /* ReleaseV10 */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000002 /* SentryProfiling.xcconfig */; + buildSettings = { + }; + name = ReleaseV10; + }; + D437F0F330B4A30000E15BFA /* ReleaseWithoutUIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FBE960000000000000000002 /* SentryProfiling.xcconfig */; + buildSettings = { + }; + name = ReleaseWithoutUIKit; + }; D49BE42D302DFF3000FF88D3 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = D49B51CE302E118500FF88D3 /* SentryObjCCompatV10.xcconfig */; @@ -4663,11 +4861,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 37D207F61D348FDFC964BCE0 /* SentryV10.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = ReleaseV10; }; @@ -4714,11 +4907,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 37D207F61D348FDFC964BCE0 /* SentryV10.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = Debug; }; @@ -4726,11 +4914,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 37D207F61D348FDFC964BCE0 /* SentryV10.xcconfig */; buildSettings = { - CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; - OTHER_CFLAGS = ( - "-Wnullable-to-nonnull-conversion", - "-Wnullability-completeness", - ); }; name = Release; }; @@ -4816,6 +4999,32 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + D437E8A730B4A20200E15BFA /* Build configuration list for PBXNativeTarget "SentryNativeUtils" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D437E8A030B4A20200E15BFA /* Debug */, + D437E8A130B4A20200E15BFA /* DebugWithoutUIKit */, + D437E8A230B4A20200E15BFA /* Release */, + D437E8A330B4A20200E15BFA /* DebugV10 */, + D437E8A430B4A20200E15BFA /* ReleaseV10 */, + D437E8A530B4A20200E15BFA /* ReleaseWithoutUIKit */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D437F0F530B4A30000E15BFA /* Build configuration list for PBXNativeTarget "SentryProfiling" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D437F0EE30B4A30000E15BFA /* Debug */, + D437F0EF30B4A30000E15BFA /* DebugWithoutUIKit */, + D437F0F030B4A30000E15BFA /* Release */, + D437F0F130B4A30000E15BFA /* DebugV10 */, + D437F0F230B4A30000E15BFA /* ReleaseV10 */, + D437F0F330B4A30000E15BFA /* ReleaseWithoutUIKit */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; D49BE42C302DFF3000FF88D3 /* Build configuration list for PBXNativeTarget "SentryObjCCompatV10" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Sentry.xcodeproj/xcshareddata/xcschemes/SentryNativeUtils.xcscheme b/Sentry.xcodeproj/xcshareddata/xcschemes/SentryNativeUtils.xcscheme new file mode 100644 index 00000000000..6ae78929fe6 --- /dev/null +++ b/Sentry.xcodeproj/xcshareddata/xcschemes/SentryNativeUtils.xcscheme @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Sentry.xcodeproj/xcshareddata/xcschemes/SentryProfiling.xcscheme b/Sentry.xcodeproj/xcshareddata/xcschemes/SentryProfiling.xcscheme new file mode 100644 index 00000000000..cb2e8d727d1 --- /dev/null +++ b/Sentry.xcodeproj/xcshareddata/xcschemes/SentryProfiling.xcscheme @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Sources/AGENTS.md b/Sources/AGENTS.md index 35b8c33a509..27a9d4d5e8c 100644 --- a/Sources/AGENTS.md +++ b/Sources/AGENTS.md @@ -2,6 +2,13 @@ > Scope: `Sources/**`. Also follow [root instructions](../AGENTS.md). +## Native Utilities + +- `Sources/SentryNativeUtils` is a shared Objective-C++ utility library +- Implement utilities in `.mm` files with C, Objective-C, or C++ headers as needed +- Do not add Swift sources or dependencies on Swift targets +- Keep it independent of SDK implementation code and crash backends + ## Objective-C - Prefer Swift for new code when target boundaries allow it diff --git a/Sources/Configuration/SDK.xcconfig b/Sources/Configuration/SDK.xcconfig index 47b76618f2f..836557192da 100644 --- a/Sources/Configuration/SDK.xcconfig +++ b/Sources/Configuration/SDK.xcconfig @@ -43,7 +43,7 @@ CLANG_CXX_LIBRARY = libc++ // This config is required so the code can access the SentryPrivate module. Removing this setting // leads to an error Module _SentryPrivate not found in the SentryTests-Swift.h header when import the // SentryPrivate module with @import _SentryPrivate. -HEADER_SEARCH_PATHS = $(SRCROOT)/Sources/Sentry/include/** +HEADER_SEARCH_PATHS = $(SRCROOT)/Sources/Sentry/include/** $(SRCROOT)/Sources/SentryNativeUtils/include $(SRCROOT)/Sources/SentryProfiling/include SWIFT_ACTIVE_COMPILATION_CONDITIONS_Debug = DEBUG SWIFT_ACTIVE_COMPILATION_CONDITIONS_DebugV10 = SDK_V10 DEBUG diff --git a/Sources/Configuration/Sentry.xcconfig b/Sources/Configuration/Sentry.xcconfig index 8c9e1e0e904..9546970be04 100644 --- a/Sources/Configuration/Sentry.xcconfig +++ b/Sources/Configuration/Sentry.xcconfig @@ -1,5 +1,12 @@ #include "DeploymentTargets.xcconfig" +SENTRY_SDK_MACH_O_TYPE = mh_dylib +MACH_O_TYPE = $(SENTRY_SDK_MACH_O_TYPE) + +// Retain the existing C exports on platforms without internal callers, such as watchOS. +SENTRY_NATIVE_UTILS_EXPORTS_mh_dylib = -u _timeIntervalToNanoseconds +OTHER_LDFLAGS = $(inherited) $(SENTRY_NATIVE_UTILS_EXPORTS_$(MACH_O_TYPE)) + INFOPLIST_FILE = Sources/Resources/Info.plist SENTRY_MODULE_NAME = Sentry @@ -7,7 +14,7 @@ SENTRY_WITHOUT_UIKIT_MODULE_NAME = SentryWithoutUIKit // This config is required so the test code can access the SentryPrivate module. Removing this setting // leads to an error: no such module '_SentryPrivate' when including the XCFramework -HEADER_SEARCH_PATHS = $(SRCROOT)/Sources/Sentry/include/** $(SRCROOT)/Sources/Sentry/Public +HEADER_SEARCH_PATHS = $(SRCROOT)/Sources/Sentry/include/** $(SRCROOT)/Sources/Sentry/Public $(SRCROOT)/Sources/SentryNativeUtils/include $(SRCROOT)/Sources/SentryProfiling/include PRODUCT_MODULE_NAME_Debug = $(SENTRY_MODULE_NAME) PRODUCT_MODULE_NAME_DebugV10 = $(SENTRY_MODULE_NAME) diff --git a/Sources/Configuration/SentryNativeUtils.xcconfig b/Sources/Configuration/SentryNativeUtils.xcconfig new file mode 100644 index 00000000000..21e4bf62540 --- /dev/null +++ b/Sources/Configuration/SentryNativeUtils.xcconfig @@ -0,0 +1,20 @@ +// Native utilities are implemented in Objective-C++ (.mm), never Swift. +// Keep this target independent of Swift targets and the SDK implementation. +#include "DeploymentTargets.xcconfig" + +MACH_O_TYPE = staticlib +DEFINES_MODULE = YES +PRODUCT_NAME = SentryNativeUtils +PRODUCT_MODULE_NAME = SentryNativeUtils +SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator xros xrsimulator +TARGETED_DEVICE_FAMILY = 1,2,3,4,7 +SUPPORTS_MACCATALYST = YES +ARCHS = $(ARCHS_STANDARD) arm64e +ARCHS[sdk=*simulator] = $(ARCHS_STANDARD) +SKIP_INSTALL = YES +HEADER_SEARCH_PATHS = $(SRCROOT)/Sources/SentryNativeUtils/include $(SRCROOT)/Sources/SentryNativeUtils/include +MODULEMAP_FILE = $(SRCROOT)/Sources/SentryNativeUtils/include/module.modulemap +OTHER_LDFLAGS = +OTHER_LDFLAGS[sdk=watch*] = +CODE_SIGN_IDENTITY = +DEVELOPMENT_TEAM = diff --git a/Sources/Configuration/SentryProfiling.xcconfig b/Sources/Configuration/SentryProfiling.xcconfig new file mode 100644 index 00000000000..b746251cda9 --- /dev/null +++ b/Sources/Configuration/SentryProfiling.xcconfig @@ -0,0 +1,18 @@ +#include "DeploymentTargets.xcconfig" + +MACH_O_TYPE = staticlib +DEFINES_MODULE = YES +PRODUCT_NAME = SentryProfiling +PRODUCT_MODULE_NAME = SentryProfiling +SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator xros xrsimulator +TARGETED_DEVICE_FAMILY = 1,2,3,4,7 +SUPPORTS_MACCATALYST = YES +ARCHS = $(ARCHS_STANDARD) arm64e +ARCHS[sdk=*simulator] = $(ARCHS_STANDARD) +SKIP_INSTALL = YES +HEADER_SEARCH_PATHS = $(SRCROOT)/Sources/SentryProfiling/include $(SRCROOT)/Sources/SentryNativeUtils/include +MODULEMAP_FILE = $(SRCROOT)/Sources/SentryProfiling/include/module.modulemap +OTHER_LDFLAGS = +OTHER_LDFLAGS[sdk=watch*] = +CODE_SIGN_IDENTITY = +DEVELOPMENT_TEAM = diff --git a/Sources/Configuration/SentryV10.xcconfig b/Sources/Configuration/SentryV10.xcconfig index 2135d270e53..78df732727a 100644 --- a/Sources/Configuration/SentryV10.xcconfig +++ b/Sources/Configuration/SentryV10.xcconfig @@ -17,10 +17,8 @@ PRODUCT_NAME = $(PRODUCT_MODULE_NAME) // can find SentryProfilingConditionals.h (a public header not under include/). HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/Sources/Sentry/Public -// Dynamic framework — keeps SentryV10 consistent with the rest of the SDK xcframework -// builds. Declared here rather than as a global xcodebuild command-line override so it does -// NOT propagate to KSCrash SPM package sub-targets (which have their own product types). -MACH_O_TYPE = mh_dylib +// Change only the SDK product type, not its static-library dependencies. +MACH_O_TYPE = $(SENTRY_SDK_MACH_O_TYPE) // There is a 'bug' in Xcode that doesn't build arm64e slices for SPM depedendencies // regardless of the Xcode settings. This can somewhat be worked around diff --git a/Sources/Sentry/include/SentryPrivate.h b/Sources/Sentry/include/SentryPrivate.h index cc2d90e4749..732f9339467 100644 --- a/Sources/Sentry/include/SentryPrivate.h +++ b/Sources/Sentry/include/SentryPrivate.h @@ -26,7 +26,6 @@ #import "SentrySessionReplaySyncC.h" #import "SentrySwizzleWrapperHelper.h" #import "SentryThreadCrumb.h" -#import "SentryTime.h" #import "SentryTracer.h" #import "SentryViewHierarchyProviderHelper.h" #import "_SentryDispatchQueueWrapperInternal.h" diff --git a/Sources/SentryNativeUtils/SentryNativeUtils.mm b/Sources/SentryNativeUtils/SentryNativeUtils.mm new file mode 100644 index 00000000000..391d639a6c7 --- /dev/null +++ b/Sources/SentryNativeUtils/SentryNativeUtils.mm @@ -0,0 +1,13 @@ +// +// SentryNativeUtils.m +// SentryNativeUtils +// +// Created by Philip Niedertscheider on 23.11.26. +// Copyright © 2026 Sentry. All rights reserved. +// + +#import "SentryNativeUtils.h" + +@implementation SentryNativeUtils + +@end diff --git a/Sources/Sentry/SentryTime.mm b/Sources/SentryNativeUtils/SentryTime.mm similarity index 88% rename from Sources/Sentry/SentryTime.mm rename to Sources/SentryNativeUtils/SentryTime.mm index e2ae4be2957..25e70d976c2 100644 --- a/Sources/Sentry/SentryTime.mm +++ b/Sources/SentryNativeUtils/SentryTime.mm @@ -1,11 +1,6 @@ #import "SentryTime.h" #import -#import -#import - -#import "SentryAsyncSafeLog.h" -#import "SentryMachLogging.hpp" uint64_t timeIntervalToNanoseconds(double seconds) diff --git a/Sources/SentryNativeUtils/include/SentryNativeUtils.h b/Sources/SentryNativeUtils/include/SentryNativeUtils.h new file mode 100644 index 00000000000..4d6ec3fbe3b --- /dev/null +++ b/Sources/SentryNativeUtils/include/SentryNativeUtils.h @@ -0,0 +1,13 @@ +// +// SentryNativeUtils.h +// SentryNativeUtils +// +// Created by Philip Niedertscheider on 23.11.26. +// Copyright © 2026 Sentry. All rights reserved. +// + +#import + +@interface SentryNativeUtils : NSObject + +@end diff --git a/Sources/Sentry/include/SentryTime.h b/Sources/SentryNativeUtils/include/SentryTime.h similarity index 92% rename from Sources/Sentry/include/SentryTime.h rename to Sources/SentryNativeUtils/include/SentryTime.h index 13b55bcbf5d..5366c032e5b 100644 --- a/Sources/Sentry/include/SentryTime.h +++ b/Sources/SentryNativeUtils/include/SentryTime.h @@ -1,9 +1,9 @@ -#import "SentryCompiler.h" -#import "SentryProfilingConditionals.h" #import #import -SENTRY_EXTERN_C_BEGIN +#ifdef __cplusplus +extern "C" { +#endif /** * Given a fractional amount of seconds in a @c double from a Cocoa API like @c -[NSDate @@ -32,4 +32,6 @@ bool orderedChronologically(uint64_t a, uint64_t b); */ uint64_t getDurationNs(uint64_t startTimestamp, uint64_t endTimestamp); -SENTRY_EXTERN_C_END +#ifdef __cplusplus +} +#endif diff --git a/Sources/SentryNativeUtils/include/module.modulemap b/Sources/SentryNativeUtils/include/module.modulemap new file mode 100644 index 00000000000..5fed4d540cf --- /dev/null +++ b/Sources/SentryNativeUtils/include/module.modulemap @@ -0,0 +1,4 @@ +module SentryNativeUtils { + umbrella "." + export * +} diff --git a/Sources/SentryProfiling/SentryProfiling.m b/Sources/SentryProfiling/SentryProfiling.m new file mode 100644 index 00000000000..de4007d7580 --- /dev/null +++ b/Sources/SentryProfiling/SentryProfiling.m @@ -0,0 +1,13 @@ +// +// SentryProfiling.m +// SentryProfiling +// +// Created by Philip Niedertscheider on 23.11.26. +// Copyright © 2026 Sentry. All rights reserved. +// + +#import "SentryProfiling.h" + +@implementation SentryProfiling + +@end diff --git a/Sources/Sentry/Profiling/SentryProfilingSystemMetrics.m b/Sources/SentryProfiling/SentryProfilingSystemMetrics.m similarity index 85% rename from Sources/Sentry/Profiling/SentryProfilingSystemMetrics.m rename to Sources/SentryProfiling/SentryProfilingSystemMetrics.m index 5504b515469..0403b2c757b 100644 --- a/Sources/Sentry/Profiling/SentryProfilingSystemMetrics.m +++ b/Sources/SentryProfiling/SentryProfilingSystemMetrics.m @@ -1,7 +1,5 @@ #import "SentryProfilingSystemMetrics.h" -#if SENTRY_TARGET_PROFILING_SUPPORTED - @implementation SentryProfilingSystemMetrics - (instancetype)initWithCPUUsage:(NSNumber *_Nullable)cpuUsage @@ -17,5 +15,3 @@ - (instancetype)initWithCPUUsage:(NSNumber *_Nullable)cpuUsage } @end - -#endif // SENTRY_TARGET_PROFILING_SUPPORTED diff --git a/Sources/SentryProfiling/include/SentryProfiling.h b/Sources/SentryProfiling/include/SentryProfiling.h new file mode 100644 index 00000000000..96c245d7f20 --- /dev/null +++ b/Sources/SentryProfiling/include/SentryProfiling.h @@ -0,0 +1,13 @@ +// +// SentryProfiling.h +// SentryProfiling +// +// Created by Philip Niedertscheider on 23.11.26. +// Copyright © 2026 Sentry. All rights reserved. +// + +#import + +@interface SentryProfiling : NSObject + +@end diff --git a/Sources/Sentry/include/SentryProfilingSystemMetrics.h b/Sources/SentryProfiling/include/SentryProfilingSystemMetrics.h similarity index 77% rename from Sources/Sentry/include/SentryProfilingSystemMetrics.h rename to Sources/SentryProfiling/include/SentryProfilingSystemMetrics.h index bf3950f6154..51586369f1c 100644 --- a/Sources/Sentry/include/SentryProfilingSystemMetrics.h +++ b/Sources/SentryProfiling/include/SentryProfilingSystemMetrics.h @@ -1,9 +1,5 @@ -#import "SentryDefines.h" -#import "SentryProfilingConditionals.h" #import -#if SENTRY_TARGET_PROFILING_SUPPORTED - NS_ASSUME_NONNULL_BEGIN @interface SentryProfilingSystemMetrics : NSObject @@ -15,10 +11,9 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithCPUUsage:(NSNumber *_Nullable)cpuUsage memoryFootprintBytes:(NSNumber *_Nullable)memoryFootprintBytes cpuEnergyUsage:(NSNumber *_Nullable)cpuEnergyUsage; -SENTRY_NO_INIT +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; @end NS_ASSUME_NONNULL_END - -#endif // SENTRY_TARGET_PROFILING_SUPPORTED diff --git a/Sources/SentryProfiling/include/module.modulemap b/Sources/SentryProfiling/include/module.modulemap new file mode 100644 index 00000000000..32dc27cdd74 --- /dev/null +++ b/Sources/SentryProfiling/include/module.modulemap @@ -0,0 +1,4 @@ +module SentryProfiling { + umbrella "." + export * +} diff --git a/Sources/Swift/Core/Integrations/FramesTracking/SentryUpdateLinkFrameSource.swift b/Sources/Swift/Core/Integrations/FramesTracking/SentryUpdateLinkFrameSource.swift index 9b8db3f3b0e..f0697994b37 100644 --- a/Sources/Swift/Core/Integrations/FramesTracking/SentryUpdateLinkFrameSource.swift +++ b/Sources/Swift/Core/Integrations/FramesTracking/SentryUpdateLinkFrameSource.swift @@ -1,6 +1,7 @@ #if (os(iOS) || os(tvOS) || os(visionOS)) && !SENTRY_NO_UI_FRAMEWORK internal import _SentryPrivate +internal import SentryNativeUtils import Foundation /// The frame source for OS versions that have `UIUpdateLink`. diff --git a/Sources/Swift/Integrations/AppHangTracking/SentryANRTrackerV2.swift b/Sources/Swift/Integrations/AppHangTracking/SentryANRTrackerV2.swift index 3eac03bc330..d24ccf0b7e1 100644 --- a/Sources/Swift/Integrations/AppHangTracking/SentryANRTrackerV2.swift +++ b/Sources/Swift/Integrations/AppHangTracking/SentryANRTrackerV2.swift @@ -1,5 +1,6 @@ #if !SDK_V10 && (os(iOS) || os(tvOS) || os(visionOS)) && !SENTRY_NO_UI_FRAMEWORK internal import _SentryPrivate +internal import SentryNativeUtils import Foundation /// Detects fully and non-fully blocking app hangs from frame delays on a dedicated watchdog thread. diff --git a/Tests/SentryNativeUtilsTests/SentryTimeTests.swift b/Tests/SentryNativeUtilsTests/SentryTimeTests.swift new file mode 100644 index 00000000000..5556a3367f1 --- /dev/null +++ b/Tests/SentryNativeUtilsTests/SentryTimeTests.swift @@ -0,0 +1,73 @@ +import SentryNativeUtils +import SentryNativeUtilsTestSupport +import XCTest + +final class SentryTimeTests: XCTestCase { + func testDuration() { + // -- Arrange -- + // The native implementation asserts for invalid inputs in Debug. Ignore assertions only + // here to verify its release behavior without disabling assertions for the other tests. + SentryTimeTestsAssertionHandler.performIgnoringAssertions { + // -- Act / Assert -- + XCTAssertEqual(getDurationNs(0, 1), 1) + XCTAssertEqual(getDurationNs(1, 1), 0) + XCTAssertEqual(getDurationNs(1, 7), 6) + XCTAssertEqual(getDurationNs(0, UInt64.max), UInt64.max) + + // Inputs that are not chronologically ordered always return zero. + XCTAssertEqual(getDurationNs(1, 0), 0) + XCTAssertEqual(getDurationNs(UInt64.max, 0), 0) + + // Negative inputs wrap around when converted to unsigned integers. + let negativeOne = UInt64(truncatingIfNeeded: -1) + let negativeMax = UInt64(0) &- UInt64.max + XCTAssertEqual(getDurationNs(0, negativeOne), UInt64.max) + XCTAssertEqual(getDurationNs(negativeOne, 0), 0) + XCTAssertEqual(getDurationNs(negativeOne, negativeOne), 0) + XCTAssertEqual(getDurationNs(0, negativeMax), 1) + XCTAssertEqual(getDurationNs(negativeMax, 0), 0) + } + } + + func testChronologicOrderCheck() { + // -- Act / Assert -- + XCTAssertTrue(orderedChronologically(0, 1)) + XCTAssertTrue(orderedChronologically(0, 5_365)) + XCTAssertTrue(orderedChronologically(24, 7_532_564)) + XCTAssertFalse(orderedChronologically(1, 0)) + XCTAssertFalse(orderedChronologically(32_431, 53)) + + // Equal timestamps are in chronological order. + XCTAssertTrue(orderedChronologically(0, 0)) + XCTAssertTrue(orderedChronologically(1, 1)) + XCTAssertTrue(orderedChronologically(UInt64.max, UInt64.max)) + + // Negative inputs wrap around when converted to unsigned integers. + let negativeOne = UInt64(truncatingIfNeeded: -1) + let negativeMax = UInt64(0) &- UInt64.max + XCTAssertTrue(orderedChronologically(0, negativeOne)) + XCTAssertFalse(orderedChronologically(UInt64.max, negativeMax)) + XCTAssertFalse(orderedChronologically(negativeOne, 0)) + XCTAssertTrue(orderedChronologically(negativeMax, UInt64.max)) + XCTAssertTrue(orderedChronologically(negativeOne, negativeOne)) + XCTAssertTrue(orderedChronologically(negativeMax, negativeMax)) + } + + func testTimeIntervalToNanoseconds() { + // -- Act / Assert -- + XCTAssertEqual(timeIntervalToNanoseconds(0.0), UInt64(0)) + XCTAssertEqual(timeIntervalToNanoseconds(0.5), UInt64(500_000_000)) + XCTAssertEqual(timeIntervalToNanoseconds(1.0), UInt64(1_000_000_000)) + XCTAssertEqual(timeIntervalToNanoseconds(1.123456789), UInt64(1_123_456_789)) + XCTAssertEqual(timeIntervalToNanoseconds(123_456_789.123456), UInt64(123_456_789_123_456_000)) + } + + func testNanosecondsToTimeInterval() { + // -- Act / Assert -- + XCTAssertEqual(nanosecondsToTimeInterval(0), 0.0, accuracy: 1e-9) + XCTAssertEqual(nanosecondsToTimeInterval(500_000_000), 0.5, accuracy: 1e-9) + XCTAssertEqual(nanosecondsToTimeInterval(1_000_000_000), 1.0, accuracy: 1e-9) + XCTAssertEqual(nanosecondsToTimeInterval(1_123_456_789), 1.123456789, accuracy: 1e-9) + XCTAssertEqual(nanosecondsToTimeInterval(123_456_789_123_456_000), 123_456_789.123456, accuracy: 1e-9) + } +} diff --git a/Tests/SentryNativeUtilsTests/Support/SentryTimeTestsAssertionHandler.m b/Tests/SentryNativeUtilsTests/Support/SentryTimeTestsAssertionHandler.m new file mode 100644 index 00000000000..ddc76c51cca --- /dev/null +++ b/Tests/SentryNativeUtilsTests/Support/SentryTimeTestsAssertionHandler.m @@ -0,0 +1,38 @@ +#import "SentryTimeTestsAssertionHandler.h" + +@implementation SentryTimeTestsAssertionHandler + ++ (void)performIgnoringAssertions:(void (^)(void))block +{ + NSMutableDictionary *threadDictionary = NSThread.currentThread.threadDictionary; + id previousHandler = threadDictionary[NSAssertionHandlerKey]; + threadDictionary[NSAssertionHandlerKey] = [[self alloc] init]; + @try { + block(); + } @finally { + if (previousHandler != nil) { + threadDictionary[NSAssertionHandlerKey] = previousHandler; + } else { + [threadDictionary removeObjectForKey:NSAssertionHandlerKey]; + } + } +} + +- (void)handleFailureInFunction:(NSString *)functionName + file:(NSString *)fileName + lineNumber:(NSInteger)line + description:(NSString *)format, ... +{ + // no-op +} + +- (void)handleFailureInMethod:(SEL)selector + object:(id)object + file:(NSString *)fileName + lineNumber:(NSInteger)line + description:(NSString *)format, ... +{ + // no-op +} + +@end diff --git a/Tests/SentryNativeUtilsTests/Support/include/SentryTimeTestsAssertionHandler.h b/Tests/SentryNativeUtilsTests/Support/include/SentryTimeTestsAssertionHandler.h new file mode 100644 index 00000000000..15186116a71 --- /dev/null +++ b/Tests/SentryNativeUtilsTests/Support/include/SentryTimeTestsAssertionHandler.h @@ -0,0 +1,9 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SentryTimeTestsAssertionHandler : NSAssertionHandler ++ (void)performIgnoringAssertions:(void (^)(void))block; +@end + +NS_ASSUME_NONNULL_END diff --git a/Tests/SentryProfilerTests/SentryProfilerSDKBackendValueTests.swift b/Tests/SentryProfilerTests/SentryProfilerSDKBackendValueTests.swift index 662b3592d0a..a8ea81a2a72 100644 --- a/Tests/SentryProfilerTests/SentryProfilerSDKBackendValueTests.swift +++ b/Tests/SentryProfilerTests/SentryProfilerSDKBackendValueTests.swift @@ -6,6 +6,7 @@ #endif @_spi(Private) @testable import SentryTestUtils import _SentryPrivate +import SentryProfiling import XCTest final class SentryProfilerSDKBackendValueTests: XCTestCase { diff --git a/Tests/SentryProfilingTests/SentryProfilingSystemMetricsTests.m b/Tests/SentryProfilingTests/SentryProfilingSystemMetricsTests.m new file mode 100644 index 00000000000..2e160488b3c --- /dev/null +++ b/Tests/SentryProfilingTests/SentryProfilingSystemMetricsTests.m @@ -0,0 +1,37 @@ +@import SentryProfiling; +#import + +@interface SentryProfilingSystemMetricsTests : XCTestCase +@end + +@implementation SentryProfilingSystemMetricsTests + +- (void)testInit_whenReadingsAreProvided_shouldPreserveValues +{ + // -- Act -- + SentryProfilingSystemMetrics *metrics = + [[SentryProfilingSystemMetrics alloc] initWithCPUUsage:@25 + memoryFootprintBytes:@1024 + cpuEnergyUsage:@42]; + + // -- Assert -- + XCTAssertEqualObjects(metrics.cpuUsage, @25); + XCTAssertEqualObjects(metrics.memoryFootprintBytes, @1024); + XCTAssertEqualObjects(metrics.cpuEnergyUsage, @42); +} + +- (void)testInit_whenReadingsAreUnavailable_shouldPreserveNil +{ + // -- Act -- + SentryProfilingSystemMetrics *metrics = + [[SentryProfilingSystemMetrics alloc] initWithCPUUsage:nil + memoryFootprintBytes:nil + cpuEnergyUsage:nil]; + + // -- Assert -- + XCTAssertNil(metrics.cpuUsage); + XCTAssertNil(metrics.memoryFootprintBytes); + XCTAssertNil(metrics.cpuEnergyUsage); +} + +@end diff --git a/Tests/SentryTests/Helper/SentryTimeSwiftTests.swift b/Tests/SentryTests/Helper/SentryTimeSwiftTests.swift deleted file mode 100644 index 2ec46db96b7..00000000000 --- a/Tests/SentryTests/Helper/SentryTimeSwiftTests.swift +++ /dev/null @@ -1,21 +0,0 @@ -import _SentryPrivate -import XCTest - -final class SentryTimeSwiftTests: XCTestCase { - - func testTimeIntervalToNanoseconds() { - XCTAssertEqual(timeIntervalToNanoseconds(0.0), UInt64(0)) - XCTAssertEqual(timeIntervalToNanoseconds(0.5), UInt64(500_000_000)) - XCTAssertEqual(timeIntervalToNanoseconds(1.0), UInt64(1_000_000_000)) - XCTAssertEqual(timeIntervalToNanoseconds(1.123456789), UInt64(1_123_456_789)) - XCTAssertEqual(timeIntervalToNanoseconds(123_456_789.123456), UInt64(123_456_789_123_456_000)) - } - - func testNanosecondsToTimeInterval() { - XCTAssertEqual(nanosecondsToTimeInterval(0), 0.0, accuracy: 1e-9) - XCTAssertEqual(nanosecondsToTimeInterval(500_000_000), 0.5, accuracy: 1e-9) - XCTAssertEqual(nanosecondsToTimeInterval(1_000_000_000), 1.0, accuracy: 1e-9) - XCTAssertEqual(nanosecondsToTimeInterval(1_123_456_789), 1.123456789, accuracy: 1e-9) - XCTAssertEqual(nanosecondsToTimeInterval(123_456_789_123_456_000), 123_456_789.123456, accuracy: 1e-9) - } -} diff --git a/Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift b/Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift index 4d1a37e55f2..f57721d8817 100644 --- a/Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift +++ b/Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift @@ -5,6 +5,7 @@ @_spi(Private) @testable import Sentry #endif @testable import _SentryPrivate +import SentryNativeUtils import XCTest // swiftlint:disable file_length diff --git a/Tests/SentryTests/Networking/SentryHttpTransportFlushIntegrationTests.swift b/Tests/SentryTests/Networking/SentryHttpTransportFlushIntegrationTests.swift index 105465e15cf..f2971fb9e8f 100644 --- a/Tests/SentryTests/Networking/SentryHttpTransportFlushIntegrationTests.swift +++ b/Tests/SentryTests/Networking/SentryHttpTransportFlushIntegrationTests.swift @@ -5,6 +5,7 @@ @_spi(Private) @testable import Sentry #endif import _SentryPrivate +import SentryNativeUtils import XCTest final class SentryHttpTransportFlushIntegrationTests: XCTestCase { diff --git a/Tests/SentryTests/Networking/SentryHttpTransportTests.swift b/Tests/SentryTests/Networking/SentryHttpTransportTests.swift index 94e670b703d..d7a15534cb2 100644 --- a/Tests/SentryTests/Networking/SentryHttpTransportTests.swift +++ b/Tests/SentryTests/Networking/SentryHttpTransportTests.swift @@ -5,6 +5,7 @@ @_spi(Private) @testable import Sentry #endif import _SentryPrivate +import SentryNativeUtils import XCTest // swiftlint:disable file_length diff --git a/Tests/SentryTests/ObjC/Helper/SentryTimeTests.m b/Tests/SentryTests/ObjC/Helper/SentryTimeTests.m deleted file mode 100644 index 4eafbbbdb8b..00000000000 --- a/Tests/SentryTests/ObjC/Helper/SentryTimeTests.m +++ /dev/null @@ -1,102 +0,0 @@ -#import "SentryTime.h" -#import - -/** - * There's an assertion that will crash these tests when trying degenerate inputs; we want to make - * sure that we get the expected output in those cases in production when the assertion is compiled - * out; therefore for this test class, we will no-op any assertions that are hit. - */ -@interface SentryTimeTestsAssertionHandler : NSAssertionHandler - -@end - -@implementation SentryTimeTestsAssertionHandler - -- (void)handleFailureInFunction:(NSString *)functionName - file:(NSString *)fileName - lineNumber:(NSInteger)line - description:(NSString *)format, ... -{ - // no-op -} - -- (void)handleFailureInMethod:(SEL)selector - object:(id)object - file:(NSString *)fileName - lineNumber:(NSInteger)line - description:(NSString *)format, ... -{ - // no-op -} - -@end - -@interface SentryTimeTests : XCTestCase - -@end - -@implementation SentryTimeTests - -+ (void)setUp -{ - [[[NSThread currentThread] threadDictionary] - setValue:[[SentryTimeTestsAssertionHandler alloc] init] - forKey:NSAssertionHandlerKey]; -} - -+ (void)tearDown -{ - [[[NSThread currentThread] threadDictionary] setValue:nil forKey:NSAssertionHandlerKey]; -} - -- (void)testDuration -{ - XCTAssertEqual(getDurationNs(0, 1), 1); - XCTAssertEqual(getDurationNs(1, 1), 0); - XCTAssertEqual(getDurationNs(1, 7), 6); - XCTAssertEqual(getDurationNs(0, UINT64_MAX), UINT64_MAX); - - // degenerate cases... - - // inputs that are not chronologically ordered always return 0 - XCTAssertEqual(getDurationNs(1, 0), 0); - XCTAssertEqual(getDurationNs(UINT64_MAX, 0), 0); - - // negative inputs underflow and wrap around when converted to unsigned integers - XCTAssertEqual(getDurationNs(0, -1), UINT64_MAX); - XCTAssertEqual(getDurationNs(-1, 0), 0); // not chronologically ordered after underflow wrap! - XCTAssertEqual(getDurationNs(-1, -1), 0); - - XCTAssertEqual(getDurationNs(0, -UINT64_MAX), 1); - XCTAssertEqual(getDurationNs(-UINT64_MAX, 0), 0); -} - -- (void)testChronologicOrderCheck -{ - XCTAssertTrue(orderedChronologically(0, 1)); - XCTAssertTrue(orderedChronologically(0, 5365)); - XCTAssertTrue(orderedChronologically(24, 7532564)); - - XCTAssertFalse(orderedChronologically(1, 0)); - XCTAssertFalse(orderedChronologically(32431, 53)); - - // we consider chronological order to be <=, so check equal inputs too - XCTAssertTrue(orderedChronologically(0, 0)); - XCTAssertTrue(orderedChronologically(1, 1)); - XCTAssertTrue(orderedChronologically(UINT64_MAX, UINT64_MAX)); - - // degenerate cases... - - // negative inputs underflow and wrap around when converted to unsigned integers - XCTAssertTrue(orderedChronologically(0, -1)); - XCTAssertFalse(orderedChronologically(UINT64_MAX, -UINT64_MAX)); - - XCTAssertFalse(orderedChronologically(-1, 0)); - XCTAssertTrue(orderedChronologically(-UINT64_MAX, UINT64_MAX)); - - // should still work when they're equal negative inputs - XCTAssertTrue(orderedChronologically(-1, -1)); - XCTAssertTrue(orderedChronologically(-UINT64_MAX, -UINT64_MAX)); -} - -@end diff --git a/develop-docs/ARCHITECTURE.md b/develop-docs/ARCHITECTURE.md index 8fd987364da..d8e5d32f02e 100644 --- a/develop-docs/ARCHITECTURE.md +++ b/develop-docs/ARCHITECTURE.md @@ -11,6 +11,21 @@ At the highest level, the SDK is composed of a few key components: - **SentryScope**: holds metadata that is sent with every event, to assist in querying later - **SentryHub** and **SentryClient**: tie together configuration, features and scopes along with lower level machinery needed to store and transmit data +### Native Library Boundaries + +The SDK links the native-only static libraries `SentryNativeUtils` and `SentryProfiling` in both Xcode and SwiftPM. `SentryNativeUtils` is an Objective-C++ utility library: implementations belong in `.mm` files, and the target must contain no Swift sources or depend on Swift targets. It owns the shared time helpers, while `SentryProfiling` owns the system-metrics value object and depends on native utilities. Both libraries are independent of SDK implementation code and KSCrash. Sampling and profiling orchestration remain SDK-owned. + +```mermaid +flowchart TD + SDK["Sentry SDK"] --> Profiling["SentryProfiling"] + SDK --> NativeUtils["SentryNativeUtils"] + Profiling --> NativeUtils + ProfilingTests["SentryProfilingTests"] --> Profiling + NativeUtilsTests["SentryNativeUtilsTests"] --> NativeUtils +``` + +Each library compiles its own sources once. Xcode expresses the profiling-to-utilities relationship as a build dependency, with both archives linked by the SDK rather than embedding one archive inside the other. Their tests are SwiftPM targets, included in the V9 and V10 Base plans. + ### Event Flow ```mermaid diff --git a/develop-docs/BUILD.md b/develop-docs/BUILD.md index f428256214b..c2f25a90da6 100644 --- a/develop-docs/BUILD.md +++ b/develop-docs/BUILD.md @@ -6,6 +6,14 @@ This document covers the build system and configuration details for the Sentry C - XCConfig files in `Sources/Configuration/` for SDK settings; settings should not be modified in pbxproj files +## Native Library Targets + +`SentryNativeUtils` contains Objective-C++ utilities only, with no Swift sources or Swift target dependencies. Its C, Objective-C, and C++ headers allow native and Swift consumers to call the utilities without requiring Swift in the library itself. + +`SentryNativeUtils` and `SentryProfiling` have shared Xcode build schemes and target settings in `Sources/Configuration/`. Use `make build-native-utils` or `make build-profiling` to build all supported platforms. To build one platform, select the scheme with an existing build command, for example `make build-macos XCODE_SCHEME=SentryNativeUtils`. + +Tests run through SwiftPM, not Xcode test targets. `make test-native-utils` and `make test-profiling` select their suites across the platform matrix. A focused run uses the existing selectors, for example `make test-macos ONLY_TESTING=SentryNativeUtilsTests`. SwiftPM builds each test target's library dependencies automatically. + ## SDK Test Configurations SDK tests use `Debug`, or `DebugV10` for V10 Xcode project builds. SwiftPM V10 tests also use `Debug`, with `SDK_V10=1` selecting the SDK implementation. Debug builds enable testability and SDK test helpers through `DEBUG`; no test traits or separate test configurations are required. Make/CI adds the [package test xcconfig](../Tests/Configuration/SwiftPM.xcconfig) for ABI and diagnostic checks. See [SwiftPM SDK Tests](TEST.md#swiftpm-sdk-tests). Release builds exclude debug/test helpers. Do not explicitly enable `DEBUG` in production builds. diff --git a/scripts/build-xcframework-slice.sh b/scripts/build-xcframework-slice.sh index 3f1feedce6b..fcf682d6ee7 100755 --- a/scripts/build-xcframework-slice.sh +++ b/scripts/build-xcframework-slice.sh @@ -85,7 +85,7 @@ resolved_configuration="Release$configuration_suffix" SWIFT_USER_MODULE_VERSION="$(read_swift_user_module_version \ --file "$SCRIPT_DIR/../Sources/Configuration/Versioning.xcconfig")" resolved_product_name="$product_name.framework" -OTHER_LDFLAGS="" +OTHER_LDFLAGS="\$(inherited)" log_info " Configuration: $resolved_configuration" log_info " Resolved product: $resolved_product_name" @@ -97,13 +97,14 @@ if [ "$MACH_O_TYPE" = "staticlib" ]; then GCC_GENERATE_DEBUGGING_SYMBOLS="NO" fi -# SDK targets default to dynamic frameworks in their xcconfigs. Do not force mh_dylib -# on the command line: SwiftPM's KSCrash object aggregates would become dylibs too. +# Override dynamic linkage only for the SDK, keeping native libraries and SwiftPM +# KSCrash object aggregates static. # Static packaging intentionally uses libtool for the SDK and its package aggregates. mach_o_type_override=() case "$MACH_O_TYPE" in staticlib) mach_o_type_override=( MACH_O_TYPE=staticlib ) ;; - mh_dylib|inherit) ;; + mh_dylib) mach_o_type_override=( SENTRY_SDK_MACH_O_TYPE=mh_dylib ) ;; + inherit) ;; *) log_error "Unsupported Mach-O type: $MACH_O_TYPE"; exit 1 ;; esac From 350cc41aa11526d9dac51c9ca701b90cee0efcd0 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Tue, 24 Nov 2026 12:53:24 +0100 Subject: [PATCH 2/5] build: Restore strict SDK nullability warnings --- Sources/Configuration/Sentry.xcconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Configuration/Sentry.xcconfig b/Sources/Configuration/Sentry.xcconfig index 9546970be04..7ac7ed93f41 100644 --- a/Sources/Configuration/Sentry.xcconfig +++ b/Sources/Configuration/Sentry.xcconfig @@ -45,6 +45,8 @@ PROVISIONING_PROFILE_SPECIFIER = GCC_C_LANGUAGE_STANDARD = compiler-default +OTHER_CFLAGS = -Wnullable-to-nonnull-conversion -Wnullability-completeness + ENABLE_STRICT_OBJC_MSGSEND = NO CLANG_WARN_BOOL_CONVERSION = YES From d3be8ee72b4202b17a7b9e92cda97d3df8d243ea Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Tue, 24 Nov 2026 13:08:46 +0100 Subject: [PATCH 3/5] ref: Share native C linkage definitions --- Sources/Sentry/include/SentryCompiler.h | 12 ++---------- Sources/SentryNativeUtils/SentryNativeUtils.mm | 8 -------- .../SentryNativeUtils/include/SentryNativeUtils.h | 9 +-------- .../include/SentryNativeUtilsDefines.h | 9 +++++++++ Sources/SentryNativeUtils/include/SentryTime.h | 9 +++------ Sources/SentryNativeUtils/include/module.modulemap | 1 + Sources/SentryProfiling/SentryProfiling.m | 8 -------- Sources/SentryProfiling/include/SentryProfiling.h | 8 -------- 8 files changed, 16 insertions(+), 48 deletions(-) create mode 100644 Sources/SentryNativeUtils/include/SentryNativeUtilsDefines.h diff --git a/Sources/Sentry/include/SentryCompiler.h b/Sources/Sentry/include/SentryCompiler.h index 4d3299e917f..4415086ec60 100644 --- a/Sources/Sentry/include/SentryCompiler.h +++ b/Sources/Sentry/include/SentryCompiler.h @@ -28,6 +28,8 @@ #pragma once +#include "SentryNativeUtilsDefines.h" + /* COMPILER() - the compiler being used to build the project */ #define COMPILER(SENTRY_FEATURE) (defined SENTRY_COMPILER_##SENTRY_FEATURE && SENTRY_COMPILER_##SENTRY_FEATURE) @@ -179,16 +181,6 @@ #define ALWAYS_INLINE_EXCEPT_MSVC ALWAYS_INLINE #endif -/* SENTRY_EXTERN_C_{BEGIN, END} */ - -#ifdef __cplusplus -#define SENTRY_EXTERN_C_BEGIN extern "C" { -#define SENTRY_EXTERN_C_END } -#else -#define SENTRY_EXTERN_C_BEGIN -#define SENTRY_EXTERN_C_END -#endif - /* FALLTHROUGH */ #if !defined(FALLTHROUGH) && defined(__cplusplus) && defined(__has_cpp_attribute) diff --git a/Sources/SentryNativeUtils/SentryNativeUtils.mm b/Sources/SentryNativeUtils/SentryNativeUtils.mm index 391d639a6c7..f712d4ad3eb 100644 --- a/Sources/SentryNativeUtils/SentryNativeUtils.mm +++ b/Sources/SentryNativeUtils/SentryNativeUtils.mm @@ -1,11 +1,3 @@ -// -// SentryNativeUtils.m -// SentryNativeUtils -// -// Created by Philip Niedertscheider on 23.11.26. -// Copyright © 2026 Sentry. All rights reserved. -// - #import "SentryNativeUtils.h" @implementation SentryNativeUtils diff --git a/Sources/SentryNativeUtils/include/SentryNativeUtils.h b/Sources/SentryNativeUtils/include/SentryNativeUtils.h index 4d6ec3fbe3b..31e6a25a57f 100644 --- a/Sources/SentryNativeUtils/include/SentryNativeUtils.h +++ b/Sources/SentryNativeUtils/include/SentryNativeUtils.h @@ -1,11 +1,4 @@ -// -// SentryNativeUtils.h -// SentryNativeUtils -// -// Created by Philip Niedertscheider on 23.11.26. -// Copyright © 2026 Sentry. All rights reserved. -// - +#import "SentryNativeUtilsDefines.h" #import @interface SentryNativeUtils : NSObject diff --git a/Sources/SentryNativeUtils/include/SentryNativeUtilsDefines.h b/Sources/SentryNativeUtils/include/SentryNativeUtilsDefines.h new file mode 100644 index 00000000000..a6ff1f457f9 --- /dev/null +++ b/Sources/SentryNativeUtils/include/SentryNativeUtilsDefines.h @@ -0,0 +1,9 @@ +#pragma once + +#ifdef __cplusplus +# define SENTRY_EXTERN_C_BEGIN extern "C" { +# define SENTRY_EXTERN_C_END } +#else +# define SENTRY_EXTERN_C_BEGIN +# define SENTRY_EXTERN_C_END +#endif diff --git a/Sources/SentryNativeUtils/include/SentryTime.h b/Sources/SentryNativeUtils/include/SentryTime.h index 5366c032e5b..9eb236402f7 100644 --- a/Sources/SentryNativeUtils/include/SentryTime.h +++ b/Sources/SentryNativeUtils/include/SentryTime.h @@ -1,9 +1,8 @@ +#import "SentryNativeUtilsDefines.h" #import #import -#ifdef __cplusplus -extern "C" { -#endif +SENTRY_EXTERN_C_BEGIN /** * Given a fractional amount of seconds in a @c double from a Cocoa API like @c -[NSDate @@ -32,6 +31,4 @@ bool orderedChronologically(uint64_t a, uint64_t b); */ uint64_t getDurationNs(uint64_t startTimestamp, uint64_t endTimestamp); -#ifdef __cplusplus -} -#endif +SENTRY_EXTERN_C_END diff --git a/Sources/SentryNativeUtils/include/module.modulemap b/Sources/SentryNativeUtils/include/module.modulemap index 5fed4d540cf..be6b9280619 100644 --- a/Sources/SentryNativeUtils/include/module.modulemap +++ b/Sources/SentryNativeUtils/include/module.modulemap @@ -1,4 +1,5 @@ module SentryNativeUtils { + textual header "SentryNativeUtilsDefines.h" umbrella "." export * } diff --git a/Sources/SentryProfiling/SentryProfiling.m b/Sources/SentryProfiling/SentryProfiling.m index de4007d7580..343cff8377c 100644 --- a/Sources/SentryProfiling/SentryProfiling.m +++ b/Sources/SentryProfiling/SentryProfiling.m @@ -1,11 +1,3 @@ -// -// SentryProfiling.m -// SentryProfiling -// -// Created by Philip Niedertscheider on 23.11.26. -// Copyright © 2026 Sentry. All rights reserved. -// - #import "SentryProfiling.h" @implementation SentryProfiling diff --git a/Sources/SentryProfiling/include/SentryProfiling.h b/Sources/SentryProfiling/include/SentryProfiling.h index 96c245d7f20..5d3748e0c7f 100644 --- a/Sources/SentryProfiling/include/SentryProfiling.h +++ b/Sources/SentryProfiling/include/SentryProfiling.h @@ -1,11 +1,3 @@ -// -// SentryProfiling.h -// SentryProfiling -// -// Created by Philip Niedertscheider on 23.11.26. -// Copyright © 2026 Sentry. All rights reserved. -// - #import @interface SentryProfiling : NSObject From 955d01a02cb3914ee4f202bea0038cabc251968e Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Tue, 24 Nov 2026 13:17:19 +0100 Subject: [PATCH 4/5] ref: Remove library placeholder classes --- Sentry.xcodeproj/project.pbxproj | 2 +- Sources/SentryNativeUtils/SentryNativeUtils.mm | 5 ----- Sources/SentryNativeUtils/include/SentryNativeUtils.h | 6 +----- Sources/SentryProfiling/SentryProfiling.m | 5 ----- Sources/SentryProfiling/include/SentryProfiling.h | 6 +----- 5 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 Sources/SentryNativeUtils/SentryNativeUtils.mm delete mode 100644 Sources/SentryProfiling/SentryProfiling.m diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 58a87bd6d26..829a8424654 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -1688,9 +1688,9 @@ 63AA75A31EB8AFDF00D153DE /* Configuration */, D8B0542F2A7D35F10056BAF6 /* Resources */, D437F93930B4A67A00E15BFA /* SentryNativeUtils */, - D437F94030B4A67A00E15BFA /* SentryProfiling */, D4CB39972F6AEF01005250F2 /* SentryObjCCompat */, D4CB395D2F6AEEE6005250F2 /* SentryObjC */, + D437F94030B4A67A00E15BFA /* SentryProfiling */, ); path = Sources; sourceTree = ""; diff --git a/Sources/SentryNativeUtils/SentryNativeUtils.mm b/Sources/SentryNativeUtils/SentryNativeUtils.mm deleted file mode 100644 index f712d4ad3eb..00000000000 --- a/Sources/SentryNativeUtils/SentryNativeUtils.mm +++ /dev/null @@ -1,5 +0,0 @@ -#import "SentryNativeUtils.h" - -@implementation SentryNativeUtils - -@end diff --git a/Sources/SentryNativeUtils/include/SentryNativeUtils.h b/Sources/SentryNativeUtils/include/SentryNativeUtils.h index 31e6a25a57f..0b0130ccee5 100644 --- a/Sources/SentryNativeUtils/include/SentryNativeUtils.h +++ b/Sources/SentryNativeUtils/include/SentryNativeUtils.h @@ -1,6 +1,2 @@ #import "SentryNativeUtilsDefines.h" -#import - -@interface SentryNativeUtils : NSObject - -@end +#import "SentryTime.h" diff --git a/Sources/SentryProfiling/SentryProfiling.m b/Sources/SentryProfiling/SentryProfiling.m deleted file mode 100644 index 343cff8377c..00000000000 --- a/Sources/SentryProfiling/SentryProfiling.m +++ /dev/null @@ -1,5 +0,0 @@ -#import "SentryProfiling.h" - -@implementation SentryProfiling - -@end diff --git a/Sources/SentryProfiling/include/SentryProfiling.h b/Sources/SentryProfiling/include/SentryProfiling.h index 5d3748e0c7f..00cba1645ec 100644 --- a/Sources/SentryProfiling/include/SentryProfiling.h +++ b/Sources/SentryProfiling/include/SentryProfiling.h @@ -1,5 +1 @@ -#import - -@interface SentryProfiling : NSObject - -@end +#import "SentryProfilingSystemMetrics.h" From 718ea834f8e7c1633d4bf717794b8f399cca06e4 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Mon, 30 Nov 2026 14:27:04 +0100 Subject: [PATCH 5/5] build: Keep SDK build schemes explicit --- Makefile | 25 ++++++------------------- develop-docs/BUILD.md | 2 +- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 5e7d48eda85..893361f51b2 100644 --- a/Makefile +++ b/Makefile @@ -20,9 +20,6 @@ IOS_DEVICE_NAME ?= iPhone 16 Pro # Build configuration for the iOS source-package test app. IOS_SPM_BUILD_CONFIGURATION ?= Debug -# SDK or standalone native-library scheme used by platform build targets. -XCODE_SCHEME ?= SentryV10 - # tvOS Simulator OS version (defaults to 'latest', can be overridden via TVOS_SIMULATOR_OS=18.5) TVOS_SIMULATOR_OS ?= latest @@ -176,7 +173,7 @@ build-ios: --os $(IOS_SIMULATOR_OS) \ --device "$(IOS_DEVICE_NAME)" \ --command build \ - --scheme "$(XCODE_SCHEME)" \ + --scheme SentryV10 \ --configuration DebugV10 ## Build macOS target with SDK_V10 flag @@ -189,7 +186,7 @@ build-macos: --platform macOS \ --os latest \ --command build \ - --scheme "$(XCODE_SCHEME)" \ + --scheme SentryV10 \ --configuration DebugV10 ## Build Catalyst target with SDK_V10 flag @@ -202,7 +199,7 @@ build-catalyst: --platform Catalyst \ --os latest \ --command build \ - --scheme "$(XCODE_SCHEME)" \ + --scheme SentryV10 \ --configuration DebugV10 \ --xcconfig Tests/Configuration/SentryV10Catalyst.xcconfig @@ -217,7 +214,7 @@ build-tvos: --os $(TVOS_SIMULATOR_OS) \ --device "$(TVOS_DEVICE_NAME)" \ --command build \ - --scheme "$(XCODE_SCHEME)" \ + --scheme SentryV10 \ --configuration DebugV10 ## Build visionOS target with SDK_V10 flag @@ -231,7 +228,7 @@ build-visionos: --os $(VISIONOS_SIMULATOR_OS) \ --device "$(VISIONOS_DEVICE_NAME)" \ --command build \ - --scheme "$(XCODE_SCHEME)" \ + --scheme SentryV10 \ --configuration DebugV10 ## Build watchOS target with SDK_V10 flag @@ -242,7 +239,7 @@ build-watchos: @echo "[MAKE] $@: Building V10 for watchOS" set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild build \ -workspace Sentry.xcworkspace \ - -scheme "$(XCODE_SCHEME)" \ + -scheme SentryV10 \ -destination 'platform=watchOS Simulator,OS=$(WATCHOS_SIMULATOR_OS),name=$(WATCHOS_DEVICE_NAME)' \ -configuration DebugV10 \ CODE_SIGNING_ALLOWED="NO" 2>&1 | tee raw-build-output.log | xcbeautify $(XCBEAUTIFY_OUTPUT_FLAGS) @@ -423,16 +420,6 @@ build-xcframework-static: @echo "[MAKE] $@: Compressing SentryV10.xcframework" ./scripts/compress-xcframework.sh --xcframework "SentryV10.xcframework" -## Build the standalone native utility library on all platforms -.PHONY: build-native-utils -build-native-utils: - @"$(MAKE)" build XCODE_SCHEME=SentryNativeUtils - -## Build the standalone profiling library on all platforms -.PHONY: build-profiling -build-profiling: - @"$(MAKE)" build XCODE_SCHEME=SentryProfiling - # ============================================================================ # TEST APPS # ============================================================================ diff --git a/develop-docs/BUILD.md b/develop-docs/BUILD.md index c2f25a90da6..9f8d12b424d 100644 --- a/develop-docs/BUILD.md +++ b/develop-docs/BUILD.md @@ -10,7 +10,7 @@ This document covers the build system and configuration details for the Sentry C `SentryNativeUtils` contains Objective-C++ utilities only, with no Swift sources or Swift target dependencies. Its C, Objective-C, and C++ headers allow native and Swift consumers to call the utilities without requiring Swift in the library itself. -`SentryNativeUtils` and `SentryProfiling` have shared Xcode build schemes and target settings in `Sources/Configuration/`. Use `make build-native-utils` or `make build-profiling` to build all supported platforms. To build one platform, select the scheme with an existing build command, for example `make build-macos XCODE_SCHEME=SentryNativeUtils`. +`SentryNativeUtils` and `SentryProfiling` have shared Xcode build schemes and target settings in `Sources/Configuration/`. SDK builds and package tests build both libraries as dependencies. For standalone builds, use the `--scheme` option of `scripts/sentry-xcodebuild.sh` to select either library. Tests run through SwiftPM, not Xcode test targets. `make test-native-utils` and `make test-profiling` select their suites across the platform matrix. A focused run uses the existing selectors, for example `make test-macos ONLY_TESTING=SentryNativeUtilsTests`. SwiftPM builds each test target's library dependencies automatically.