Skip to content

Commit f3e8729

Browse files
Remove unnecessary files from SentryCocoaFramework before packing (#4602)
1 parent 13d64cf commit f3e8729

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Remove unnecessary files from SentryCocoaFramework before packing ([#4602](https://github.com/getsentry/sentry-dotnet/pull/4602))
6+
37
## 6.0.0-preview.1
48

59
### BREAKING CHANGES

integration-test/cli.Tests.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ Describe 'MAUI (<framework>)' -ForEach @(
182182
'Microsoft.Maui.pdb',
183183
'Sentry'
184184
)
185-
$result.ScriptOutput | Should -AnyElementMatch "Found 77 debug information files \(8 with embedded sources\)"
185+
# The specific number of debug information files seems to change with different SDK - so we just check for non-zero
186+
$nonZeroNumberRegex = '[1-9][0-9]*';
187+
$result.ScriptOutput | Should -AnyElementMatch "Found $nonZeroNumberRegex debug information files \($nonZeroNumberRegex with embedded sources\)"
186188
}
187189
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102

103103
<!-- Choose between download and build -->
104104
<Target Name="_SetupCocoaSDK"
105-
DependsOnTargets="_DownloadCocoaSDK;_BuildCocoaSDK"
105+
DependsOnTargets="_DownloadCocoaSDK;_BuildCocoaSDK;_GenerateSentryCocoaBindings;SanitizeSentryCocoaFramework"
106106
Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
107107

108108
<!-- Setup exactly once: https://learn.microsoft.com/visualstudio/msbuild/run-target-exactly-once -->
@@ -122,7 +122,7 @@
122122
</Target>
123123

124124
<!-- Generate bindings -->
125-
<Target Name="_GenerateSentryCocoaBindings" AfterTargets="SetupCocoaSDK"
125+
<Target Name="_GenerateSentryCocoaBindings"
126126
Condition="$([MSBuild]::IsOSPlatform('OSX'))"
127127
Inputs="$(SentryCocoaBindingInputs)"
128128
Outputs="ApiDefinitions.cs;StructsAndEnums.cs">
@@ -134,6 +134,13 @@
134134
<Exec Condition="'$(GITHUB_ACTIONS)' == 'true'" Command="pwsh ../../scripts/dirty-check.ps1 -PathToCheck $(MSBuildThisFileDirectory)" />
135135
</Target>
136136

137+
<!-- Sanitize the xcframework before NativeReference resolution and packing -->
138+
<Target Name="SanitizeSentryCocoaFramework"
139+
Condition="$([MSBuild]::IsOSPlatform('OSX')) and Exists('$(SentryCocoaFramework)')">
140+
<Message Importance="High" Text="Sanitizing $(SentryCocoaFramework): removing dSYMs, Headers, Modules, PrivateHeaders (including symlinks)." />
141+
<Exec Command="find &quot;$(SentryCocoaFramework)&quot; -depth \( -name dSYMs -o -name Headers -o -name Modules -o -name PrivateHeaders \) -exec echo Removing {} \; -exec rm -rf {} + 2&gt;/dev/null || true" />
142+
</Target>
143+
137144
<!-- Workaround for https://github.com/xamarin/xamarin-macios/issues/15299 -->
138145
<Target Name="_SetGeneratedSupportDelegatesInternal" BeforeTargets="CoreCompile" Condition="$([MSBuild]::IsOSPlatform('OSX'))"
139146
Inputs="$(GeneratedSourcesDir)SupportDelegates.g.cs" Outputs="$(GeneratedSourcesDir)SupportDelegates.g.cs.stamp">

0 commit comments

Comments
 (0)