making use of the lazy task registration to allow only applying the paparazzi plugin when needed

This commit is contained in:
Adam Brown 2022-09-16 16:15:10 +01:00
parent dc0599f966
commit c0baa2e8fd
1 changed files with 9 additions and 6 deletions

View File

@ -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 ->
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