diff --git a/.github/actions/buildcocoasdk/action.yml b/.github/actions/buildcocoasdk/action.yml deleted file mode 100644 index d7dc4066b6..0000000000 --- a/.github/actions/buildcocoasdk/action.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Build Native Dependencies -description: Builds Sentry Cocoa SDK with custom Carthage -runs: - using: composite - - steps: - - name: Cache Sentry Cocoa SDK - id: cache-sentry-cocoa - uses: actions/cache@v3 - with: - path: modules/sentry-cocoa/Carthage - key: sentry-cocoa-${{ hashFiles('scripts/build-sentry-cocoa.sh') }}-${{ hashFiles('.git/modules/modules/sentry-cocoa/HEAD') }} - - - name: Build Sentry Cocoa SDK - if: ${{ steps.cache-sentry-cocoa.outputs.cache-hit != 'true' }} - shell: bash - run: scripts/build-sentry-cocoa.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d4d390647..317dd9327e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -130,10 +130,6 @@ jobs: - name: Build Native Dependencies uses: ./.github/actions/buildnative - - name: Build Cocoa SDK - if: runner.os == 'macOS' - uses: ./.github/actions/buildcocoasdk - - name: Restore .NET Dependencies run: dotnet restore Sentry-CI-Build-${{ runner.os }}.slnf --nologo diff --git a/.github/workflows/device-tests-ios.yml b/.github/workflows/device-tests-ios.yml index cf3db8c515..f79b9488bb 100644 --- a/.github/workflows/device-tests-ios.yml +++ b/.github/workflows/device-tests-ios.yml @@ -28,9 +28,6 @@ jobs: with: submodules: recursive - - name: Build Cocoa SDK - uses: ./.github/actions/buildcocoasdk - - name: Setup Environment uses: ./.github/actions/environment diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml index 45ef93876b..5fccddf94a 100644 --- a/.github/workflows/update-deps.yml +++ b/.github/workflows/update-deps.yml @@ -15,7 +15,7 @@ jobs: matrix: include: - name: Cocoa SDK - path: modules/sentry-cocoa + path: modules/sentry-cocoa.properties - name: Java SDK path: scripts/update-java.ps1 - name: Native SDK diff --git a/.gitignore b/.gitignore index c7e1484b7e..f8d880a8e7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ test/**/*.apk /tools/ *.log .sentry-native + +# Download cache for Cocoa SDK +modules/sentry-cocoa diff --git a/.gitmodules b/.gitmodules index 172d270909..71bd96d198 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "modules/Ben.Demystifier"] path = modules/Ben.Demystifier url = https://github.com/getsentry/Ben.Demystifier -[submodule "modules/sentry-cocoa"] - path = modules/sentry-cocoa - url = https://github.com/getsentry/sentry-cocoa.git [submodule "modules/perfview"] path = modules/perfview url = https://github.com/getsentry/perfview.git diff --git a/CHANGELOG.md b/CHANGELOG.md index 17d4d0fa3c..48c96d2fa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ ### Dependencies +- Bump Cocoa SDK from v8.36.0 to v8.39.0 ([#3727](https://github.com/getsentry/sentry-dotnet/pull/3727)) + - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8390) + - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.36.0...8.39.0) - Bump CLI from v2.38.1 to v2.38.2 ([#3728](https://github.com/getsentry/sentry-dotnet/pull/3728)) - [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2382) - [diff](https://github.com/getsentry/sentry-cli/compare/2.38.1...2.38.2) diff --git a/Sentry.sln b/Sentry.sln index 4ebd081d31..e8af1ab290 100644 --- a/Sentry.sln +++ b/Sentry.sln @@ -148,6 +148,9 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingleFileTestApp", "test\SingleFileTestApp\SingleFileTestApp.csproj", "{162A1CAE-ACEE-45CA-A6D0-7702ADE4D3DE}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{A3CCA27E-4DF8-479D-833C-CAA0950715AA}" + ProjectSection(SolutionItems) = preProject + modules\sentry-cocoa.properties = modules\sentry-cocoa.properties + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TraceEvent", "modules\perfview\src\TraceEvent\TraceEvent.csproj", "{67269916-C417-4CEE-BD7D-CA66C3830AEE}" EndProject diff --git a/modules/sentry-cocoa b/modules/sentry-cocoa deleted file mode 160000 index 5575af93ef..0000000000 --- a/modules/sentry-cocoa +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5575af93efb776414f243e93d6af9f6258dc539a diff --git a/modules/sentry-cocoa.properties b/modules/sentry-cocoa.properties new file mode 100644 index 0000000000..799f17ac06 --- /dev/null +++ b/modules/sentry-cocoa.properties @@ -0,0 +1,2 @@ +version = 8.39.0 +repo = https://github.com/getsentry/sentry-cocoa diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 1fd8dfe6c7..bac0ad65bc 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -2,7 +2,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $RootPath = (Get-Item $PSScriptRoot).Parent.FullName -$CocoaSdkPath = "$RootPath/modules/sentry-cocoa" +$CocoaSdkPath = "$RootPath/modules/sentry-cocoa/Sentry.framework" $BindingsPath = "$RootPath/src/Sentry.Bindings.Cocoa" $BackupPath = "$BindingsPath/obj/_unpatched" @@ -41,16 +41,38 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ $iPhoneSdkVersion = sharpie xcode -sdks | grep -o -m 1 'iphoneos\S*' Write-Output "iPhoneSdkVersion: $iPhoneSdkVersion" -# The umbrella header is provided in the "new" style of `#import ` instead of `#import "SomeHeader.h"` which causes sharpie to fail resolve those headers -$umbrellaHeader = "$CocoaSdkPath/Carthage/Headers/Sentry.h" -Set-Content -Path $umbrellaHeader -Value ((Get-Content -Path $umbrellaHeader -Raw) -replace ']+)>', '"$1"') +## Imports in the various header files are provided in the "new" style of: +# `#import ` +# ...instead of: +# `#import "SomeHeader.h"` +# This causes sharpie to fail resolve those headers +$filesToPatch = Get-ChildItem -Path "$CocoaSdkPath/Headers" -Filter *.h -Recurse | Select-Object -ExpandProperty FullName +foreach ($file in $filesToPatch) { + if (Test-Path $file) { + $content = Get-Content -Path $file -Raw + $content = $content -replace ']+)>', '"$1"' + Set-Content -Path $file -Value $content + } else { + Write-Host "File not found: $file" + } +} +$privateHeaderFile = "$CocoaSdkPath/PrivateHeaders/PrivatesHeader.h" +if (Test-Path $privateHeaderFile) { + $content = Get-Content -Path $privateHeaderFile -Raw + $content = $content -replace '"SentryDefines.h"', '"../Headers/SentryDefines.h"' + $content = $content -replace '"SentryProfilingConditionals.h"', '"../Headers/SentryProfilingConditionals.h"' + Set-Content -Path $privateHeaderFile -Value $content + Write-Host "Patched includes: $privateHeaderFile" +} else { + Write-Host "File not found: $privateHeaderFile" +} # Generate bindings Write-Output 'Generating bindings with Objective Sharpie.' sharpie bind -sdk $iPhoneSdkVersion ` - -scope "$CocoaSdkPath/Carthage/Headers" ` - "$CocoaSdkPath/Carthage/Headers/Sentry.h" ` - "$CocoaSdkPath/Carthage/Headers/PrivateSentrySDKOnly.h" ` + -scope "$CocoaSdkPath" ` + "$CocoaSdkPath/Headers/Sentry.h" ` + "$CocoaSdkPath/PrivateHeaders/PrivateSentrySDKOnly.h" ` -o $BindingsPath ` -c -Wno-objc-property-no-attribute diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 2e6eb14a11..3bbfc298dc 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -7,6 +7,7 @@ using System; using Foundation; using ObjCRuntime; +using Sentry; using UIKit; namespace Sentry.CocoaSdk; @@ -1521,6 +1522,14 @@ interface SentryOptions [Export ("enableAppHangTracking")] bool EnableAppHangTracking { get; set; } + // @property (assign, nonatomic) BOOL enableAppHangTrackingV2; + [Export ("enableAppHangTrackingV2")] + bool EnableAppHangTrackingV2 { get; set; } + + // @property (assign, nonatomic) BOOL enableReportNonFullyBlockingAppHangs; + [Export ("enableReportNonFullyBlockingAppHangs")] + bool EnableReportNonFullyBlockingAppHangs { get; set; } + // @property (assign, nonatomic) NSTimeInterval appHangTimeoutInterval; [Export ("appHangTimeoutInterval")] double AppHangTimeoutInterval { get; set; } @@ -1567,22 +1576,36 @@ interface SentryOptions // @property (copy, nonatomic) NSString * _Nonnull spotlightUrl; [Export ("spotlightUrl")] string SpotlightUrl { get; set; } +} + +// @interface SentryReplayApi : NSObject +[BaseType (typeof(NSObject))] +[Internal] +interface SentryReplayApi +{ + // -(void)maskView:(UIView * _Nonnull)view __attribute__((swift_name("maskView(_:)"))); + [Export ("maskView:")] + void MaskView (UIView view); + + // -(void)unmaskView:(UIView * _Nonnull)view __attribute__((swift_name("unmaskView(_:)"))); + [Export ("unmaskView:")] + void UnmaskView (UIView view); - // @property (assign, nonatomic) BOOL enableMetrics; - [Export ("enableMetrics")] - bool EnableMetrics { get; set; } + // -(void)pause; + [Export ("pause")] + void Pause (); - // @property (assign, nonatomic) BOOL enableDefaultTagsForMetrics; - [Export ("enableDefaultTagsForMetrics")] - bool EnableDefaultTagsForMetrics { get; set; } + // -(void)resume; + [Export ("resume")] + void Resume (); - // @property (assign, nonatomic) BOOL enableSpanLocalMetricAggregation; - [Export ("enableSpanLocalMetricAggregation")] - bool EnableSpanLocalMetricAggregation { get; set; } + // -(void)start; + [Export ("start")] + void Start (); - // @property (copy, nonatomic) SentryBeforeEmitMetricCallback _Nullable beforeEmitMetric; - [NullAllowed, Export ("beforeEmitMetric", ArgumentSemantic.Copy)] - SentryBeforeEmitMetricCallback BeforeEmitMetric { get; set; } + // -(void)stop; + [Export ("stop")] + void Stop (); } // @interface SentryRequest : NSObject @@ -1635,6 +1658,11 @@ interface SentrySDK [Export ("isEnabled")] bool IsEnabled { get; } + // @property (readonly, nonatomic, class) SentryReplayApi * _Nonnull replay; + [Static] + [Export ("replay")] + SentryReplayApi Replay { get; } + // +(void)startWithOptions:(SentryOptions * _Nonnull)options __attribute__((swift_name("start(options:)"))); [Static] [Export ("startWithOptions:")] @@ -1740,6 +1768,11 @@ interface SentrySDK [Export ("captureUserFeedback:")] void CaptureUserFeedback (SentryUserFeedback userFeedback); + // +(void)showUserFeedbackForm; + [Static] + [Export ("showUserFeedbackForm")] + void ShowUserFeedbackForm (); + // +(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb __attribute__((swift_name("addBreadcrumb(_:)"))); [Static] [Export ("addBreadcrumb:")] @@ -1805,16 +1838,6 @@ interface SentrySDK [Export ("close")] void Close (); - // +(void)replayRedactView:(UIView * _Nonnull)view; - [Static] - [Export ("replayRedactView:")] - void ReplayRedactView (UIView view); - - // +(void)replayIgnoreView:(UIView * _Nonnull)view; - [Static] - [Export ("replayIgnoreView:")] - void ReplayIgnoreView (UIView view); - // +(void)startProfiler; [Static] [Export ("startProfiler")] diff --git a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj index 773c19feee..2004d3487f 100644 --- a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj +++ b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj @@ -7,8 +7,9 @@ true true .NET Bindings for the Sentry Cocoa SDK - ..\..\modules\sentry-cocoa\ - $(SentryCocoaSdkDirectory)Carthage\Build-$(TargetPlatformIdentifier)\Sentry.xcframework + ..\..\modules\sentry-cocoa\ + $(SentryCocoaCache)Sentry.framework\ + $(SentryCocoaCache)Sentry-Dynamic.xcframework @@ -44,18 +45,53 @@ - - - + + + + + $([System.IO.File]::ReadAllText("../../modules/sentry-cocoa.properties")) + $([System.Text.RegularExpressions.Regex]::Match($(PropertiesContent), 'version\s*=\s*([^\s]+)').Groups[1].Value) + + + + + + + + + + + + + + + + + + + + + - - + + + - + diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index 4acb1ce487..7fb471de9c 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -7,6 +7,7 @@ using System.Runtime.InteropServices; using Foundation; using ObjCRuntime; +using Sentry; namespace Sentry.CocoaSdk;