Support no object for Swift output map

This commit is contained in:
Bartosz Polaczyk
2021-10-18 11:47:18 +02:00
parent 764219fa7d
commit 999dabed84
2 changed files with 9 additions and 6 deletions
@@ -166,9 +166,11 @@ class Swiftc: SwiftcProtocol {
// Save individual .d and touch .o for each .swift file
for compilation in allCompilations.files {
// Touching .o is required to invalidate already existing .a or linked library
let touch = touchFactory(compilation.object, fileManager)
try touch.touch()
if let object = compilation.object {
// Touching .o is required to invalidate already existing .a or linked library
let touch = touchFactory(object, fileManager)
try touch.touch()
}
if let individualDeps = compilation.dependencies {
// swiftc product should be invalidated if any of dependencies file has changed
try cachedDependenciesWriterFactory.generate(output: individualDeps)
@@ -52,7 +52,8 @@ struct SwiftFileCompilationInfo: Encodable, Equatable {
let file: URL
// not present for WMO builds
let dependencies: URL?
let object: URL
// not present for 'indexbuild' builds
let object: URL?
// not present for WMO builds
let swiftDependencies: URL?
}
@@ -129,14 +130,14 @@ extension SwiftFileCompilationInfo {
}
file = URL(fileURLWithPath: name)
dependencies = dict.readURL(key: "dependencies")
object = try dict.readURL(key: "object")
object = dict.readURL(key: "object")
swiftDependencies = dict.readURL(key: "swift-dependencies")
}
func dump() -> [String: String] {
return [
"dependencies": dependencies?.path,
"object": object.path,
"object": object?.path,
"swift-dependencies": swiftDependencies?.path,
].compactMapValues { $0 }
}