From 8ba307c5c2439bf146f7032a354030ef5ce3d443 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 4 Aug 2025 12:12:11 +1200 Subject: [PATCH 1/4] chore: xamarin-ios is being deprecated Resolves #4379: - https://github.com/getsentry/sentry-dotnet/issues/4379 Replace `brew install --cask xamarin-ios` with manual download and install steps to avoid CI breaking when this package is removed later this month. #skip-changelog --- scripts/generate-cocoa-bindings.ps1 | 45 +++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 1a9f7a6a9e..c7d00042c1 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -28,12 +28,51 @@ if (!(Get-Command sharpie -ErrorAction SilentlyContinue)) # Ensure Xamarin is installed (or sharpie won't produce expected output). if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/64bits/iOS/Xamarin.iOS.dll')) { - Write-Output 'Xamarin.iOS not found. Attempting to install via Homebrew.' - brew install --cask xamarin-ios + Write-Output 'Xamarin.iOS not found. Attempting to install manually.' + + # Download Xamarin.iOS package from Google Drive + $packageName = 'xamarin.ios-16.4.0.23.pkg' + $directDownloadUrl = 'https://drive.google.com/uc?export=download&id=1G8RXGVFuGMAoyo2vWGen6F8Qm5h-F4pX' + $downloadPath = "/tmp/$packageName" + + Write-Output "Downloading Xamarin.iOS package from Google Drive..." + + # Use curl to download the file (Google Drive direct download) + curl -L -o $downloadPath $directDownloadUrl + + if ($LASTEXITCODE -ne 0) + { + Write-Error "Failed to download Xamarin.iOS package. Exit code: $LASTEXITCODE" + } + + if (Test-Path $downloadPath) + { + Write-Output "Downloaded package to $downloadPath" + Write-Output "Installing Xamarin.iOS package..." + + # Install the package using installer command + installer -pkg $downloadPath -target / + + if ($LASTEXITCODE -ne 0) + { + Write-Error "Failed to install Xamarin.iOS package. Exit code: $LASTEXITCODE" + } + else + { + Write-Output "Xamarin.iOS package installed successfully" + } + + # Clean up downloaded file + Remove-Item $downloadPath -Force -ErrorAction SilentlyContinue + } + else + { + Write-Error "Downloaded package not found at $downloadPath" + } if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/64bits/iOS/Xamarin.iOS.dll')) { - Write-Error 'Xamarin.iOS not found. Try installing manually from: https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/.' + Write-Error 'Xamarin.iOS not found after installation.' } } From 02e842457e9a224b46b75c4b304a7175ec41bda3 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 4 Aug 2025 12:43:34 +1200 Subject: [PATCH 2/4] Update generate-cocoa-bindings.ps1 --- scripts/generate-cocoa-bindings.ps1 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index c7d00042c1..003b1a06cf 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -30,14 +30,12 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ { Write-Output 'Xamarin.iOS not found. Attempting to install manually.' - # Download Xamarin.iOS package from Google Drive + # Download Xamarin.iOS package $packageName = 'xamarin.ios-16.4.0.23.pkg' - $directDownloadUrl = 'https://drive.google.com/uc?export=download&id=1G8RXGVFuGMAoyo2vWGen6F8Qm5h-F4pX' + $directDownloadUrl = 'https://github.com/jamescrosswell/xamarin-ios/releases/download/16.4.0.23/Xamarin.iOS.16.4.0.23.pkg' $downloadPath = "/tmp/$packageName" - Write-Output "Downloading Xamarin.iOS package from Google Drive..." - - # Use curl to download the file (Google Drive direct download) + Write-Output "Downloading Xamarin.iOS package..." curl -L -o $downloadPath $directDownloadUrl if ($LASTEXITCODE -ne 0) @@ -50,8 +48,8 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ Write-Output "Downloaded package to $downloadPath" Write-Output "Installing Xamarin.iOS package..." - # Install the package using installer command - installer -pkg $downloadPath -target / + # Install the package using installer command (requires sudo) + sudo installer -pkg $downloadPath -target / if ($LASTEXITCODE -ne 0) { From 67246ac52e4f18b1c91b13dbdbc13953d0b2aa54 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 4 Aug 2025 18:06:52 +1200 Subject: [PATCH 3/4] Replace download URL with a release in the sentry-dotnet repo --- scripts/generate-cocoa-bindings.ps1 | 36 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 003b1a06cf..51ffaad76e 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -29,28 +29,28 @@ if (!(Get-Command sharpie -ErrorAction SilentlyContinue)) if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/64bits/iOS/Xamarin.iOS.dll')) { Write-Output 'Xamarin.iOS not found. Attempting to install manually.' - + # Download Xamarin.iOS package $packageName = 'xamarin.ios-16.4.0.23.pkg' - $directDownloadUrl = 'https://github.com/jamescrosswell/xamarin-ios/releases/download/16.4.0.23/Xamarin.iOS.16.4.0.23.pkg' + $directDownloadUrl = 'https://github.com/getsentry/sentry-dotnet/releases/download/1.0.0.0-xamarin-ios/Xamarin.iOS.16.4.0.23.pkg' $downloadPath = "/tmp/$packageName" - + Write-Output "Downloading Xamarin.iOS package..." curl -L -o $downloadPath $directDownloadUrl - + if ($LASTEXITCODE -ne 0) { Write-Error "Failed to download Xamarin.iOS package. Exit code: $LASTEXITCODE" } - + if (Test-Path $downloadPath) { Write-Output "Downloaded package to $downloadPath" Write-Output "Installing Xamarin.iOS package..." - + # Install the package using installer command (requires sudo) sudo installer -pkg $downloadPath -target / - + if ($LASTEXITCODE -ne 0) { Write-Error "Failed to install Xamarin.iOS package. Exit code: $LASTEXITCODE" @@ -59,7 +59,7 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ { Write-Output "Xamarin.iOS package installed successfully" } - + # Clean up downloaded file Remove-Item $downloadPath -Force -ErrorAction SilentlyContinue } @@ -84,23 +84,30 @@ Write-Output "iPhoneSdkVersion: $iPhoneSdkVersion" # `#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) { +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 { + } + else + { Write-Host "File not found: $file" } } $privateHeaderFile = "$CocoaSdkPath/PrivateHeaders/PrivatesHeader.h" -if (Test-Path $privateHeaderFile) { +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 { +} +else +{ Write-Host "File not found: $privateHeaderFile" } @@ -295,7 +302,8 @@ $propertiesToRemove = @( 'enableMetricKitRawPayload' ) -foreach ($property in $propertiesToRemove) { +foreach ($property in $propertiesToRemove) +{ $Text = $Text -replace "\n.*property.*$property.*?[\s\S]*?\}\n", '' } From b0e7c3ad1797288874c7e49b137072d566163483 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 5 Aug 2025 09:31:14 +1200 Subject: [PATCH 4/4] Update generate-cocoa-bindings.ps1 --- scripts/generate-cocoa-bindings.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 51ffaad76e..dc56868e59 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -34,6 +34,7 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ $packageName = 'xamarin.ios-16.4.0.23.pkg' $directDownloadUrl = 'https://github.com/getsentry/sentry-dotnet/releases/download/1.0.0.0-xamarin-ios/Xamarin.iOS.16.4.0.23.pkg' $downloadPath = "/tmp/$packageName" + $expectedSha256 = '3c3a2e3c5adebf7955934862b89c82e4771b0fd44dfcfebad0d160033a6e0a1a' Write-Output "Downloading Xamarin.iOS package..." curl -L -o $downloadPath $directDownloadUrl @@ -43,6 +44,19 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ Write-Error "Failed to download Xamarin.iOS package. Exit code: $LASTEXITCODE" } + # Verify checksum + Write-Output "Verifying package checksum..." + $actualSha256 = (Get-FileHash -Path $downloadPath -Algorithm SHA256).Hash.ToLower() + + if ($actualSha256 -ne $expectedSha256) + { + Write-Error "Checksum verification failed. Expected: $expectedSha256, Actual: $actualSha256" + Remove-Item $downloadPath -Force -ErrorAction SilentlyContinue + exit 1 + } + + Write-Output "Checksum verification passed." + if (Test-Path $downloadPath) { Write-Output "Downloaded package to $downloadPath"