in Sources/XCRemoteCache/Commands/Swiftc/SwiftcProductsGenerator.swift [69:97]
func generateFrom(
artifactSwiftModuleFiles sourceAtifactSwiftModuleFiles: [SwiftmoduleFileExtension: URL],
artifactSwiftModuleObjCFile: URL
) throws -> SwiftcProductsGeneratorOutput {
// Move cached -Swift.h file to the expected location
try diskCopier.copy(file: artifactSwiftModuleObjCFile, destination: objcHeaderOutput)
for (ext, url) in sourceAtifactSwiftModuleFiles {
let dest = destinationSwiftmodulePaths[ext]
guard let destination = dest else {
throw DiskSwiftcProductsGeneratorError.unknownSwiftmoduleFile
}
do {
// Move cached .swiftmodule to the expected location
try diskCopier.copy(file: url, destination: destination)
} catch {
if case .required = SwiftmoduleFileExtension.SwiftmoduleExtensions[ext] {
throw error
} else {
infoLog("Optional .\(ext) file not found in the artifact at: \(destination.path)")
}
}
}
// Build parent dir of the .swiftmodule file that contains a module
return SwiftcProductsGeneratorOutput(
swiftmoduleDir: modulePathOutput.deletingLastPathComponent(),
objcHeaderFile: objcHeaderOutput
)
}