From acfc5d50d560f55a57f507bfa58b938035ea906e Mon Sep 17 00:00:00 2001 From: takahirom Date: Mon, 4 Nov 2024 17:14:52 +0900 Subject: [PATCH] Fix order of copy --- .../roborazzi/RoborazziGradleProjectTest.kt | 2 +- .../takahirom/roborazzi/RoborazziPlugin.kt | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include-build/roborazzi-gradle-plugin/src/integrationTest/java/io/github/takahirom/roborazzi/RoborazziGradleProjectTest.kt b/include-build/roborazzi-gradle-plugin/src/integrationTest/java/io/github/takahirom/roborazzi/RoborazziGradleProjectTest.kt index 4c978573..01a7200d 100644 --- a/include-build/roborazzi-gradle-plugin/src/integrationTest/java/io/github/takahirom/roborazzi/RoborazziGradleProjectTest.kt +++ b/include-build/roborazzi-gradle-plugin/src/integrationTest/java/io/github/takahirom/roborazzi/RoborazziGradleProjectTest.kt @@ -446,7 +446,7 @@ class RoborazziGradleProjectTest { } @Test - fun ifWeUseDeleteOldScreenshotsTheScreenshotsShouldNotExitOldScreenshot() { + fun ifWeUseDeleteOldScreenshotsTheOldScreenshotsShouldNotExit() { RoborazziGradleRootProject(testProjectDir).appModule.apply { recordWithDeleteOldScreenshots() removeTests() diff --git a/include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/RoborazziPlugin.kt b/include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/RoborazziPlugin.kt index 52001f5b..f5d2957d 100644 --- a/include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/RoborazziPlugin.kt +++ b/include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/RoborazziPlugin.kt @@ -396,17 +396,6 @@ abstract class RoborazziPlugin : Plugin { // Run only root suite return } - // Copy all files from outputDir to intermediateDir - // so that we can use Gradle's output caching - test.infoln("Roborazzi: test.doLast Copy files from ${outputDir.get()} to ${intermediateDir.get()}") - // outputDir.get().asFileTree.forEach { - // println("Copy file ${finalizeTask.absolutePath} to ${intermediateDir.get()}") - // } - outputDir.get().asFile.mkdirs() - outputDir.get().asFile.copyRecursively( - target = intermediateDir.get().asFile, - overwrite = true - ) val results: List = resultDirFileTree.get().mapNotNull { if (it.name.endsWith(".json")) { @@ -432,6 +421,18 @@ abstract class RoborazziPlugin : Plugin { outputDir = outputDir, roborazziResults = roborazziResults, ) + + // Copy all files from outputDir to intermediateDir + // so that we can use Gradle's output caching + test.infoln("Roborazzi: test.doLast Copy files from ${outputDir.get()} to ${intermediateDir.get()}") + // outputDir.get().asFileTree.forEach { + // println("Copy file ${finalizeTask.absolutePath} to ${intermediateDir.get()}") + // } + outputDir.get().asFile.mkdirs() + outputDir.get().asFile.copyRecursively( + target = intermediateDir.get().asFile, + overwrite = true + ) } override fun beforeTest(testDescriptor: TestDescriptor?) {