Skip to content

Commit

Permalink
Add autoUploadSourceContextBuildTypes property
Browse files Browse the repository at this point in the history
  • Loading branch information
markushi committed Mar 26, 2024
1 parent 2ea612f commit ec7f3a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/android-instrumentation-sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ sentry {

includeSourceContext.set(true)
autoUploadSourceContext.set(CI.canAutoUpload())
autoUploadSourceContextBuildTypes.set(setOf("debug", "release"))
additionalSourceDirsForSourceContext.set(setOf("src/custom/java"))

org.set("sentry-sdks")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,9 @@ private fun Variant.configureSourceBundleTasks(
taskSuffix
)

if (variant.buildTypeName == "release") {
if (extension.autoUploadSourceContextBuildTypes.get().contains(variant.buildTypeName)) {
sourceContextTasks.uploadSourceBundleTask.hookWithAssembleTasks(project, variant)
}

return sourceContextTasks
} else {
project.logger.info {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private fun ApplicationVariant.configureSourceBundleTasks(
taskSuffix
)

if (variant.buildTypeName == "release") {
if (extension.autoUploadSourceContextBuildTypes.get().contains(variant.buildTypeName)) {
sourceContextTasks.uploadSourceBundleTask.hookWithAssembleTasks(project, variant)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ abstract class SentryPluginExtension @Inject constructor(project: Project) {
val autoUploadSourceContext: Property<Boolean> = objects
.property(Boolean::class.java).convention(true)

/**
* Which build types should be considered for automatic source context upload.
* Default is "release" only.
*/
val autoUploadSourceContextBuildTypes: SetProperty<String> = objects
.setProperty(String::class.java).convention(setOf("release"))

/**
* Configure additional directories to be included in the source bundle which is used for
* source context. The directories should be specified relative to the Gradle module/project's
Expand Down

0 comments on commit ec7f3a3

Please sign in to comment.