@@ -102,26 +102,18 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
102
102
guard let mainModuleDependencies = reachabilityMap [ mainModuleId] else {
103
103
fatalError ( " Expected reachability information for the main module. " )
104
104
}
105
- // A collection of PCM Args that Clang modules must be built against
106
- var clangPCMSetMap : [ ModuleDependencyId : Set < [ String ] > ] = [ : ]
107
105
let swiftDependenciesJobs =
108
- try generateSwiftDependenciesBuildJobs ( for: mainModuleDependencies,
109
- clangPCMSetMap: & clangPCMSetMap)
110
- // Also take into account the PCMArgs of the main module
111
- try updateClangPCMArgSetMap ( for: mainModuleId, clangPCMSetMap: & clangPCMSetMap)
106
+ try generateSwiftDependenciesBuildJobs ( for: mainModuleDependencies)
112
107
113
108
// Generate build jobs for all Clang modules
114
109
let clangDependenciesJobs =
115
- try generateClangDependenciesBuildJobs ( for: mainModuleDependencies,
116
- using: clangPCMSetMap)
110
+ try generateClangDependenciesBuildJobs ( for: mainModuleDependencies)
117
111
118
112
return swiftDependenciesJobs + clangDependenciesJobs
119
113
}
120
114
121
115
/// Generate a build job for each Swift module in the set of supplied `dependencies`
122
- private mutating func generateSwiftDependenciesBuildJobs( for dependencies: Set < ModuleDependencyId > ,
123
- clangPCMSetMap:
124
- inout [ ModuleDependencyId : Set < [ String ] > ] )
116
+ private mutating func generateSwiftDependenciesBuildJobs( for dependencies: Set < ModuleDependencyId > )
125
117
throws -> [ Job ] {
126
118
var jobs : [ Job ] = [ ]
127
119
let swiftDependencies = dependencies. filter {
@@ -143,13 +135,10 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
143
135
moduleDetails. commandLine? . forEach { commandLine. appendFlags ( $0) }
144
136
145
137
// Resolve all dependency module inputs for this Swift module
146
- try resolveExplicitModuleDependencies ( moduleId: moduleId, pcmArgs : pcmArgs ,
138
+ try resolveExplicitModuleDependencies ( moduleId: moduleId,
147
139
inputs: & inputs,
148
140
commandLine: & commandLine)
149
141
150
- // Update the clangPCMSetMap for each Clang dependency of this module
151
- try updateClangPCMArgSetMap ( for: moduleId, clangPCMSetMap: & clangPCMSetMap)
152
-
153
142
// Build the .swiftinterfaces file using a list of command line options specified in the
154
143
// `details` field.
155
144
guard let moduleInterfacePath = moduleDetails. moduleInterfacePath else {
@@ -182,9 +171,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
182
171
183
172
/// Generate a build job for each Clang module in the set of supplied `dependencies`. Once per each required
184
173
/// PCMArgSet as queried from the supplied `clangPCMSetMap`
185
- private mutating func generateClangDependenciesBuildJobs( for dependencies: Set < ModuleDependencyId > ,
186
- using clangPCMSetMap:
187
- [ ModuleDependencyId : Set < [ String ] > ] )
174
+ private mutating func generateClangDependenciesBuildJobs( for dependencies: Set < ModuleDependencyId > )
188
175
throws -> [ Job ] {
189
176
var jobs : [ Job ] = [ ]
190
177
let clangDependencies = dependencies. filter {
@@ -194,61 +181,52 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
194
181
return false
195
182
}
196
183
for moduleId in clangDependencies {
197
- guard let pcmArgSet = clangPCMSetMap [ moduleId] else {
198
- fatalError ( " Expected PCM Argument Set for module: \( moduleId. moduleName) " )
199
- }
200
184
let moduleInfo = try dependencyGraph. moduleInfo ( of: moduleId)
201
185
// Generate a distinct job for each required set of PCM Arguments for this module
202
- for pcmArgs in pcmArgSet {
203
- var inputs : [ TypedVirtualPath ] = [ ]
204
- var outputs : [ TypedVirtualPath ] = [ ]
205
- var commandLine : [ Job . ArgTemplate ] = [ ]
206
-
207
- // First, take the command line options provided in the dependency information
208
- let moduleDetails = try dependencyGraph. clangModuleDetails ( of: moduleId)
209
- moduleDetails. commandLine. forEach { commandLine. appendFlags ( $0) }
210
-
211
- // Add the `-target` option as inherited from the dependent Swift module's PCM args
212
- pcmArgs. forEach { commandLine. appendFlags ( $0) }
213
-
214
- // Resolve all dependency module inputs for this Clang module
215
- try resolveExplicitModuleDependencies ( moduleId: moduleId, pcmArgs: pcmArgs,
216
- inputs: & inputs,
217
- commandLine: & commandLine)
218
-
219
- let moduleMapPath = moduleDetails. moduleMapPath. path
220
- let modulePCMPath = moduleInfo. modulePath
221
- outputs. append ( TypedVirtualPath ( file: modulePCMPath. path, type: . pcm) )
222
-
223
- // The only required input is the .modulemap for this module.
224
- // Command line options in the dependency scanner output will include the
225
- // required modulemap, so here we must only add it to the list of inputs.
226
- inputs. append ( TypedVirtualPath ( file: moduleMapPath,
227
- type: . clangModuleMap) )
228
-
229
- jobs. append ( Job (
230
- moduleName: moduleId. moduleName,
231
- kind: . generatePCM,
232
- tool: try toolchain. resolvedTool ( . swiftCompiler) ,
233
- commandLine: commandLine,
234
- inputs: inputs,
235
- primaryInputs: [ ] ,
236
- outputs: outputs
237
- ) )
238
- }
186
+ var inputs : [ TypedVirtualPath ] = [ ]
187
+ var outputs : [ TypedVirtualPath ] = [ ]
188
+ var commandLine : [ Job . ArgTemplate ] = [ ]
189
+
190
+ // First, take the command line options provided in the dependency information
191
+ let moduleDetails = try dependencyGraph. clangModuleDetails ( of: moduleId)
192
+ moduleDetails. commandLine. forEach { commandLine. appendFlags ( $0) }
193
+
194
+ // Resolve all dependency module inputs for this Clang module
195
+ try resolveExplicitModuleDependencies ( moduleId: moduleId, inputs: & inputs,
196
+ commandLine: & commandLine)
197
+
198
+ let moduleMapPath = moduleDetails. moduleMapPath. path
199
+ let modulePCMPath = moduleInfo. modulePath
200
+ outputs. append ( TypedVirtualPath ( file: modulePCMPath. path, type: . pcm) )
201
+
202
+ // The only required input is the .modulemap for this module.
203
+ // Command line options in the dependency scanner output will include the
204
+ // required modulemap, so here we must only add it to the list of inputs.
205
+ inputs. append ( TypedVirtualPath ( file: moduleMapPath,
206
+ type: . clangModuleMap) )
207
+
208
+ jobs. append ( Job (
209
+ moduleName: moduleId. moduleName,
210
+ kind: . generatePCM,
211
+ tool: try toolchain. resolvedTool ( . swiftCompiler) ,
212
+ commandLine: commandLine,
213
+ inputs: inputs,
214
+ primaryInputs: [ ] ,
215
+ outputs: outputs
216
+ ) )
239
217
}
240
218
return jobs
241
219
}
242
220
243
221
/// For the specified module, update the given command line flags and inputs
244
222
/// to use explicitly-built module dependencies.
245
- private mutating func resolveExplicitModuleDependencies( moduleId: ModuleDependencyId , pcmArgs : [ String ] ,
223
+ private mutating func resolveExplicitModuleDependencies( moduleId: ModuleDependencyId ,
246
224
inputs: inout [ TypedVirtualPath ] ,
247
225
commandLine: inout [ Job . ArgTemplate ] ) throws {
248
226
// Prohibit the frontend from implicitly building textual modules into binary modules.
249
227
var swiftDependencyArtifacts : [ SwiftModuleArtifactInfo ] = [ ]
250
228
var clangDependencyArtifacts : [ ClangModuleArtifactInfo ] = [ ]
251
- try addModuleDependencies ( of: moduleId, pcmArgs : pcmArgs ,
229
+ try addModuleDependencies ( of: moduleId,
252
230
clangDependencyArtifacts: & clangDependencyArtifacts,
253
231
swiftDependencyArtifacts: & swiftDependencyArtifacts)
254
232
@@ -286,7 +264,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
286
264
}
287
265
288
266
private mutating func addModuleDependency( of moduleId: ModuleDependencyId ,
289
- dependencyId: ModuleDependencyId , pcmArgs : [ String ] ,
267
+ dependencyId: ModuleDependencyId ,
290
268
clangDependencyArtifacts: inout [ ClangModuleArtifactInfo ] ,
291
269
swiftDependencyArtifacts: inout [ SwiftModuleArtifactInfo ]
292
270
) throws {
@@ -332,15 +310,15 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
332
310
333
311
/// Add a specific module dependency as an input and a corresponding command
334
312
/// line flag.
335
- private mutating func addModuleDependencies( of moduleId: ModuleDependencyId , pcmArgs : [ String ] ,
313
+ private mutating func addModuleDependencies( of moduleId: ModuleDependencyId ,
336
314
clangDependencyArtifacts: inout [ ClangModuleArtifactInfo ] ,
337
315
swiftDependencyArtifacts: inout [ SwiftModuleArtifactInfo ]
338
316
) throws {
339
317
guard let moduleDependencies = reachabilityMap [ moduleId] else {
340
318
fatalError ( " Expected reachability information for the module: \( moduleId. moduleName) . " )
341
319
}
342
320
for dependencyId in moduleDependencies {
343
- try addModuleDependency ( of: moduleId, dependencyId: dependencyId, pcmArgs : pcmArgs ,
321
+ try addModuleDependency ( of: moduleId, dependencyId: dependencyId,
344
322
clangDependencyArtifacts: & clangDependencyArtifacts,
345
323
swiftDependencyArtifacts: & swiftDependencyArtifacts)
346
324
}
@@ -374,8 +352,6 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
374
352
" -Xcc " , " -fno-implicit-modules " ,
375
353
" -Xcc " , " -fno-implicit-module-maps " )
376
354
try resolveExplicitModuleDependencies ( moduleId: mainModuleId,
377
- pcmArgs:
378
- try dependencyGraph. swiftModulePCMArgs ( of: mainModuleId) ,
379
355
inputs: & inputs,
380
356
commandLine: & commandLine)
381
357
}
@@ -405,10 +381,10 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
405
381
continue
406
382
}
407
383
addedDependencies. insert ( bridgingHeaderDepID)
408
- try addModuleDependency ( of: mainModuleId, dependencyId: bridgingHeaderDepID, pcmArgs : [ ] ,
384
+ try addModuleDependency ( of: mainModuleId, dependencyId: bridgingHeaderDepID,
409
385
clangDependencyArtifacts: & clangDependencyArtifacts,
410
386
swiftDependencyArtifacts: & swiftDependencyArtifacts)
411
- try addModuleDependencies ( of: bridgingHeaderDepID, pcmArgs : [ ] ,
387
+ try addModuleDependencies ( of: bridgingHeaderDepID,
412
388
clangDependencyArtifacts: & clangDependencyArtifacts,
413
389
swiftDependencyArtifacts: & swiftDependencyArtifacts)
414
390
let depInfo = try dependencyGraph. moduleInfo ( of: bridgingHeaderDepID)
0 commit comments