[Gradle] Ignore non-existent directories in compile task outputs backup
#KT-56047 Fixed
This commit is contained in:
committed by
Space Team
parent
3cc69f691e
commit
35e39e9e10
+8
@@ -48,6 +48,9 @@ internal class TaskOutputsBackup(
|
|||||||
snapshotFile,
|
snapshotFile,
|
||||||
outputPath
|
outputPath
|
||||||
)
|
)
|
||||||
|
} else if (!outputPath.exists()) {
|
||||||
|
logger.debug("Ignoring $outputPath in making a backup as it does not exist")
|
||||||
|
File(snapshotsDir.get().asFile, index.asNotExistsMarkerFile).createNewFile()
|
||||||
} else {
|
} else {
|
||||||
val snapshotFile = snapshotsDir.map { it.file(index.asSnapshotDirectoryName).asFile }
|
val snapshotFile = snapshotsDir.map { it.file(index.asSnapshotDirectoryName).asFile }
|
||||||
logger.debug("Copying $outputPath as $snapshotFile to make a backup")
|
logger.debug("Copying $outputPath as $snapshotFile to make a backup")
|
||||||
@@ -72,6 +75,8 @@ internal class TaskOutputsBackup(
|
|||||||
spec.from(snapshotDir)
|
spec.from(snapshotDir)
|
||||||
spec.into(outputPath.parentFile)
|
spec.into(outputPath.parentFile)
|
||||||
}
|
}
|
||||||
|
} else if (snapshotsDir.get().file(index.asNotExistsMarkerFile).asFile.exists()) {
|
||||||
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
val snapshotArchive = snapshotsDir.get().file(index.asSnapshotArchiveName).asFile
|
val snapshotArchive = snapshotsDir.get().file(index.asSnapshotArchiveName).asFile
|
||||||
logger.debug("Unpacking $snapshotArchive into $outputPath to restore from backup")
|
logger.debug("Unpacking $snapshotArchive into $outputPath to restore from backup")
|
||||||
@@ -153,6 +158,9 @@ internal class TaskOutputsBackup(
|
|||||||
private val Int.asSnapshotArchiveName: String
|
private val Int.asSnapshotArchiveName: String
|
||||||
get() = "$this.zip"
|
get() = "$this.zip"
|
||||||
|
|
||||||
|
private val Int.asNotExistsMarkerFile: String
|
||||||
|
get() = "$this.not-exists"
|
||||||
|
|
||||||
private val Int.asSnapshotDirectoryName: String
|
private val Int.asSnapshotDirectoryName: String
|
||||||
get() = "$this"
|
get() = "$this"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user