Improve display of required files

This commit is contained in:
Christoph Hagen 2022-09-01 10:55:42 +02:00
parent 4dc56e5dfe
commit 6a2d63462e

View File

@ -375,6 +375,7 @@ final class FileSystem {
}
func copyRequiredFiles() {
var copiedFiles = Set<String>()
for file in requiredFiles {
let cleanPath = cleanRelativeURL(file)
let sourceUrl = input.appendingPathComponent(cleanPath)
@ -392,7 +393,9 @@ final class FileSystem {
log.add(error: "Failed to read data at \(sourceUrl.path)", source: source, error: error)
continue
}
writeIfChanged(data, to: destinationUrl)
if writeIfChanged(data, to: destinationUrl) {
copiedFiles.insert(file)
}
}
for (file, source) in expectedFiles {
guard !externalFiles.contains(file) else {
@ -404,6 +407,14 @@ final class FileSystem {
log.add(error: "Missing \(cleanPath)", source: source)
}
}
guard !copiedFiles.isEmpty else {
print("No required files copied")
return
}
print("\(copiedFiles.count) required files copied:")
for file in copiedFiles.sorted() {
print(" " + file)
}
}
private func cleanRelativeURL(_ raw: String) -> String {