Skip to content

Commit 1b238cf

Browse files
runningcodeclaude
andcommitted
fix(snapshot): Move dependency addition outside onVariants loop
testImplementation is a global configuration, not per-variant. Move the ComposablePreviewScanner dependency addition to afterEvaluate (gated on enabled) so it runs once instead of once per variant. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent efb2185 commit 1b238cf

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

plugin-build/src/main/kotlin/io/sentry/android/gradle/SentryPlugin.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,18 @@ constructor(private val buildEvents: BuildEventListenerRegistryInternal) : Plugi
7373
project.pluginManager.withPlugin("app.cash.paparazzi") {
7474
val android = project.extensions.getByType(BaseExtension::class.java)
7575

76+
project.afterEvaluate {
77+
if (extension.snapshots.enabled.get()) {
78+
project.dependencies.add(
79+
"testImplementation",
80+
"io.github.sergio-sastre.ComposablePreviewScanner:android:0.8.1",
81+
)
82+
}
83+
}
84+
7685
androidComponentsExt.onVariants { variant ->
7786
if (!extension.snapshots.enabled.get()) return@onVariants
7887

79-
project.dependencies.add(
80-
"testImplementation",
81-
"io.github.sergio-sastre.ComposablePreviewScanner:android:0.8.1",
82-
)
83-
8488
val generateTask =
8589
GenerateSnapshotTestsTask.register(project, extension.snapshots, android, variant)
8690
if (AgpVersions.isAGP90(AgpVersions.CURRENT)) {

0 commit comments

Comments
 (0)