From 8020d35b312d15c1b2517800f47c46de68b70f80 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 8 May 2026 15:16:14 +0200 Subject: [PATCH 1/2] 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) --- sentry-android-core/build.gradle.kts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index f61cec8926..5ff3499194 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -70,6 +70,13 @@ tasks.withType().configureEach { } } +// 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). +tasks.matching { it.name == "testDebugUnitTest" || it.name == "testReleaseUnitTest" }.configureEach { + outputs.dir(layout.buildDirectory.dir("test-snapshots")) +} + dependencies { api(projects.sentry) compileOnly(libs.jetbrains.annotations) From 13b9b0c8fb60687aa4e30f2e9eb785c9bbf5ee12 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Fri, 8 May 2026 13:28:03 +0000 Subject: [PATCH 2/2] Format code --- sentry-android-core/build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index 5ff3499194..abcca4f883 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -73,9 +73,9 @@ tasks.withType().configureEach { // 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). -tasks.matching { it.name == "testDebugUnitTest" || it.name == "testReleaseUnitTest" }.configureEach { - outputs.dir(layout.buildDirectory.dir("test-snapshots")) -} +tasks + .matching { it.name == "testDebugUnitTest" || it.name == "testReleaseUnitTest" } + .configureEach { outputs.dir(layout.buildDirectory.dir("test-snapshots")) } dependencies { api(projects.sentry)