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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autoUploadSourceContextBuildTypes property #680

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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 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
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not really sure if we should limit ourselves to build types, should add support for flavors too?

.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
Loading