@@ -41,10 +41,11 @@ import Foundation
4141 // which the driver will then resolve using B's full dependency graph provided by the client.
4242
4343 /// Resolve all placeholder dependencies using external dependency information provided by the client
44- mutating func resolvePlaceholderDependencies( using externalBuildArtifacts: ExternalBuildArtifacts )
44+ mutating func resolvePlaceholderDependencies( for externalBuildArtifacts: ExternalBuildArtifacts ,
45+ using dependencyOracle: InterModuleDependencyOracle )
4546 throws {
4647 let externalTargetModulePathMap = externalBuildArtifacts. 0
47- let externalModuleInfoMap = externalBuildArtifacts. 1
48+ // let externalModuleInfoMap = externalBuildArtifacts.1
4849 let placeholderFilter : ( ModuleDependencyId ) -> Bool = {
4950 if case . swiftPlaceholder( _) = $0 {
5051 return true
@@ -61,7 +62,7 @@ import Foundation
6162 }
6263 try resolveTargetPlaceholder ( placeholderId: moduleId,
6364 placeholderPath: placeholderModulePath,
64- externalModuleInfoMap : externalModuleInfoMap )
65+ dependencyOracle : dependencyOracle )
6566 }
6667
6768 // Process remaining placeholders until there are none left
@@ -70,17 +71,17 @@ import Foundation
7071 let moduleId = placeholderModules. first!
7172 let swiftModuleId = ModuleDependencyId . swift ( moduleId. moduleName)
7273
73- guard externalModuleInfoMap [ swiftModuleId] != nil else {
74+ guard dependencyOracle . getModuleInfo ( of : swiftModuleId) != nil else {
7475 throw Driver . Error. missingExternalDependency ( moduleId. moduleName)
7576 }
76- let moduleInfo = externalModuleInfoMap [ swiftModuleId] !
77+ let moduleInfo = dependencyOracle . getModuleInfo ( of : swiftModuleId) !
7778
7879 // Insert the resolved module, replacing the placeholder.
7980 try Self . mergeModule ( swiftModuleId, moduleInfo, into: & modules)
8081
8182 // Traverse and add all of this external module's dependencies to the current graph.
8283 try resolvePlaceholderModuleDependencies ( moduleId: swiftModuleId,
83- externalModuleInfoMap : externalModuleInfoMap )
84+ dependencyOracle : dependencyOracle )
8485
8586 // Update the set of remaining placeholders to resolve
8687 placeholderModules = modules. keys. filter ( placeholderFilter)
@@ -92,7 +93,7 @@ fileprivate extension InterModuleDependencyGraph {
9293 /// Resolve a placeholder dependency that is an external target.
9394 mutating func resolveTargetPlaceholder( placeholderId: ModuleDependencyId ,
9495 placeholderPath: AbsolutePath ,
95- externalModuleInfoMap : ModuleInfoMap )
96+ dependencyOracle : InterModuleDependencyOracle )
9697 throws {
9798 // For this placeholder dependency, generate a new module info containing only the pre-compiled
9899 // module path, and insert it into the current module's dependency graph,
@@ -113,15 +114,15 @@ fileprivate extension InterModuleDependencyGraph {
113114 let swiftPrebuiltModuleId = ModuleDependencyId . swiftPrebuiltExternal ( placeholderId. moduleName)
114115
115116 let externalModuleId : ModuleDependencyId
116- if externalModuleInfoMap [ swiftModuleId] != nil {
117+ if dependencyOracle . getModuleInfo ( of : swiftModuleId) != nil {
117118 externalModuleId = swiftModuleId
118- } else if externalModuleInfoMap [ swiftPrebuiltModuleId] != nil {
119+ } else if dependencyOracle . getModuleInfo ( of : swiftPrebuiltModuleId) != nil {
119120 externalModuleId = swiftPrebuiltModuleId
120121 } else {
121122 throw Driver . Error. missingExternalDependency ( placeholderId. moduleName)
122123 }
123124
124- let externalModuleInfo = externalModuleInfoMap [ externalModuleId] !
125+ let externalModuleInfo = dependencyOracle . getModuleInfo ( of : externalModuleId) !
125126 let newExternalModuleDetails =
126127 SwiftPrebuiltExternalModuleDetails ( compiledModulePath: placeholderPath. description)
127128 let newInfo = ModuleInfo ( modulePath: placeholderPath. description,
@@ -134,13 +135,14 @@ fileprivate extension InterModuleDependencyGraph {
134135
135136 // Traverse and add all of this external target's dependencies to the current graph.
136137 try resolvePlaceholderModuleDependencies ( moduleId: externalModuleId,
137- externalModuleInfoMap : externalModuleInfoMap )
138+ dependencyOracle : dependencyOracle )
138139 }
139140
140141 /// Resolve all dependencies of a placeholder module (direct and transitive), but merging them into the current graph.
141142 mutating func resolvePlaceholderModuleDependencies( moduleId: ModuleDependencyId ,
142- externalModuleInfoMap: ModuleInfoMap ) throws {
143- guard let resolvingModuleInfo = externalModuleInfoMap [ moduleId] else {
143+ dependencyOracle: InterModuleDependencyOracle )
144+ throws {
145+ guard let resolvingModuleInfo = dependencyOracle. getModuleInfo ( of: moduleId) else {
144146 throw Driver . Error. missingExternalDependency ( moduleId. moduleName)
145147 }
146148
@@ -151,7 +153,7 @@ fileprivate extension InterModuleDependencyGraph {
151153 while let currentId = toVisit [ currentIndex... ] . first {
152154 currentIndex += 1
153155 visited. insert ( currentId)
154- guard let currentInfo = externalModuleInfoMap [ currentId] else {
156+ guard let currentInfo = dependencyOracle . getModuleInfo ( of : currentId) else {
155157 throw Driver . Error. missingExternalDependency ( currentId. moduleName)
156158 }
157159
0 commit comments