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() { func copyRequiredFiles() {
var copiedFiles = Set<String>()
for file in requiredFiles { for file in requiredFiles {
let cleanPath = cleanRelativeURL(file) let cleanPath = cleanRelativeURL(file)
let sourceUrl = input.appendingPathComponent(cleanPath) 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) log.add(error: "Failed to read data at \(sourceUrl.path)", source: source, error: error)
continue continue
} }
writeIfChanged(data, to: destinationUrl) if writeIfChanged(data, to: destinationUrl) {
copiedFiles.insert(file)
}
} }
for (file, source) in expectedFiles { for (file, source) in expectedFiles {
guard !externalFiles.contains(file) else { guard !externalFiles.contains(file) else {
@ -404,6 +407,14 @@ final class FileSystem {
log.add(error: "Missing \(cleanPath)", source: source) 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 { private func cleanRelativeURL(_ raw: String) -> String {