From c0baa2e8fd7d5b1673d44c73f83db386bd716e5b Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 16 Sep 2022 16:15:10 +0100 Subject: [PATCH] making use of the lazy task registration to allow only applying the paparazzi plugin when needed --- build.gradle | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 0e87ab51be..7b67c89502 100644 --- a/build.gradle +++ b/build.gradle @@ -297,21 +297,24 @@ dependencyAnalysis { } } -task recordScreenshots(type: GradleBuild) { +tasks.register("recordScreenshots", GradleBuild) { startParameter.projectProperties.screenshot = "" - tasks = [':vector:recordPaparazziGplayDebug'] + tasks = [':vector:recordPaparazziDebug'] } -task verifyScreenshots(type: GradleBuild) { +tasks.register("verifyScreenshots", GradleBuild) { startParameter.projectProperties.screenshot = "" - tasks = [':vector:verifyPaparazziGplayDebug'] + tasks = [':vector:verifyPaparazziDebug'] } ext.initScreenshotTests = { project -> - project.apply plugin: 'app.cash.paparazzi' + def hasScreenshots = project.hasProperty("screenshot") + if (hasScreenshots) { + project.apply plugin: 'app.cash.paparazzi' + } project.android.testOptions.unitTests.all { def screenshotTestCapture = "**/*ScreenshotTest*" - if (project.hasProperty("screenshot")) { + if (hasScreenshots) { include screenshotTestCapture } else { exclude screenshotTestCapture