Skip to content

Commit ec7f3a3

Browse files
committed
Add autoUploadSourceContextBuildTypes property
1 parent 2ea612f commit ec7f3a3

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

examples/android-instrumentation-sample/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ sentry {
108108

109109
includeSourceContext.set(true)
110110
autoUploadSourceContext.set(CI.canAutoUpload())
111+
autoUploadSourceContextBuildTypes.set(setOf("debug", "release"))
111112
additionalSourceDirsForSourceContext.set(setOf("src/custom/java"))
112113

113114
org.set("sentry-sdks")

plugin-build/src/main/kotlin/io/sentry/android/gradle/AndroidComponentsConfig.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,9 @@ private fun Variant.configureSourceBundleTasks(
305305
taskSuffix
306306
)
307307

308-
if (variant.buildTypeName == "release") {
308+
if (extension.autoUploadSourceContextBuildTypes.get().contains(variant.buildTypeName)) {
309309
sourceContextTasks.uploadSourceBundleTask.hookWithAssembleTasks(project, variant)
310310
}
311-
312311
return sourceContextTasks
313312
} else {
314313
project.logger.info {

plugin-build/src/main/kotlin/io/sentry/android/gradle/AppConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private fun ApplicationVariant.configureSourceBundleTasks(
228228
taskSuffix
229229
)
230230

231-
if (variant.buildTypeName == "release") {
231+
if (extension.autoUploadSourceContextBuildTypes.get().contains(variant.buildTypeName)) {
232232
sourceContextTasks.uploadSourceBundleTask.hookWithAssembleTasks(project, variant)
233233
}
234234

plugin-build/src/main/kotlin/io/sentry/android/gradle/extensions/SentryPluginExtension.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ abstract class SentryPluginExtension @Inject constructor(project: Project) {
156156
val autoUploadSourceContext: Property<Boolean> = objects
157157
.property(Boolean::class.java).convention(true)
158158

159+
/**
160+
* Which build types should be considered for automatic source context upload.
161+
* Default is "release" only.
162+
*/
163+
val autoUploadSourceContextBuildTypes: SetProperty<String> = objects
164+
.setProperty(String::class.java).convention(setOf("release"))
165+
159166
/**
160167
* Configure additional directories to be included in the source bundle which is used for
161168
* source context. The directories should be specified relative to the Gradle module/project's

0 commit comments

Comments
 (0)