[DNM] feat(snapshots): Add Roborazzi support for Compose preview scanning#1171
Draft
runningcode wants to merge 1 commit into
Draft
[DNM] feat(snapshots): Add Roborazzi support for Compose preview scanning#1171runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
Wire `sentryUploadSnapshots<Variant>` into the Roborazzi build flow when `io.github.takahirom.roborazzi` is applied, mirroring the existing Paparazzi integration. Roborazzi already provides @Preview-driven Robolectric test generation, so the plugin only: - Configures `roborazzi.generateComposePreviewRobolectricTests` from the shared `snapshots.previews` DSL (enable, packages, includePrivatePreviews), using `convention()` so user-supplied values still win. - Pins `roborazzi.outputDir` to `build/sentry/snapshots/<variant>/` for the upload task to consume. - Hooks `recordRoborazzi<Variant>` as a dependency of `sentryUploadSnapshots<Variant>` and points its `snapshotsPath` at the staging dir. - Adds the required `roborazzi-compose-preview-scanner-support` and `ComposablePreviewScanner:android` test dependencies. Applying both Paparazzi and Roborazzi to the same module fails at configuration time with a clear message. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- Add Roborazzi support for Compose preview scanning ([#1171](https://github.com/getsentry/sentry-android-gradle-plugin/pull/1171))If none of the above apply, you can opt out of this check by adding |
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.
Summary
Wires
sentryUploadSnapshots<Variant>into the Roborazzi build flow whenio.github.takahirom.roborazziis applied, mirroring the existing Paparazzi integration. Roborazzi already provides @Preview-driven Robolectric test generation, so the plugin only configures it, pins itsoutputDir, and hooksrecordRoborazzi<Variant>as a dependency of the upload task.Behavior
When the user applies
io.github.takahirom.roborazziand setssentry.snapshots.enabled = true:roborazzi-compose-preview-scanner-supportandComposablePreviewScanner:androidtotestImplementation.generateComposePreviewRobolectricTestsfrom the sharedsnapshots.previewsDSL (enable=true,packagesfrompackageTrees,includePrivatePreviewspass-through) — usingconvention()so user values override.roborazzi.outputDirtobuild/sentry/snapshots/<variant>/(also viaconvention()).recordRoborazzi<Variant>as a dependency ofsentryUploadSnapshots<Variant>and points itssnapshotsPathat the staging dir.If both
app.cash.paparazziandio.github.takahirom.roborazziare applied to the same module, configuration fails with a clear message.Notes
results-summary.jsononce upstream populatescontext_datawithAndroidPreviewInfo). Paparazzi keeps its richer sidecar flow.@SentrySnapshot.diffThresholdremains Paparazzi-only for now.