making use of the lazy task registration to allow only applying the paparazzi plugin when needed
This commit is contained in:
parent
dc0599f966
commit
c0baa2e8fd
15
build.gradle
15
build.gradle
@ -297,21 +297,24 @@ dependencyAnalysis {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task recordScreenshots(type: GradleBuild) {
|
tasks.register("recordScreenshots", GradleBuild) {
|
||||||
startParameter.projectProperties.screenshot = ""
|
startParameter.projectProperties.screenshot = ""
|
||||||
tasks = [':vector:recordPaparazziGplayDebug']
|
tasks = [':vector:recordPaparazziDebug']
|
||||||
}
|
}
|
||||||
|
|
||||||
task verifyScreenshots(type: GradleBuild) {
|
tasks.register("verifyScreenshots", GradleBuild) {
|
||||||
startParameter.projectProperties.screenshot = ""
|
startParameter.projectProperties.screenshot = ""
|
||||||
tasks = [':vector:verifyPaparazziGplayDebug']
|
tasks = [':vector:verifyPaparazziDebug']
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.initScreenshotTests = { project ->
|
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 {
|
project.android.testOptions.unitTests.all {
|
||||||
def screenshotTestCapture = "**/*ScreenshotTest*"
|
def screenshotTestCapture = "**/*ScreenshotTest*"
|
||||||
if (project.hasProperty("screenshot")) {
|
if (hasScreenshots) {
|
||||||
include screenshotTestCapture
|
include screenshotTestCapture
|
||||||
} else {
|
} else {
|
||||||
exclude screenshotTestCapture
|
exclude screenshotTestCapture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user