Skip to content

Commit 0405cb2

Browse files
authored
fix: Sentry Cocoa framework version (#4411)
1 parent 95d88d6 commit 0405cb2

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Fixes
66

77
- Crontabs now support day names (MON-SUN) and allow step values and ranges to be combined ([#4407](https://github.com/getsentry/sentry-dotnet/pull/4407))
8+
- Ensure the correct Sentry Cocoa SDK framework version is used on iOS ([#4411](https://github.com/getsentry/sentry-dotnet/pull/4411))
89

910
### Dependencies
1011

src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
<Description>.NET Bindings for the Sentry Cocoa SDK</Description>
1010
<SentryCocoaCache>..\..\modules\sentry-cocoa\</SentryCocoaCache>
1111
<SentryCocoaFrameworkHeaders>$(SentryCocoaCache)Sentry.framework\</SentryCocoaFrameworkHeaders>
12-
<SentryCocoaFramework>$(SentryCocoaCache)Sentry-Dynamic.xcframework</SentryCocoaFramework>
12+
<SentryCocoaProperties>$([System.IO.File]::ReadAllText("$(MSBuildThisFileDirectory)../../modules/sentry-cocoa.properties"))</SentryCocoaProperties>
13+
<SentryCocoaVersion>$([System.Text.RegularExpressions.Regex]::Match($(SentryCocoaProperties), 'version\s*=\s*([^\s]+)').Groups[1].Value)</SentryCocoaVersion>
14+
<SentryCocoaFramework>$(SentryCocoaCache)Sentry-$(SentryCocoaVersion).xcframework</SentryCocoaFramework>
1315
</PropertyGroup>
1416

1517
<!-- Build empty assemblies when not on macOS, to pass the solution build. -->
@@ -46,44 +48,50 @@
4648
</ItemGroup>
4749

4850
<!-- Downloads and sets up the Cocoa SDK: dotnet msbuild /t:setupCocoaSDK src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj -->
49-
<Target Name="SetupCocoaSDK"
50-
Condition="$([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(SentryCocoaCache)Sentry-Dynamic.xcframework')"
51-
BeforeTargets="BeforeBuild">
52-
53-
<PropertyGroup>
54-
<PropertiesContent>$([System.IO.File]::ReadAllText("../../modules/sentry-cocoa.properties"))</PropertiesContent>
55-
<CocoaVersion>$([System.Text.RegularExpressions.Regex]::Match($(PropertiesContent), 'version\s*=\s*([^\s]+)').Groups[1].Value)</CocoaVersion>
56-
</PropertyGroup>
51+
<Target Name="_SetupCocoaSDK"
52+
Condition="$([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(SentryCocoaFramework)')">
5753

58-
<Message Importance="High" Text="Setting up the Cocoa SDK version '$(CocoaVersion)'." />
54+
<Message Importance="High" Text="Setting up the Cocoa SDK version '$(SentryCocoaVersion)'." />
5955

6056
<!-- Clean cache if version does not exist to get rid of old versions -->
6157
<RemoveDir
62-
Condition="!Exists('$(SentryCocoaCache)Sentry-Dynamic-$(CocoaVersion).xcframework.zip')"
58+
Condition="!Exists('$(SentryCocoaFramework).zip')"
6359
Directories="$(SentryCocoaCache)" />
6460

6561
<!-- Create cache directory -->
6662
<MakeDir Condition="!Exists('$(SentryCocoaCache)')" Directories="$(SentryCocoaCache)" />
6763

6864
<!-- Download the Cocoa SDK as pre-built .xcframework -->
6965
<Exec
70-
Condition="!Exists('$(SentryCocoaCache)Sentry-Dynamic-$(CocoaVersion).xcframework.zip')"
71-
Command="curl -L https://github.com/getsentry/sentry-cocoa/releases/download/$(CocoaVersion)/Sentry-Dynamic.xcframework.zip -o $(SentryCocoaCache)Sentry-Dynamic-$(CocoaVersion).xcframework.zip" />
66+
Condition="!Exists('$(SentryCocoaFramework).zip')"
67+
Command="curl -L https://github.com/getsentry/sentry-cocoa/releases/download/$(SentryCocoaVersion)/Sentry-Dynamic.xcframework.zip -o $(SentryCocoaFramework).zip" />
7268

7369
<Exec
74-
Condition="!Exists('$(SentryCocoaCache)Sentry-Dynamic.xcframework')"
75-
Command="unzip -o $(SentryCocoaCache)Sentry-Dynamic-$(CocoaVersion).xcframework.zip -d $(SentryCocoaCache)" />
70+
Condition="Exists('$(SentryCocoaFramework).zip') and !Exists('$(SentryCocoaFramework)')"
71+
Command="unzip -o $(SentryCocoaFramework).zip -d $(SentryCocoaCache) &amp;&amp; mv $(SentryCocoaCache)Sentry-Dynamic.xcframework $(SentryCocoaFramework)" />
7672

7773
<!-- Make a copy of the header files before we butcher these to suite objective sharpie -->
7874
<MakeDir Directories="$(SentryCocoaFrameworkHeaders)" />
7975
<ItemGroup>
80-
<FilesToCopy Include="$(SentryCocoaCache)Sentry-Dynamic.xcframework\ios-arm64_arm64e\Sentry.framework\**\*" />
76+
<FilesToCopy Include="$(SentryCocoaFramework)\ios-arm64_arm64e\Sentry.framework\**\*" />
8177
</ItemGroup>
8278
<Copy SourceFiles="@(FilesToCopy)"
8379
DestinationFolder="$(SentryCocoaFrameworkHeaders)%(RecursiveDir)"
8480
SkipUnchangedFiles="true" />
8581
</Target>
8682

83+
<!-- Setup exactly once: https://learn.microsoft.com/visualstudio/msbuild/run-target-exactly-once -->
84+
<Target Name="SetupCocoaSDKBeforeOuterBuild" DependsOnTargets="_SetupCocoaSDK"
85+
Condition="$([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(SentryCocoaFramework)')"
86+
BeforeTargets="DispatchToInnerBuilds" />
87+
88+
<Target Name="SetupCocoaSDK"
89+
BeforeTargets="BeforeBuild"
90+
Condition="$([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(SentryCocoaFramework)')">
91+
<!-- Setup exactly once: https://learn.microsoft.com/visualstudio/msbuild/run-target-exactly-once -->
92+
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_SetupCocoaSDK" RemoveProperties="TargetFramework" />
93+
</Target>
94+
8795
<Target Name="CleanCocoaSDK" AfterTargets="Clean" Condition="$([MSBuild]::IsOSPlatform('OSX'))">
8896
<RemoveDir Directories="$(SentryCocoaCache)" ContinueOnError="true" />
8997
</Target>

0 commit comments

Comments
 (0)