Skip to content

Conversation

runningcode
Copy link
Contributor

📜 Description

This adds a new task SentryUploadAppArtifactTask which calls to
sentry-cli mobile-app upload (apk or abb).

Most sentry functionality is enabled by the variant filter in the sentry extension. However, the size upload functionality is enabled by default when we are on CI.
This is because some teams might want to enable debug builds to upload or have some different logic than the regular variant filter.

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

@runningcode runningcode force-pushed the no/size-analysis branch 3 times, most recently from 6e01215 to 00bd9a2 Compare June 12, 2025 14:42
if (bundleFile != null) {
if (bundleFile.exists()) {
args.add(bundleFile.path)
return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, if we need to add more arguments to the upload (like proguard or other files), this is perhaps not the best design since it relies on early returns.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think we might need to add mappings for apks, so I think a when statement would be better here, like when AAB, args are just aab, when APK we could append proguard mappings (in future when added to CLI), etc.

@runningcode runningcode force-pushed the no/size-analysis branch 6 times, most recently from 661868d to c6f323b Compare June 16, 2025 15:39
val enabled: Property<Boolean> =
objects
.property(Boolean::class.java)
.convention(providerFactory.isCi() && false) // set to false for now otherwise upload fails CI
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is hardcoded to false for the time being so that we don’t auto-upload while it isn’t working.

@runningcode runningcode marked this pull request as ready for review June 16, 2025 16:42
@@ -2,6 +2,10 @@

## Unreleased

### Features

- Add upload functionality for size analysis ([#915](https://github.com/getsentry/sentry-android-gradle-plugin/pull/915))
Copy link
Member

Choose a reason for hiding this comment

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

I guess we'd need to expand on this, like mention the new sizeAnalysis extension and when the builds are uploaded by default, but this can be done later when we GA this


@get:InputFile
@get:Optional
@get:PathSensitive(PathSensitivity.NAME_ONLY)
Copy link
Member

Choose a reason for hiding this comment

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

should this be RELATIVE? In case e.g. the variant changes (e.g. build/outputs/${variant}/aab)? Same for the apk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the variant changes then the content of the file will change as well. I don't see why the location of file is important here though. It won't affect the directory in the uploaded zip.

): Pair<TaskProvider<SentryUploadAppArtifactTask>, TaskProvider<SentryUploadAppArtifactTask>> {
val uploadMobileBundleTask =
project.tasks.register(
"uploadSentryBundle$taskSuffix",
Copy link
Member

@romtsn romtsn Jun 25, 2025

Choose a reason for hiding this comment

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

Suggested change
"uploadSentryBundle$taskSuffix",
"uploadSentryBundle${taskSuffix}ForSizeAnalysis",

don't know if we have to be specific here, but just a suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good point, but we might do more than just size analysis with the upload.

Copy link
Member

Choose a reason for hiding this comment

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

Would be cool to add an integration test - you can take a look at https://github.com/getsentry/sentry-android-gradle-plugin/blob/main/plugin-build/src/test/kotlin/io/sentry/android/gradle/integration/SentryPluginIntegrationTest.kt which tests uploads against a simple python server spawned locally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i've added this! good suggestion!

Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

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

minor things, but nothing blocking. LGTM, great stuff!

# Conflicts:
#	examples/android-guardsquare-proguard/sentry.properties
#	plugin-build/sentry-cli.properties
@runningcode runningcode changed the title Add upload functionality for size analysis feat() Add upload functionality for size analysis Aug 28, 2025
@runningcode runningcode changed the title feat() Add upload functionality for size analysis feat(size-analysis) Add upload functionality for size analysis Aug 28, 2025
@runningcode runningcode changed the title feat(size-analysis) Add upload functionality for size analysis feat(size-analysis): Add upload functionality for size analysis Aug 28, 2025
Copy link
Contributor

github-actions bot commented Aug 28, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against ed2fa6d

@@ -1,2 +1,2 @@
version = 2.52.0
version = 2.53.0-alpha
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is so that the integration tests use 2.53.0-alpha and pass.

@runningcode runningcode requested a review from romtsn August 28, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants