Skip to content

Commit ae06e70

Browse files
runningcodeclaudegetsentry-bot
authored
fix(android): Declare test-snapshots as task output for cache compatibility (#5396)
* fix(android): Declare test-snapshots as task output for cache compatibility 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> * Format code --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
1 parent 648fbf7 commit ae06e70

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

sentry-android-core/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ tasks.withType<JavaCompile>().configureEach {
7070
}
7171
}
7272

73+
// Snapshot PNGs are written by ScreenshotEventProcessorTest at runtime but must be declared as
74+
// outputs so Gradle's build cache restores them on cache hits (otherwise the CLI upload step
75+
// finds an empty directory).
76+
tasks
77+
.matching { it.name == "testDebugUnitTest" || it.name == "testReleaseUnitTest" }
78+
.configureEach { outputs.dir(layout.buildDirectory.dir("test-snapshots")) }
79+
7380
dependencies {
7481
api(projects.sentry)
7582
compileOnly(libs.jetbrains.annotations)

0 commit comments

Comments
 (0)