Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upload Android native symbols #2876

Merged
merged 7 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

## Unreleased - 4.x

### API breaking Changes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this reverted the breakage, we can fix the final changelog before GA

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah since we had separated out the changes into -beta.1 etc. it was hard to know what to do... I didn't want to remove the breakage from the earlier alpha release as that would be misleading. But yeah, we can consolidate it all when we GA. 👍🏻


- 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))

### Fixes

- Android native symbol upload ([#2876](https://github.com/getsentry/sentry-dotnet/pull/2876))

## 4.0.0-beta.1

### Features
Expand Down
8 changes: 7 additions & 1 deletion integration-test/cli.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ Describe 'MAUI' -ForEach @(

It "uploads symbols and sources for an Android build" {
$result = RunDotnetWithSentryCLI 'build' 'maui-app' $True $True "$framework-android"
$result.UploadedDebugFiles() | Sort-Object -Unique | Should -Be @('maui-app.pdb')
$result.UploadedDebugFiles() | Sort-Object -Unique | Should -Be @(
'libsentry-android.so',
'libsentry.so',
'libsentrysupplemental.so',
'libxamarin-app.so',
'maui-app.pdb'
)
$result.ScriptOutput | Should -AnyElementMatch 'Found 1 debug information file \(1 with embedded sources\)'
}

Expand Down
40 changes: 25 additions & 15 deletions src/Sentry/buildTransitive/Sentry.targets
Original file line number Diff line number Diff line change
Expand Up @@ -141,46 +141,56 @@
<SentryCLIUploadAfterTargets Condition="!$(TargetFramework.StartsWith('net7'))">_CopyAotSymbols</SentryCLIUploadAfterTargets>
<SentryCLIUploadAfterTargets Condition="$(TargetFramework.StartsWith('net7'))">CopyNativeBinary</SentryCLIUploadAfterTargets>
</PropertyGroup>
<ItemGroup Condition="'$(SentryCLIUploadNativeAOT)' == 'true'">
<SentryCLIUploadSymbolType Include="pdb" />
<SentryCLIUploadSymbolType Include="dsym" />
<SentryCLIUploadSymbolType Include="elf" />
</ItemGroup>

<!-- "Standard" managed build -->
<PropertyGroup Condition="'$(SentryCLIUploadNativeAOT)' != 'true'">
<SentryCLIUploadNativeAOT>false</SentryCLIUploadNativeAOT>
<SentryCLIUploadDirectory>$(OutputPath)</SentryCLIUploadDirectory>
<SentryCLIUploadAfterTargets>Build</SentryCLIUploadAfterTargets>
</PropertyGroup>
<ItemGroup Condition="'$(SentryCLIUploadNativeAOT)' != 'true'">
<SentryCLIUploadSymbolType Include="pdb" />
<SentryCLIUploadSymbolType Include="portablepdb" />
<SentryCLIUploadSymbolType Include="dsym" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'" />
<SentryCLIUploadSymbolType Include="dsym" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'" />
</ItemGroup>

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

<ItemGroup>
<SentryCLIUploadSymbolType Include="pdb" />
<SentryCLIUploadSymbolType Include="portablepdb" Condition="'$(SentryCLIUploadNativeAOT)' != 'true'" />
<SentryCLIUploadSymbolType Include="dsym" />
<SentryCLIUploadSymbolType Include="elf" Condition="'$(SentryCLIUploadNativeAOT)' == 'true' or $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'" />
</ItemGroup>

<!-- 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. -->
<ItemGroup Condition="'$(IntermediateOutputPath)' != '' and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<AndroidNativeSymbolFiles Include="$(IntermediateOutputPath)**/*.so" />
</ItemGroup>
<ItemGroup>
<AndroidNativeSymbolFilesExceptDll Include="@(AndroidNativeSymbolFiles)"
Condition="!$([System.Text.RegularExpressions.Regex]::Match(%(Identity),'.*.dll.so').Success)"/>
</ItemGroup>

<PropertyGroup>
<SentryCLIUploadItems>$(SentryCLIUploadDirectory)</SentryCLIUploadItems>
<SentryCLIUploadItems Condition="'@(AndroidNativeSymbolFilesExceptDll)' != ''">$(SentryCLIUploadItems) @(AndroidNativeSymbolFilesExceptDll -> '%(Identity)', ' ')</SentryCLIUploadItems>
</PropertyGroup>

<!-- if (UploadSymbols && UploadSources) { -->
<Message Importance="High"
Condition="'$(SentryUploadSymbols)' == 'true' and '$(SentryUploadSources)' == 'true'"
Text="Preparing upload to Sentry for project '$(MSBuildProjectName)' ($(Configuration)/$(TargetFramework)): collecting debug symbols and referenced source code from $(SentryCLIUploadDirectory)" />
Text="Preparing upload to Sentry for project '$(MSBuildProjectName)' ($(Configuration)/$(TargetFramework)): collecting debug symbols and referenced source code from $(SentryCLIUploadItems)" />
<Exec
Condition="'$(SentryUploadSymbols)' == 'true' and '$(SentryUploadSources)' == 'true'"
Command="$(SentryCLIDebugFilesUploadCommand) @(SentryCLIUploadSymbolType -> '-t %(Identity)', ' ') --include-sources $(SentryCLIUploadDirectory)"
Command="$(SentryCLIDebugFilesUploadCommand) @(SentryCLIUploadSymbolType -> '-t %(Identity)', ' ') --include-sources $(SentryCLIUploadItems)"
IgnoreExitCode="true" ContinueOnError="WarnAndContinue">
<Output TaskParameter="ExitCode" PropertyName="_SentryCLIExitCode" />
</Exec>
<!-- } else if (UploadSymbols && !UploadSources) { -->
<Message Importance="High"
Condition="'$(SentryUploadSymbols)' == 'true' and '$(SentryUploadSources)' != 'true'"
Text="Preparing upload to Sentry for project '$(MSBuildProjectName)' ($(Configuration)/$(TargetFramework)): collecting debug symbols from $(SentryCLIUploadDirectory)" />
Text="Preparing upload to Sentry for project '$(MSBuildProjectName)' ($(Configuration)/$(TargetFramework)): collecting debug symbols from $(SentryCLIUploadItems)" />
<Exec
Condition="'$(SentryUploadSymbols)' == 'true' and '$(SentryUploadSources)' != 'true'"
Command="$(SentryCLIDebugFilesUploadCommand) @(SentryCLIUploadSymbolType -> '-t %(Identity)', ' ') $(SentryCLIUploadDirectory)"
Command="$(SentryCLIDebugFilesUploadCommand) @(SentryCLIUploadSymbolType -> '-t %(Identity)', ' ') $(SentryCLIUploadItems)"
IgnoreExitCode="true" ContinueOnError="WarnAndContinue">
<Output TaskParameter="ExitCode" PropertyName="_SentryCLIExitCode" />
</Exec>
Expand Down