Skip to content

Commit bc5b155

Browse files
committed
[Explicit Module Builds] Add another shim for backwards-compatibility with API currently used by SwiftPM to communicate external build artifacts
1 parent babe1d8 commit bc5b155

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ public struct Driver {
320320
diagnosticsEngine: DiagnosticsEngine = DiagnosticsEngine(handlers: [Driver.stderrDiagnosticsHandler]),
321321
fileSystem: FileSystem = localFileSystem,
322322
executor: DriverExecutor,
323+
// FIXME: Duplication with externalBuildArtifacts and externalTargetModulePathMap
324+
// is a temporary backwards-compatibility shim to help transition SwiftPM to the new API
323325
externalBuildArtifacts: ExternalBuildArtifacts? = nil,
326+
externalTargetModulePathMap: ExternalTargetModulePathMap? = nil,
324327
interModuleDependencyOracle: InterModuleDependencyOracle? = nil
325328
) throws {
326329
self.env = env
@@ -329,7 +332,11 @@ public struct Driver {
329332
self.diagnosticEngine = diagnosticsEngine
330333
self.executor = executor
331334

332-
self.externalBuildArtifacts = externalBuildArtifacts
335+
if let externalArtifacts = externalBuildArtifacts {
336+
self.externalBuildArtifacts = externalArtifacts
337+
} else if let externalTargetPaths = externalTargetModulePathMap {
338+
self.externalBuildArtifacts = (externalTargetPaths, [:])
339+
}
333340

334341
if case .subcommand = try Self.invocationRunMode(forArgs: args).mode {
335342
throw Error.subcommandPassedToDriver

Sources/SwiftDriver/Explicit Module Builds/ExplicitDependencyBuildPlanner.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import Foundation
1515

1616
/// A map from a module identifier to a path to its .swiftmodule file.
1717
public typealias ExternalTargetModulePathMap = [ModuleDependencyId: AbsolutePath]
18+
19+
// FIXME: ExternalBuildArtifacts is a temporary backwards-compatibility shim
20+
// to help transition SwiftPM to the new API.
1821
/// A tuple all external artifacts a build system may pass in as input to the explicit build of the current module
1922
/// Consists of a map of externally-built targets, and a map of all previously discovered/scanned modules.
2023
public typealias ExternalBuildArtifacts = (ExternalTargetModulePathMap, ModuleInfoMap)

0 commit comments

Comments
 (0)