@@ -13,13 +13,13 @@ import TSCBasic
1313import TSCUtility
1414import Foundation
1515
16+ /// A map from a module identifier to a pair consisting of a path to its .swiftmodule file and its module dependency graph.
1617public typealias ExternalDependencyArtifactMap =
1718 [ ModuleDependencyId : ( AbsolutePath , InterModuleDependencyGraph ) ]
1819
1920/// In Explicit Module Build mode, this handler is responsible for generating and providing
2021/// build jobs for all module dependencies and providing compile command options
2122/// that specify said explicit module dependencies.
22-
2323@_spi ( Testing) public struct ExplicitModuleBuildHandler {
2424 /// The module dependency graph.
2525 public var dependencyGraph : InterModuleDependencyGraph
@@ -119,13 +119,27 @@ public typealias ExternalDependencyArtifactMap =
119119 /// - Generate Job: S1
120120 ///
121121 mutating public func generateExplicitModuleDependenciesBuildJobs( ) throws -> [ Job ] {
122+ // Resolve placeholder dependencies in the dependency graph, if any.
123+ try resolvePlaceholderDependencies ( )
124+
125+ // Compute jobs for all main module dependencies
122126 var mainModuleInputs : [ TypedVirtualPath ] = [ ]
123127 var mainModuleCommandLine : [ Job . ArgTemplate ] = [ ]
124128 try resolveMainModuleDependencies ( inputs: & mainModuleInputs,
125129 commandLine: & mainModuleCommandLine)
126130 return Array ( swiftModuleBuildCache. values) + clangTargetModuleBuildCache. allJobs
127131 }
128132
133+ /// TODO: Explain
134+ mutating public func resolvePlaceholderDependencies( ) throws {
135+ print ( " Hello, World " )
136+ for moduleId in dependencyGraph. modules. keys {
137+ if case . swiftPlaceholder( let moduleName) = moduleId {
138+ print ( moduleName)
139+ }
140+ }
141+ }
142+
129143 /// Resolve all module dependencies of the main module and add them to the lists of
130144 /// inputs and command line flags.
131145 mutating public func resolveMainModuleDependencies( inputs: inout [ TypedVirtualPath ] ,
@@ -306,7 +320,7 @@ public typealias ExternalDependencyArtifactMap =
306320 clangDependencyArtifacts: inout [ ClangModuleArtifactInfo ] ,
307321 swiftDependencyArtifacts: inout [ SwiftModuleArtifactInfo ]
308322 ) throws {
309- for dependencyId in try dependencyGraph. moduleInfo ( of: moduleId) . directDependencies {
323+ for dependencyId in try dependencyGraph. moduleInfo ( of: moduleId) . directDependencies! {
310324 guard addedDependenciesSet. insert ( dependencyId) . inserted else {
311325 continue
312326 }
@@ -323,6 +337,8 @@ public typealias ExternalDependencyArtifactMap =
323337 addedDependenciesSet: & addedDependenciesSet,
324338 clangDependencyArtifacts: & clangDependencyArtifacts,
325339 swiftDependencyArtifacts: & swiftDependencyArtifacts)
340+ case . swiftPlaceholder:
341+ fatalError ( " Unresolved placeholder dependencies at planning stage. " )
326342 }
327343 }
328344 }
0 commit comments