feat(snapshots): Add snapshot upload task#1091
Merged
runningcode merged 12 commits intomainfrom Mar 6, 2026
Merged
Conversation
Add a new `sentryUploadSnapshots` task that uploads snapshots to Sentry via `sentry-cli build snapshots`. The task is registered when the user configures a snapshots path via the new `sentry.snapshots` extension block. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Internal Changes 🔧Deps
🤖 This preview updates automatically when you update the PR. |
Contributor
|
runningcode
commented
Mar 3, 2026
plugin-build/src/main/kotlin/io/sentry/android/gradle/SentryPlugin.kt
Outdated
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Register the task unconditionally and let the lazy DirectoryProperty handle resolution at execution time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
sentry-cli build snapshots requires --app-id. Add it as a required property on the SnapshotsExtension. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
runningcode
commented
Mar 4, 2026
plugin-build/src/main/kotlin/io/sentry/android/gradle/extensions/SnapshotsExtension.kt
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
plugin-build/src/main/kotlin/io/sentry/android/gradle/tasks/SentryUploadSnapshotsTask.kt
Show resolved
Hide resolved
Move all wiring logic into the task's register() method so the plugin call site only passes project, extension, and org/project overrides. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
runningcode
commented
Mar 4, 2026
plugin-build/src/main/kotlin/io/sentry/android/gradle/extensions/SnapshotsExtension.kt
Show resolved
Hide resolved
runningcode
commented
Mar 4, 2026
plugin-build/src/main/kotlin/io/sentry/android/gradle/tasks/SentryUploadSnapshotsTask.kt
Outdated
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rbro112
approved these changes
Mar 5, 2026
romtsn
reviewed
Mar 5, 2026
romtsn
reviewed
Mar 5, 2026
plugin-build/src/main/kotlin/io/sentry/android/gradle/tasks/SentryUploadSnapshotsTask.kt
Outdated
Show resolved
Hide resolved
romtsn
approved these changes
Mar 5, 2026
Member
romtsn
left a comment
There was a problem hiding this comment.
LGTM, a couple of minor things though (sentry properties probably needs to be addressed)
Add proper telemetry setup via configureTelemetryNoVariant, wire sentryProperties file, and pass buildEvents and cliExecutable to the register method. Remove unused GradleInternal import. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
plugin-build/src/main/kotlin/io/sentry/android/gradle/tasks/SentryUploadSnapshotsTask.kt
Outdated
Show resolved
Hide resolved
The snapshot upload task has no variant context, so variant needs to be optional when resolving the sentry.properties file path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Telemetry wiring is not needed for the snapshot upload task. Remove the unused buildEvents parameter and the configureTelemetryNoVariant helper function. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
plugin-build/src/main/kotlin/io/sentry/android/gradle/SentryPropertiesFileProvider.kt
Show resolved
Hide resolved
When variant is null (e.g. snapshot uploads), buildTypeName resolves to an empty string, producing nonsensical paths with double separators like src//sentry.properties. Guard buildTypeName-based paths the same way flavorName-based paths are already guarded. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verify that getPropertiesFilePath with a null variant finds files in the project root and does not search buildType-specific paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context this is just the first version of the feature for BYO snapshots where customers already generate their own snapshots through another framework. This allows them to upload the snapshot folder directory to us.
Summary
sentryUploadSnapshotstask that invokessentry-cli build snapshots --app-id <APP_ID> <path>to upload snapshots to Sentrysentry.snapshotsextension block withappIdandpathpropertiesUsage
In your app module's
build.gradle.kts:sentry { snapshots { appId.set("com.example.myapp") path.set(file("path/to/snapshots")) } }Then run:
🤖 Generated with Claude Code