diff --git a/Sources/XCRemoteCache/Commands/Swiftc/Swiftc.swift b/Sources/XCRemoteCache/Commands/Swiftc/Swiftc.swift index fdd89e3..231e3cc 100644 --- a/Sources/XCRemoteCache/Commands/Swiftc/Swiftc.swift +++ b/Sources/XCRemoteCache/Commands/Swiftc/Swiftc.swift @@ -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) diff --git a/Sources/XCRemoteCache/Commands/Swiftc/SwiftcFilemapInputEditor.swift b/Sources/XCRemoteCache/Commands/Swiftc/SwiftcFilemapInputEditor.swift index 0617e80..7a803b7 100644 --- a/Sources/XCRemoteCache/Commands/Swiftc/SwiftcFilemapInputEditor.swift +++ b/Sources/XCRemoteCache/Commands/Swiftc/SwiftcFilemapInputEditor.swift @@ -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 } }