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: Adding proguard rules to Sentry.Bindings.Android #2450

Merged
merged 10 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Fixes

- Builds targeting Android with `r8` enabled no longer crash during SDK init. The package now contains the required proguard rules ([#2450]https://github.com/getsentry/sentry-dotnet/pull/2450)
- Fix Sentry logger options for MAUI and Azure Functions ([#2423](https://github.com/getsentry/sentry-dotnet/pull/2423))

### Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Sentry\Sentry.csproj" />
<Using Include="Android.App.Activity" Alias="Activity" />

<!--
The NuGet package the containing the binding comes with a .targets that sets the ProguardConfiguration
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved
Since we're referencing the project itself we're grabbing the ProguardConfiguration from project directly.
-->
<ProguardConfiguration Include="..\..\src\Sentry.Bindings.Android\sentry-proguard.cfg" />
</ItemGroup>

<!--
Expand Down
2 changes: 2 additions & 0 deletions src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<ItemGroup>
<None Remove="$(MSBuildThisFileDirectory)..\..\README.md" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="" />
<None Include="$(MSBuildThisFileDirectory)build/Sentry.Bindings.Android.targets" Pack="true" PackagePath="build/$(TargetFramework)$(TargetPlatformVersion)/Sentry.Bindings.Android.targets" />
<None Include="$(MSBuildThisFileDirectory)sentry-proguard.cfg" Pack="true" PackagePath="" />
<PackageReference Remove="SIL.ReleaseTasks" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProguardConfiguration Include="$(MSBuildThisFileDirectory)..\..\proguard.cfg" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions src/Sentry.Bindings.Android/sentry-proguard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Because we use string-based lookups we need to keep names on selected sentry-java classes
-keep class io.sentry.Sentry { *; }
-keep class io.sentry.android.core.SentryAndroid { *; }
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
-keep class io.sentry.android.core.SentryAndroidOptions { *; }
-keep class io.sentry.android.core.SentryInitProvider { *; }
-keep class io.sentry.android.core.SentryPerformanceProvider { *; }
-keep class io.sentry.android.supplemental.* { *; }
-keep class io.sentry.protocol.** { *; }