Skip to content

Commit 74e846a

Browse files
committed
[Explicit Module Builds] Add extra adapter to handle previous ModuleInfoMap-based API used by SwiftPM
1 parent 95a34f6 commit 74e846a

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,14 @@ public struct Driver {
377377
self.interModuleDependencyOracle = dependencyOracle
378378
} else {
379379
self.interModuleDependencyOracle = InterModuleDependencyOracle()
380+
381+
// This is a shim for backwards-compatibility with ModuleInfoMap-based API
382+
// used by SwiftPM
383+
if let externalArtifacts = externalBuildArtifacts {
384+
if !externalArtifacts.1.isEmpty {
385+
try self.interModuleDependencyOracle.mergeModules(from: externalArtifacts.1)
386+
}
387+
}
380388
}
381389

382390
let outputFileMap: OutputFileMap?

Sources/SwiftDriver/Explicit Module Builds/Inter Module Dependencies/CommonDependencyOperations.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
try InterModuleDependencyGraph.mergeModule(moduleId, moduleInfo, into: &modules)
1919
}
2020
}
21+
22+
// This is a backwards-compatibility shim to handle existing ModuleInfoMap-based API
23+
// used by SwiftPM
24+
func mergeModules(from moduleInfoMap: ModuleInfoMap) throws {
25+
for (moduleId, moduleInfo) in moduleInfoMap {
26+
try InterModuleDependencyGraph.mergeModule(moduleId, moduleInfo, into: &modules)
27+
}
28+
}
2129
}
2230

2331
public extension InterModuleDependencyGraph {

Sources/SwiftDriver/Explicit Module Builds/PlaceholderDependencyResolution.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import Foundation
4545
using dependencyOracle: InterModuleDependencyOracle)
4646
throws {
4747
let externalTargetModulePathMap = externalBuildArtifacts.0
48-
//let externalModuleInfoMap = externalBuildArtifacts.1
4948
let placeholderFilter : (ModuleDependencyId) -> Bool = {
5049
if case .swiftPlaceholder(_) = $0 {
5150
return true

0 commit comments

Comments
 (0)