@@ -321,7 +321,10 @@ public struct Driver {
321
321
diagnosticsEngine: DiagnosticsEngine = DiagnosticsEngine ( handlers: [ Driver . stderrDiagnosticsHandler] ) ,
322
322
fileSystem: FileSystem = localFileSystem,
323
323
executor: DriverExecutor ,
324
+ // FIXME: Duplication with externalBuildArtifacts and externalTargetModulePathMap
325
+ // is a temporary backwards-compatibility shim to help transition SwiftPM to the new API
324
326
externalBuildArtifacts: ExternalBuildArtifacts ? = nil ,
327
+ externalTargetModulePathMap: ExternalTargetModulePathMap ? = nil ,
325
328
interModuleDependencyOracle: InterModuleDependencyOracle ? = nil
326
329
) throws {
327
330
self . env = env
@@ -330,7 +333,11 @@ public struct Driver {
330
333
self . diagnosticEngine = diagnosticsEngine
331
334
self . executor = executor
332
335
333
- self . externalBuildArtifacts = externalBuildArtifacts
336
+ if let externalArtifacts = externalBuildArtifacts {
337
+ self . externalBuildArtifacts = externalArtifacts
338
+ } else if let externalTargetPaths = externalTargetModulePathMap {
339
+ self . externalBuildArtifacts = ( externalTargetPaths, [ : ] )
340
+ }
334
341
335
342
if case . subcommand = try Self . invocationRunMode ( forArgs: args) . mode {
336
343
throw Error . subcommandPassedToDriver
@@ -399,8 +406,8 @@ public struct Driver {
399
406
}
400
407
}
401
408
}
402
-
403
- do {
409
+
410
+ do {
404
411
let outputFileMap : OutputFileMap ?
405
412
// Initialize an empty output file map, which will be populated when we start creating jobs.
406
413
if let outputFileMapArg = parsedOptions. getLastArgument ( . outputFileMap) ? . asSingle {
@@ -410,12 +417,14 @@ public struct Driver {
410
417
} catch {
411
418
throw Error . unableToLoadOutputFileMap ( outputFileMapArg)
412
419
}
420
+ } else {
421
+ outputFileMap = nil
422
+ }
413
423
414
- if let workingDirectory = self . workingDirectory {
415
- self . outputFileMap = outputFileMap? . resolveRelativePaths ( relativeTo: workingDirectory)
416
- } else {
417
- self . outputFileMap = outputFileMap
418
- }
424
+ if let workingDirectory = self . workingDirectory {
425
+ self . outputFileMap = outputFileMap? . resolveRelativePaths ( relativeTo: workingDirectory)
426
+ } else {
427
+ self . outputFileMap = outputFileMap
419
428
}
420
429
}
421
430
0 commit comments