getsentry / sentry-android-gradle-plugin

Gradle plugin for Sentry Android. Upload proguard, debug files, and more.

Home Page:https://docs.sentry.io/platforms/android/gradle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable source context for non-release buildtype

Shadowsx3 opened this issue · comments

Problem Statement

Currently by setting the includeSourceContext option to true, only the build type of release type automatically reports the source context during the assemble task.
It would be great if other custom build types could have the ability to report it automatically by enabling the option.
The documentation did not specify this detail and this change would be a great help in a variety of projects.

Solution Brainstorm

There are places in the code that even if you enable the option to do so, check that specifically the name of the build type is release. We could change that as in the following example and depend on the user configuration.

Example

hi @Shadowsx3 that's a good feature request, thank you! The reason we limited this to only release builds is to not regress build speed for debug builds, but having this configurable with a list of supported build types makes a lot of sense, we'll look into implementing this!

Let's make this configurable:

  • by default do it only for release builds
  • if configured, you can define all required buildTypes (~sentry { sourceContext { enabled: true|false, buildTypes: []}})

As of now, the sentry AGP doesn't upload Source Context files if we use plugins like https://github.com/Triple-T/gradle-play-publisher. The task to build (and publish) an AAB using that plugin is ./gradlew :app:publishReleaseBundle

Since the task mentioned above is not identified as an assemble/bundle task by Sentry AGP, the Sentry plugin skips uploading sources.

What's the recommended approach if we would like to force sentry AGP to run the Source Context related tasks for tasks other than assemble/bundle?

Hey @RationalRank, thanks for the additional feedback!

You could always run the upload task (e.g. ./gradlew :app:sentryUploadSourceBundleRelease) manually to upload sources.