Skip to content

fix(android): Declare test-snapshots as task output for cache compatibility#5396

Open
runningcode wants to merge 2 commits intomainfrom
no/fix-screenshot-snapshot-cache
Open

fix(android): Declare test-snapshots as task output for cache compatibility#5396
runningcode wants to merge 2 commits intomainfrom
no/fix-screenshot-snapshot-cache

Conversation

@runningcode
Copy link
Copy Markdown
Contributor

@runningcode runningcode commented May 8, 2026

Some PRs are failing when the gradle task that generates the snapshots comes from the cache because the snapshots are not pulled from the cache. This adjust it so that the snapshots are stored in the cache so they are successfully retrieved and then uploaded to sentry.

Summary

  • The screenshot snapshot PNGs written by ScreenshotEventProcessorTest are not declared as outputs of testDebugUnitTest. When the task result comes from the Gradle remote cache, the test code never runs and the build/test-snapshots/ directory is never created, so sentry-cli finds an empty folder and uploads nothing.
  • Declares build/test-snapshots/ as a task output so Gradle caches and restores the snapshots on cache hits.

#skip-changelog

🤖 Generated with Claude Code

Comment thread sentry-android-core/build.gradle.kts Outdated
…bility

The screenshot snapshot PNGs written by ScreenshotEventProcessorTest are
not declared as outputs of testDebugUnitTest. When the task result comes
from the Gradle remote cache, the test code never runs and the directory
is never created, so sentry-cli finds an empty folder and uploads nothing.

Declaring the directory as a task output ensures Gradle caches and
restores the snapshots on cache hits.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@runningcode runningcode force-pushed the no/fix-screenshot-snapshot-cache branch from 2680da7 to 8020d35 Compare May 8, 2026 13:24
@sentry
Copy link
Copy Markdown

sentry Bot commented May 8, 2026

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.41.0 (1) release

⚙️ sentry-android Build Distribution Settings

@runningcode runningcode closed this May 8, 2026
@runningcode runningcode reopened this May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 301.68 ms 343.79 ms 42.11 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5865051 319.74 ms 365.60 ms 45.86 ms
0220a5c 452.20 ms 479.33 ms 27.12 ms
2124a46 319.19 ms 415.04 ms 95.85 ms
2195398 322.52 ms 361.91 ms 39.39 ms
bbc35bb 298.53 ms 372.17 ms 73.64 ms
d364ace 382.77 ms 443.21 ms 60.44 ms
d15471f 379.40 ms 470.76 ms 91.36 ms
9139b91 351.35 ms 355.63 ms 4.28 ms
fc5ccaf 322.49 ms 405.25 ms 82.76 ms
52feca7 314.77 ms 378.67 ms 63.90 ms

App size

Revision Plain With Sentry Diff
5865051 0 B 0 B 0 B
0220a5c 0 B 0 B 0 B
2124a46 1.58 MiB 2.12 MiB 551.51 KiB
2195398 0 B 0 B 0 B
bbc35bb 1.58 MiB 2.12 MiB 553.01 KiB
d364ace 1.58 MiB 2.11 MiB 539.75 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
9139b91 1.58 MiB 2.13 MiB 559.52 KiB
fc5ccaf 1.58 MiB 2.13 MiB 557.54 KiB
52feca7 0 B 0 B 0 B


// Snapshot PNGs are written by ScreenshotEventProcessorTest at runtime but must be declared as
// outputs so Gradle's build cache restores them on cache hits (otherwise the CLI upload step
// finds an empty directory).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🥇

@runningcode runningcode enabled auto-merge (squash) May 8, 2026 14:44
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