Skip to content

Commit c32be36

Browse files
authored
fix: upload Android native symbols (#2876)
1 parent 89b2f6a commit c32be36

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
## Unreleased - 4.x
44

5+
### API breaking Changes
6+
57
- ISpanTracer has been renamed back again to ISpan, to make it easier to upgrade from v3.x to v4.x ([#2870](https://github.com/getsentry/sentry-dotnet/pull/2870))
68

9+
### Fixes
10+
11+
- Android native symbol upload ([#2876](https://github.com/getsentry/sentry-dotnet/pull/2876))
12+
713
## 4.0.0-beta.1
814

915
### Features

integration-test/cli.Tests.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ Describe 'MAUI' -ForEach @(
152152

153153
It "uploads symbols and sources for an Android build" {
154154
$result = RunDotnetWithSentryCLI 'build' 'maui-app' $True $True "$framework-android"
155-
$result.UploadedDebugFiles() | Sort-Object -Unique | Should -Be @('maui-app.pdb')
155+
$result.UploadedDebugFiles() | Sort-Object -Unique | Should -Be @(
156+
'libsentry-android.so',
157+
'libsentry.so',
158+
'libsentrysupplemental.so',
159+
'libxamarin-app.so',
160+
'maui-app.pdb'
161+
)
156162
$result.ScriptOutput | Should -AnyElementMatch 'Found 1 debug information file \(1 with embedded sources\)'
157163
}
158164

src/Sentry/buildTransitive/Sentry.targets

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,29 +158,44 @@
158158
<SentryCLIUploadSymbolType Include="portablepdb" />
159159
<SentryCLIUploadSymbolType Include="dsym" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'" />
160160
<SentryCLIUploadSymbolType Include="dsym" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'" />
161+
<SentryCLIUploadSymbolType Include="elf" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'" />
161162
</ItemGroup>
162163

163164
<!-- Upload symbols to Sentry after the build. -->
164165
<Target Name="UploadDebugInfoToSentry" AfterTargets="$(SentryCLIUploadAfterTargets)" DependsOnTargets="PrepareSentryCLI"
165166
Condition="'$(SentryCLI)' != '' and ('$(SentryUploadSymbols)' == 'true' or '$(SentryUploadSources)' == 'true')">
166167

168+
<!-- For Android, we need to upload native symbols, but there's no point in uploading the intermediary ".dll.so" which just ended up being combined into the final app. -->
169+
<ItemGroup Condition="'$(IntermediateOutputPath)' != '' and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
170+
<AndroidNativeSymbolFiles Include="$(IntermediateOutputPath)**/*.so" />
171+
</ItemGroup>
172+
<ItemGroup>
173+
<AndroidNativeSymbolFilesExceptDll Include="@(AndroidNativeSymbolFiles)"
174+
Condition="!$([System.Text.RegularExpressions.Regex]::Match(%(Identity),'.*.dll.so').Success)"/>
175+
</ItemGroup>
176+
177+
<PropertyGroup>
178+
<SentryCLIUploadItems>$(SentryCLIUploadDirectory)</SentryCLIUploadItems>
179+
<SentryCLIUploadItems Condition="'@(AndroidNativeSymbolFilesExceptDll)' != ''">$(SentryCLIUploadItems) @(AndroidNativeSymbolFilesExceptDll -> '%(Identity)', ' ')</SentryCLIUploadItems>
180+
</PropertyGroup>
181+
167182
<!-- if (UploadSymbols && UploadSources) { -->
168183
<Message Importance="High"
169184
Condition="'$(SentryUploadSymbols)' == 'true' and '$(SentryUploadSources)' == 'true'"
170-
Text="Preparing upload to Sentry for project '$(MSBuildProjectName)' ($(Configuration)/$(TargetFramework)): collecting debug symbols and referenced source code from $(SentryCLIUploadDirectory)" />
185+
Text="Preparing upload to Sentry for project '$(MSBuildProjectName)' ($(Configuration)/$(TargetFramework)): collecting debug symbols and referenced source code from $(SentryCLIUploadItems)" />
171186
<Exec
172187
Condition="'$(SentryUploadSymbols)' == 'true' and '$(SentryUploadSources)' == 'true'"
173-
Command="$(SentryCLIDebugFilesUploadCommand) @(SentryCLIUploadSymbolType -> '-t %(Identity)', ' ') --include-sources $(SentryCLIUploadDirectory)"
188+
Command="$(SentryCLIDebugFilesUploadCommand) @(SentryCLIUploadSymbolType -> '-t %(Identity)', ' ') --include-sources $(SentryCLIUploadItems)"
174189
IgnoreExitCode="true" ContinueOnError="WarnAndContinue">
175190
<Output TaskParameter="ExitCode" PropertyName="_SentryCLIExitCode" />
176191
</Exec>
177192
<!-- } else if (UploadSymbols && !UploadSources) { -->
178193
<Message Importance="High"
179194
Condition="'$(SentryUploadSymbols)' == 'true' and '$(SentryUploadSources)' != 'true'"
180-
Text="Preparing upload to Sentry for project '$(MSBuildProjectName)' ($(Configuration)/$(TargetFramework)): collecting debug symbols from $(SentryCLIUploadDirectory)" />
195+
Text="Preparing upload to Sentry for project '$(MSBuildProjectName)' ($(Configuration)/$(TargetFramework)): collecting debug symbols from $(SentryCLIUploadItems)" />
181196
<Exec
182197
Condition="'$(SentryUploadSymbols)' == 'true' and '$(SentryUploadSources)' != 'true'"
183-
Command="$(SentryCLIDebugFilesUploadCommand) @(SentryCLIUploadSymbolType -> '-t %(Identity)', ' ') $(SentryCLIUploadDirectory)"
198+
Command="$(SentryCLIDebugFilesUploadCommand) @(SentryCLIUploadSymbolType -> '-t %(Identity)', ' ') $(SentryCLIUploadItems)"
184199
IgnoreExitCode="true" ContinueOnError="WarnAndContinue">
185200
<Output TaskParameter="ExitCode" PropertyName="_SentryCLIExitCode" />
186201
</Exec>

0 commit comments

Comments
 (0)