[Gradle] Fix creating empty directory marker for backups

The problem was occurring in the case the first directory for backup does not exist
#KT-61273 Fixed
This commit is contained in:
Alexander.Likhachev
2023-08-24 01:40:19 +02:00
committed by Space Team
parent 9b9039d512
commit 693b4cf308
2 changed files with 3 additions and 2 deletions
@@ -769,7 +769,6 @@ class KotlinGradleIT : KGPBaseTest() {
}
}
@Disabled
@DisplayName("KT-61273: task output backup works correctly if the first output is absent")
@GradleTest
fun taskOutputBackupWorksIfFirstOutputIsAbsent(gradleVersion: GradleVersion) {
@@ -50,7 +50,9 @@ internal class TaskOutputsBackup(
)
} else if (!outputPath.exists()) {
logger.debug("Ignoring $outputPath in making a backup as it does not exist")
File(snapshotsDir.get().asFile, index.asNotExistsMarkerFile).createNewFile()
val markerFile = File(snapshotsDir.get().asFile, index.asNotExistsMarkerFile)
markerFile.parentFile.mkdirs()
markerFile.createNewFile()
} else {
val snapshotFile = snapshotsDir.map { it.file(index.asSnapshotDirectoryName).asFile }
logger.debug("Copying $outputPath as $snapshotFile to make a backup")