@@ -327,11 +327,9 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
327
327
328
328
private var cachedTargetSources = RequestCache < BuildTargetSourcesRequest > ( )
329
329
330
- /// The parameters with which `SourceFilesAndDirectories` can be cached in `cachedSourceFilesAndDirectories`.
331
- private struct SourceFilesAndDirectoriesKey : Hashable {
332
- let includeNonBuildableFiles : Bool
333
- let sourcesItems : [ SourcesItem ]
334
- }
330
+ /// `SourceFilesAndDirectories` is a global property that only gets reset when the build targets change and thus
331
+ /// has no real key.
332
+ private struct SourceFilesAndDirectoriesKey : Hashable { }
335
333
336
334
private struct SourceFilesAndDirectories {
337
335
/// The source files in the workspace, ie. all `SourceItem`s that have `kind == .file`.
@@ -1045,27 +1043,22 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
1045
1043
///
1046
1044
/// `includeNonBuildableFiles` determines whether non-buildable files should be included.
1047
1045
private func sourceFilesAndDirectories( includeNonBuildableFiles: Bool ) async throws -> SourceFilesAndDirectories {
1048
- let targets = try await self . buildTargets ( )
1049
- let sourcesItems = try await self . sourceFiles ( in: Set ( targets. keys) )
1050
-
1051
- let key = SourceFilesAndDirectoriesKey (
1052
- includeNonBuildableFiles: includeNonBuildableFiles,
1053
- sourcesItems: sourcesItems
1054
- )
1046
+ return try await cachedSourceFilesAndDirectories. get ( SourceFilesAndDirectoriesKey ( ) , isolation: self ) { key in
1047
+ let targets = try await self . buildTargets ( )
1048
+ let sourcesItems = try await self . sourceFiles ( in: Set ( targets. keys) )
1055
1049
1056
- return try await cachedSourceFilesAndDirectories. get ( key, isolation: self ) { key in
1057
1050
var files : [ DocumentURI : SourceFileInfo ] = [ : ]
1058
1051
var directories : [ DocumentURI : SourceFileInfo ] = [ : ]
1059
- for sourcesItem in key . sourcesItems {
1052
+ for sourcesItem in sourcesItems {
1060
1053
let target = targets [ sourcesItem. target] ? . target
1061
1054
let isPartOfRootProject = !( target? . tags. contains ( . dependency) ?? false )
1062
1055
let mayContainTests = target? . tags. contains ( . test) ?? true
1063
- if !key . includeNonBuildableFiles && ( target? . tags. contains ( . notBuildable) ?? false ) {
1056
+ if !includeNonBuildableFiles && ( target? . tags. contains ( . notBuildable) ?? false ) {
1064
1057
continue
1065
1058
}
1066
1059
1067
1060
for sourceItem in sourcesItem. sources {
1068
- if !key . includeNonBuildableFiles && sourceItem. sourceKitData? . isHeader ?? false {
1061
+ if !includeNonBuildableFiles && sourceItem. sourceKitData? . isHeader ?? false {
1069
1062
continue
1070
1063
}
1071
1064
let info = SourceFileInfo (
0 commit comments