[Gradle] Add debug logging into TaskOutputsBackup
This commit is contained in:
committed by
Space Team
parent
87db928b2d
commit
82a2cac4d6
+8
-2
@@ -42,14 +42,18 @@ internal class TaskOutputsBackup(
|
|||||||
// property. To avoid snapshot sync collisions, each snapshot output directory has also 'index' as prefix.
|
// property. To avoid snapshot sync collisions, each snapshot output directory has also 'index' as prefix.
|
||||||
outputsToRestore.toSortedSet().forEachIndexed { index, outputPath ->
|
outputsToRestore.toSortedSet().forEachIndexed { index, outputPath ->
|
||||||
if (outputPath.isDirectory && !outputPath.isEmptyDirectory) {
|
if (outputPath.isDirectory && !outputPath.isEmptyDirectory) {
|
||||||
|
val snapshotFile = File(snapshotsDir.get().asFile, index.asSnapshotArchiveName)
|
||||||
|
logger.debug("Packing $outputPath as $snapshotFile to make a backup")
|
||||||
compressDirectoryToZip(
|
compressDirectoryToZip(
|
||||||
File(snapshotsDir.get().asFile, index.asSnapshotArchiveName),
|
snapshotFile,
|
||||||
outputPath
|
outputPath
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
val snapshotFile = snapshotsDir.map { it.file(index.asSnapshotDirectoryName).asFile }
|
||||||
|
logger.debug("Copying $outputPath as $snapshotFile to make a backup")
|
||||||
fileSystemOperations.copy { spec ->
|
fileSystemOperations.copy { spec ->
|
||||||
spec.from(outputPath)
|
spec.from(outputPath)
|
||||||
spec.into(snapshotsDir.map { it.file(index.asSnapshotDirectoryName).asFile })
|
spec.into(snapshotFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,12 +67,14 @@ internal class TaskOutputsBackup(
|
|||||||
outputsToRestore.toSortedSet().forEachIndexed { index, outputPath ->
|
outputsToRestore.toSortedSet().forEachIndexed { index, outputPath ->
|
||||||
val snapshotDir = snapshotsDir.get().file(index.asSnapshotDirectoryName).asFile
|
val snapshotDir = snapshotsDir.get().file(index.asSnapshotDirectoryName).asFile
|
||||||
if (snapshotDir.isDirectory) {
|
if (snapshotDir.isDirectory) {
|
||||||
|
logger.debug("Copying files from $snapshotDir into ${outputPath.parentFile} to restore from backup")
|
||||||
fileSystemOperations.copy { spec ->
|
fileSystemOperations.copy { spec ->
|
||||||
spec.from(snapshotDir)
|
spec.from(snapshotDir)
|
||||||
spec.into(outputPath.parentFile)
|
spec.into(outputPath.parentFile)
|
||||||
}
|
}
|
||||||
} 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")
|
||||||
if (!snapshotArchive.exists()) {
|
if (!snapshotArchive.exists()) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user