Skip to content

Commit bbd2ab8

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

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
@@ -389,6 +389,14 @@ public struct Driver {
389389
self.interModuleDependencyOracle = dependencyOracle
390390
} else {
391391
self.interModuleDependencyOracle = InterModuleDependencyOracle()
392+
393+
// This is a shim for backwards-compatibility with ModuleInfoMap-based API
394+
// used by SwiftPM
395+
if let externalArtifacts = externalBuildArtifacts {
396+
if !externalArtifacts.1.isEmpty {
397+
try self.interModuleDependencyOracle.mergeModules(from: externalArtifacts.1)
398+
}
399+
}
392400
}
393401

394402
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)