From 7383ed2ad5b4186b94a90fb5dbe15f71307bd56e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 12 Sep 2025 10:59:35 +0200 Subject: [PATCH 1/2] Restore modules/sentry-cocoa Git submodule This reverts "Use pre-built version of sentry-cocoa SDK (#3727)" commit d179ec9157934e9fbaa0e00860e6c1e090029414 and restores the modules/sentry-cocoa Git module checked out at: https://github.com/getsentry/sentry-cocoa/pull/6193 --- .github/actions/buildcocoasdk/action.yml | 17 +++++ .github/workflows/build.yml | 4 ++ .github/workflows/device-tests-ios.yml | 3 + .github/workflows/update-deps.yml | 2 +- .gitignore | 3 - .gitmodules | 3 + Sentry.sln | 3 - modules/sentry-cocoa | 1 + modules/sentry-cocoa.properties | 2 - scripts/build-sentry-cocoa.sh | 2 +- scripts/generate-cocoa-bindings.ps1 | 12 ++-- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 1 - .../Sentry.Bindings.Cocoa.csproj | 65 +++---------------- src/Sentry.Bindings.Cocoa/StructsAndEnums.cs | 1 - 14 files changed, 46 insertions(+), 73 deletions(-) create mode 100644 .github/actions/buildcocoasdk/action.yml create mode 160000 modules/sentry-cocoa delete mode 100644 modules/sentry-cocoa.properties diff --git a/.github/actions/buildcocoasdk/action.yml b/.github/actions/buildcocoasdk/action.yml new file mode 100644 index 0000000000..d7dc4066b6 --- /dev/null +++ b/.github/actions/buildcocoasdk/action.yml @@ -0,0 +1,17 @@ +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 df1d3c25f9..f3d0d646e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -204,6 +204,10 @@ jobs: if: ${{ !matrix.container }} uses: ./.github/actions/buildnative + - name: Build Cocoa SDK + if: runner.os == 'macOS' + uses: ./.github/actions/buildcocoasdk + - name: Restore .NET Dependencies run: dotnet restore ${{ matrix.slnf }} --nologo diff --git a/.github/workflows/device-tests-ios.yml b/.github/workflows/device-tests-ios.yml index c56226bdb6..4cfc8fef4d 100644 --- a/.github/workflows/device-tests-ios.yml +++ b/.github/workflows/device-tests-ios.yml @@ -27,6 +27,9 @@ 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 626240a456..aee9bb85ed 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.properties + path: modules/sentry-cocoa - name: Java SDK path: scripts/update-java.ps1 - name: Native SDK diff --git a/.gitignore b/.gitignore index 23c230d87a..6644a9ce1b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,3 @@ test/**/*.apk *.log .sentry-native **/EnvironmentVariables.g.cs - -# Download cache for Cocoa SDK -modules/sentry-cocoa diff --git a/.gitmodules b/.gitmodules index 71bd96d198..172d270909 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,9 @@ [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/Sentry.sln b/Sentry.sln index 3730377a46..a1312136c3 100644 --- a/Sentry.sln +++ b/Sentry.sln @@ -156,9 +156,6 @@ 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 new file mode 160000 index 0000000000..50699cb682 --- /dev/null +++ b/modules/sentry-cocoa @@ -0,0 +1 @@ +Subproject commit 50699cb682a6821c257009158bc9b3d41d48a81e diff --git a/modules/sentry-cocoa.properties b/modules/sentry-cocoa.properties deleted file mode 100644 index d4dde9863e..0000000000 --- a/modules/sentry-cocoa.properties +++ /dev/null @@ -1,2 +0,0 @@ -version = 8.56.0 -repo = https://github.com/getsentry/sentry-cocoa diff --git a/scripts/build-sentry-cocoa.sh b/scripts/build-sentry-cocoa.sh index 95247e281f..71e6fd6570 100755 --- a/scripts/build-sentry-cocoa.sh +++ b/scripts/build-sentry-cocoa.sh @@ -54,7 +54,7 @@ echo "::endgroup::" # Copy headers - used for generating bindings mkdir Carthage/Headers -find Carthage/Build-ios/Sentry.xcframework/ios-arm64 -name '*.h' -exec cp {} Carthage/Headers \; +find Carthage/Build-ios/Sentry.xcframework/ios-arm64_arm64e -name '*.h' -exec cp {} Carthage/Headers \; # Remove anything we don't want to bundle in the nuget package. find Carthage/Build* \( -name Headers -o -name PrivateHeaders -o -name Modules \) -exec rm -rf {} + diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index eb1295808e..6186216ea0 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -4,7 +4,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $RootPath = (Get-Item $PSScriptRoot).Parent.FullName -$CocoaSdkPath = "$RootPath/modules/sentry-cocoa/Sentry.framework" +$CocoaSdkPath = "$RootPath/modules/sentry-cocoa" $BindingsPath = "$RootPath/src/Sentry.Bindings.Cocoa" $BackupPath = "$BindingsPath/obj/_unpatched" @@ -101,7 +101,7 @@ Write-Output "iPhoneSdkVersion: $iPhoneSdkVersion" # ...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 +$filesToPatch = Get-ChildItem -Path "$CocoaSdkPath/Carthage/Headers" -Filter *.h -Recurse | Select-Object -ExpandProperty FullName foreach ($file in $filesToPatch) { if (Test-Path $file) @@ -116,7 +116,7 @@ foreach ($file in $filesToPatch) Write-Host "File not found: $file" } } -$privateHeaderFile = "$CocoaSdkPath/PrivateHeaders/PrivatesHeader.h" +$privateHeaderFile = "$CocoaSdkPath/Carthage/Headers/PrivatesHeader.h" if (Test-Path $privateHeaderFile) { $content = Get-Content -Path $privateHeaderFile -Raw @@ -133,9 +133,9 @@ else # Generate bindings Write-Output 'Generating bindings with Objective Sharpie.' sharpie bind -sdk $iPhoneSdkVersion ` - -scope "$CocoaSdkPath" ` - "$CocoaSdkPath/Headers/Sentry.h" ` - "$CocoaSdkPath/PrivateHeaders/PrivateSentrySDKOnly.h" ` + -scope "$CocoaSdkPath/Carthage/Headers" ` + "$CocoaSdkPath/Carthage/Headers/Sentry.h" ` + "$CocoaSdkPath/Carthage/Headers/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 f33b1c6815..88c0d116b8 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -7,7 +7,6 @@ using System; using Foundation; using ObjCRuntime; -using Sentry; using UIKit; namespace Sentry.CocoaSdk; diff --git a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj index 98e6fde2d2..04d22ca31b 100644 --- a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj +++ b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj @@ -7,11 +7,8 @@ true true .NET Bindings for the Sentry Cocoa SDK - ..\..\modules\sentry-cocoa\ - $(SentryCocoaCache)Sentry.framework\ - $([System.IO.File]::ReadAllText("$(MSBuildThisFileDirectory)../../modules/sentry-cocoa.properties")) - $([System.Text.RegularExpressions.Regex]::Match($(SentryCocoaProperties), 'version\s*=\s*([^\s]+)').Groups[1].Value) - $(SentryCocoaCache)Sentry-$(SentryCocoaVersion).xcframework + ..\..\modules\sentry-cocoa\ + $(SentryCocoaSdkDirectory)Carthage\Build-$(TargetPlatformIdentifier)\Sentry.xcframework $(NoWarn);CS0108 @@ -51,60 +48,18 @@ - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - + + - + diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index 9735003cd1..dfdc9c43c5 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -7,7 +7,6 @@ using System.Runtime.InteropServices; using Foundation; using ObjCRuntime; -using Sentry; namespace Sentry.CocoaSdk; From 7fdaad0d1b43a373586018c17168b05c1c585e96 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 18 Sep 2025 11:11:32 +0200 Subject: [PATCH 2/2] Sentry.Samples.Maui: NRE --- samples/Sentry.Samples.Maui/MainPage.xaml | 6 ++++++ samples/Sentry.Samples.Maui/MainPage.xaml.cs | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/samples/Sentry.Samples.Maui/MainPage.xaml b/samples/Sentry.Samples.Maui/MainPage.xaml index f9fcdbd562..7eb477deac 100644 --- a/samples/Sentry.Samples.Maui/MainPage.xaml +++ b/samples/Sentry.Samples.Maui/MainPage.xaml @@ -55,6 +55,12 @@ Clicked="OnUnhandledExceptionClicked" HorizontalOptions="Center" /> +