@@ -138,7 +138,7 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
138
138
private let allOutputPaths : Set < Path >
139
139
140
140
private let rootPathsPerTarget : [ ConfiguredTarget : [ Path ] ]
141
- private let moduleCachePathPerTarget : [ ConfiguredTarget : Path ]
141
+ private let moduleCachePathsPerTarget : [ ConfiguredTarget : [ Path ] ]
142
142
143
143
private let dependencyValidationPerTarget : [ ConfiguredTarget : BooleanWarningLevel ]
144
144
@@ -192,13 +192,13 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
192
192
package let emitFrontendCommandLines : Bool
193
193
194
194
/// Load a build description from the given path.
195
- fileprivate init ( inDir dir: Path , signature: BuildDescriptionSignature , taskStore: FrozenTaskStore , allOutputPaths: Set < Path > , rootPathsPerTarget: [ ConfiguredTarget : [ Path ] ] , moduleCachePathPerTarget : [ ConfiguredTarget : Path ] , settingsPerTarget: [ ConfiguredTarget : Settings ] , enableStaleFileRemoval: Bool = true , taskActionMap: [ String : TaskAction . Type ] , targetTaskCounts: [ ConfiguredTarget : Int ] , moduleSessionFilePath: Path ? , diagnostics: [ ConfiguredTarget ? : [ Diagnostic ] ] , fs: any FSProxy , invalidationPaths: [ Path ] , recursiveSearchPathResults: [ RecursiveSearchPathResolver . CachedResult ] , copiedPathMap: [ String : String ] , targetDependencies: [ TargetDependencyRelationship ] , definingTargetsByModuleName: [ String : OrderedSet < ConfiguredTarget > ] , capturedBuildInfo: CapturedBuildInfo ? , bypassActualTasks: Bool , targetsBuildInParallel: Bool , emitFrontendCommandLines: Bool ) throws {
195
+ fileprivate init ( inDir dir: Path , signature: BuildDescriptionSignature , taskStore: FrozenTaskStore , allOutputPaths: Set < Path > , rootPathsPerTarget: [ ConfiguredTarget : [ Path ] ] , moduleCachePathsPerTarget : [ ConfiguredTarget : [ Path ] ] , settingsPerTarget: [ ConfiguredTarget : Settings ] , enableStaleFileRemoval: Bool = true , taskActionMap: [ String : TaskAction . Type ] , targetTaskCounts: [ ConfiguredTarget : Int ] , moduleSessionFilePath: Path ? , diagnostics: [ ConfiguredTarget ? : [ Diagnostic ] ] , fs: any FSProxy , invalidationPaths: [ Path ] , recursiveSearchPathResults: [ RecursiveSearchPathResolver . CachedResult ] , copiedPathMap: [ String : String ] , targetDependencies: [ TargetDependencyRelationship ] , definingTargetsByModuleName: [ String : OrderedSet < ConfiguredTarget > ] , capturedBuildInfo: CapturedBuildInfo ? , bypassActualTasks: Bool , targetsBuildInParallel: Bool , emitFrontendCommandLines: Bool ) throws {
196
196
self . dir = dir
197
197
self . signature = signature
198
198
self . taskStore = taskStore
199
199
self . allOutputPaths = allOutputPaths
200
200
self . rootPathsPerTarget = rootPathsPerTarget
201
- self . moduleCachePathPerTarget = moduleCachePathPerTarget
201
+ self . moduleCachePathsPerTarget = moduleCachePathsPerTarget
202
202
self . dependencyValidationPerTarget = settingsPerTarget. mapValues { $0. globalScope. evaluate ( BuiltinMacros . VALIDATE_DEPENDENCIES) }
203
203
self . taskActionMap = taskActionMap
204
204
self . targetTaskCounts = targetTaskCounts
@@ -271,8 +271,10 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
271
271
}
272
272
273
273
// Only consider paths which _aren't_ in the module cache, which isn't tracked by the build system at present (this may change in future with explicit modules). Normally such paths would be excluded by the root paths check below, but the module cache path may be under one of the other root paths in certain configurations (e.g. overridden SYMROOT).
274
- if moduleCachePathPerTarget [ target] ? . isAncestor ( of: path) == true {
275
- return false
274
+ for cachePath in moduleCachePathsPerTarget [ target, default: [ ] ] {
275
+ if cachePath. isAncestor ( of: path) == true {
276
+ return false
277
+ }
276
278
}
277
279
278
280
// Only consider build directories as those which the build system itself has created.
@@ -323,7 +325,7 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
323
325
// Serialize the tasks first so we can index into this array during deserialization.
324
326
serializer. serialize ( allOutputPaths)
325
327
serializer. serialize ( rootPathsPerTarget)
326
- serializer. serialize ( moduleCachePathPerTarget )
328
+ serializer. serialize ( moduleCachePathsPerTarget )
327
329
serializer. serialize ( dependencyValidationPerTarget)
328
330
serializer. beginAggregate ( taskActionMap. count)
329
331
for (tool, taskActionClass) in taskActionMap. sorted ( byKey: < ) {
@@ -361,7 +363,7 @@ package final class BuildDescription: Serializable, Sendable, Encodable, Cacheab
361
363
self . signature = try deserializer. deserialize ( )
362
364
self . allOutputPaths = try deserializer. deserialize ( )
363
365
self . rootPathsPerTarget = try deserializer. deserialize ( )
364
- self . moduleCachePathPerTarget = try deserializer. deserialize ( )
366
+ self . moduleCachePathsPerTarget = try deserializer. deserialize ( )
365
367
self . dependencyValidationPerTarget = try deserializer. deserialize ( )
366
368
var taskActionMap = [ String: TaskAction . Type] ( )
367
369
let taskActionMapCount = try deserializer. beginAggregate ( )
@@ -528,7 +530,7 @@ package final class BuildDescriptionBuilder {
528
530
private let rootPathsPerTarget : [ ConfiguredTarget : [ Path ] ]
529
531
530
532
// The map of module cache path per configured target.
531
- private let moduleCachePathPerTarget : [ ConfiguredTarget : Path ]
533
+ private let moduleCachePathsPerTarget : [ ConfiguredTarget : [ Path ] ]
532
534
533
535
// The map of stale file removal identifier per configured target.
534
536
private let staleFileRemovalIdentifierPerTarget : [ ConfiguredTarget ? : String ]
@@ -547,7 +549,7 @@ package final class BuildDescriptionBuilder {
547
549
/// - Parameters:
548
550
/// - path: The path of a directory to store the build description to.
549
551
/// - bypassActualTasks: If enabled, replace tasks with fake ones (`/usr/bin/true`).
550
- init ( path: Path , signature: BuildDescriptionSignature , buildCommand: BuildCommand , taskAdditionalInputs: [ Ref < any PlannedTask > : NodeList ] , mutatedNodes: Set < Ref < any PlannedNode > > , mutatingTasks: [ Ref < any PlannedTask > : MutatingTaskInfo ] , bypassActualTasks: Bool , targetsBuildInParallel: Bool , emitFrontendCommandLines: Bool , moduleSessionFilePath: Path ? , invalidationPaths: [ Path ] , recursiveSearchPathResults: [ RecursiveSearchPathResolver . CachedResult ] , copiedPathMap: [ String : String ] , outputPathsPerTarget: [ ConfiguredTarget ? : [ Path ] ] , allOutputPaths: Set < Path > , rootPathsPerTarget: [ ConfiguredTarget : [ Path ] ] , moduleCachePathPerTarget : [ ConfiguredTarget : Path ] , staleFileRemovalIdentifierPerTarget: [ ConfiguredTarget ? : String ] , settingsPerTarget: [ ConfiguredTarget : Settings ] , targetDependencies: [ TargetDependencyRelationship ] , definingTargetsByModuleName: [ String : OrderedSet < ConfiguredTarget > ] , workspace: Workspace , capturedBuildInfo: CapturedBuildInfo ? ) {
552
+ init ( path: Path , signature: BuildDescriptionSignature , buildCommand: BuildCommand , taskAdditionalInputs: [ Ref < any PlannedTask > : NodeList ] , mutatedNodes: Set < Ref < any PlannedNode > > , mutatingTasks: [ Ref < any PlannedTask > : MutatingTaskInfo ] , bypassActualTasks: Bool , targetsBuildInParallel: Bool , emitFrontendCommandLines: Bool , moduleSessionFilePath: Path ? , invalidationPaths: [ Path ] , recursiveSearchPathResults: [ RecursiveSearchPathResolver . CachedResult ] , copiedPathMap: [ String : String ] , outputPathsPerTarget: [ ConfiguredTarget ? : [ Path ] ] , allOutputPaths: Set < Path > , rootPathsPerTarget: [ ConfiguredTarget : [ Path ] ] , moduleCachePathsPerTarget : [ ConfiguredTarget : [ Path ] ] , staleFileRemovalIdentifierPerTarget: [ ConfiguredTarget ? : String ] , settingsPerTarget: [ ConfiguredTarget : Settings ] , targetDependencies: [ TargetDependencyRelationship ] , definingTargetsByModuleName: [ String : OrderedSet < ConfiguredTarget > ] , workspace: Workspace , capturedBuildInfo: CapturedBuildInfo ? ) {
551
553
self . path = path
552
554
self . signature = signature
553
555
self . taskAdditionalInputs = taskAdditionalInputs
@@ -563,7 +565,7 @@ package final class BuildDescriptionBuilder {
563
565
self . outputPathsPerTarget = outputPathsPerTarget
564
566
self . allOutputPaths = allOutputPaths
565
567
self . rootPathsPerTarget = rootPathsPerTarget
566
- self . moduleCachePathPerTarget = moduleCachePathPerTarget
568
+ self . moduleCachePathsPerTarget = moduleCachePathsPerTarget
567
569
self . staleFileRemovalIdentifierPerTarget = staleFileRemovalIdentifierPerTarget
568
570
self . settingsPerTarget = settingsPerTarget
569
571
self . targetDependencies = targetDependencies
@@ -676,7 +678,7 @@ package final class BuildDescriptionBuilder {
676
678
// Create the build description.
677
679
let buildDescription : BuildDescription
678
680
do {
679
- buildDescription = try BuildDescription ( inDir: path, signature: signature, taskStore: frozenTaskStore, allOutputPaths: allOutputPaths, rootPathsPerTarget: rootPathsPerTarget, moduleCachePathPerTarget : moduleCachePathPerTarget , settingsPerTarget: settingsPerTarget, taskActionMap: taskActionMap, targetTaskCounts: targetTaskCounts, moduleSessionFilePath: moduleSessionFilePath, diagnostics: diagnosticsEngines. mapValues { engine in engine. diagnostics } , fs: fs, invalidationPaths: invalidationPaths, recursiveSearchPathResults: recursiveSearchPathResults, copiedPathMap: copiedPathMap, targetDependencies: targetDependencies, definingTargetsByModuleName: definingTargetsByModuleName, capturedBuildInfo: capturedBuildInfo, bypassActualTasks: bypassActualTasks, targetsBuildInParallel: targetsBuildInParallel, emitFrontendCommandLines: emitFrontendCommandLines)
681
+ buildDescription = try BuildDescription ( inDir: path, signature: signature, taskStore: frozenTaskStore, allOutputPaths: allOutputPaths, rootPathsPerTarget: rootPathsPerTarget, moduleCachePathsPerTarget : moduleCachePathsPerTarget , settingsPerTarget: settingsPerTarget, taskActionMap: taskActionMap, targetTaskCounts: targetTaskCounts, moduleSessionFilePath: moduleSessionFilePath, diagnostics: diagnosticsEngines. mapValues { engine in engine. diagnostics } , fs: fs, invalidationPaths: invalidationPaths, recursiveSearchPathResults: recursiveSearchPathResults, copiedPathMap: copiedPathMap, targetDependencies: targetDependencies, definingTargetsByModuleName: definingTargetsByModuleName, capturedBuildInfo: capturedBuildInfo, bypassActualTasks: bypassActualTasks, targetsBuildInParallel: targetsBuildInParallel, emitFrontendCommandLines: emitFrontendCommandLines)
680
682
}
681
683
catch {
682
684
throw StubError . error ( " unable to create build description: \( error) " )
@@ -1006,7 +1008,7 @@ extension BuildDescription {
1006
1008
// FIXME: Bypass actual tasks should go away, eventually.
1007
1009
//
1008
1010
// FIXME: This layering isn't working well, we are plumbing a bunch of stuff through here just because we don't want to talk to TaskConstruction.
1009
- static package func construct( workspace: Workspace , tasks: [ any PlannedTask ] , path: Path , signature: BuildDescriptionSignature , buildCommand: BuildCommand , diagnostics: [ ConfiguredTarget ? : [ Diagnostic ] ] = [ : ] , indexingInfo: [ ( forTarget: ConfiguredTarget ? , path: Path , indexingInfo: any SourceFileIndexingInfo ) ] = [ ] , fs: any FSProxy = localFS, bypassActualTasks: Bool = false , targetsBuildInParallel: Bool = true , emitFrontendCommandLines: Bool = false , moduleSessionFilePath: Path ? = nil , invalidationPaths: [ Path ] = [ ] , recursiveSearchPathResults: [ RecursiveSearchPathResolver . CachedResult ] = [ ] , copiedPathMap: [ String : String ] = [ : ] , rootPathsPerTarget: [ ConfiguredTarget : [ Path ] ] = [ : ] , moduleCachePathPerTarget: [ ConfiguredTarget : Path ] = [ : ] , staleFileRemovalIdentifierPerTarget: [ ConfiguredTarget ? : String ] = [ : ] , settingsPerTarget: [ ConfiguredTarget : Settings ] = [ : ] , delegate: any BuildDescriptionConstructionDelegate , targetDependencies: [ TargetDependencyRelationship ] = [ ] , definingTargetsByModuleName: [ String : OrderedSet < ConfiguredTarget > ] , capturedBuildInfo: CapturedBuildInfo ? , userPreferences: UserPreferences ) async throws -> BuildDescription ? {
1011
+ static package func construct( workspace: Workspace , tasks: [ any PlannedTask ] , path: Path , signature: BuildDescriptionSignature , buildCommand: BuildCommand , diagnostics: [ ConfiguredTarget ? : [ Diagnostic ] ] = [ : ] , indexingInfo: [ ( forTarget: ConfiguredTarget ? , path: Path , indexingInfo: any SourceFileIndexingInfo ) ] = [ ] , fs: any FSProxy = localFS, bypassActualTasks: Bool = false , targetsBuildInParallel: Bool = true , emitFrontendCommandLines: Bool = false , moduleSessionFilePath: Path ? = nil , invalidationPaths: [ Path ] = [ ] , recursiveSearchPathResults: [ RecursiveSearchPathResolver . CachedResult ] = [ ] , copiedPathMap: [ String : String ] = [ : ] , rootPathsPerTarget: [ ConfiguredTarget : [ Path ] ] = [ : ] , moduleCachePathsPerTarget: [ ConfiguredTarget : [ Path ] ] = [ : ] , staleFileRemovalIdentifierPerTarget: [ ConfiguredTarget ? : String ] = [ : ] , settingsPerTarget: [ ConfiguredTarget : Settings ] = [ : ] , delegate: any BuildDescriptionConstructionDelegate , targetDependencies: [ TargetDependencyRelationship ] = [ ] , definingTargetsByModuleName: [ String : OrderedSet < ConfiguredTarget > ] , capturedBuildInfo: CapturedBuildInfo ? , userPreferences: UserPreferences ) async throws -> BuildDescription ? {
1010
1012
var diagnostics = diagnostics
1011
1013
1012
1014
// We operate on the sorted tasks here to ensure that the list of task additional inputs is deterministic.
@@ -1269,7 +1271,7 @@ extension BuildDescription {
1269
1271
}
1270
1272
1271
1273
// Create the builder.
1272
- let builder = BuildDescriptionBuilder ( path: path, signature: signature, buildCommand: buildCommand, taskAdditionalInputs: taskAdditionalInputs, mutatedNodes: Set ( mutableNodes. keys) , mutatingTasks: mutatingTasks, bypassActualTasks: bypassActualTasks, targetsBuildInParallel: targetsBuildInParallel, emitFrontendCommandLines: emitFrontendCommandLines, moduleSessionFilePath: moduleSessionFilePath, invalidationPaths: invalidationPaths, recursiveSearchPathResults: recursiveSearchPathResults, copiedPathMap: copiedPathMap, outputPathsPerTarget: outputPathsPerTarget, allOutputPaths: Set ( producers. keys. map { $0. instance. path } ) , rootPathsPerTarget: rootPathsPerTarget, moduleCachePathPerTarget : moduleCachePathPerTarget , staleFileRemovalIdentifierPerTarget: staleFileRemovalIdentifierPerTarget, settingsPerTarget: settingsPerTarget, targetDependencies: targetDependencies, definingTargetsByModuleName: definingTargetsByModuleName, workspace: workspace, capturedBuildInfo: capturedBuildInfo)
1274
+ let builder = BuildDescriptionBuilder ( path: path, signature: signature, buildCommand: buildCommand, taskAdditionalInputs: taskAdditionalInputs, mutatedNodes: Set ( mutableNodes. keys) , mutatingTasks: mutatingTasks, bypassActualTasks: bypassActualTasks, targetsBuildInParallel: targetsBuildInParallel, emitFrontendCommandLines: emitFrontendCommandLines, moduleSessionFilePath: moduleSessionFilePath, invalidationPaths: invalidationPaths, recursiveSearchPathResults: recursiveSearchPathResults, copiedPathMap: copiedPathMap, outputPathsPerTarget: outputPathsPerTarget, allOutputPaths: Set ( producers. keys. map { $0. instance. path } ) , rootPathsPerTarget: rootPathsPerTarget, moduleCachePathsPerTarget : moduleCachePathsPerTarget , staleFileRemovalIdentifierPerTarget: staleFileRemovalIdentifierPerTarget, settingsPerTarget: settingsPerTarget, targetDependencies: targetDependencies, definingTargetsByModuleName: definingTargetsByModuleName, workspace: workspace, capturedBuildInfo: capturedBuildInfo)
1273
1275
for (target, diagnostics) in diagnostics {
1274
1276
let engine = builder. diagnosticsEngines. getOrInsert ( target, { DiagnosticsEngine ( ) } )
1275
1277
for diag in diagnostics {
0 commit comments