@@ -186,26 +186,38 @@ public final actor SemanticIndexManager {
186
186
/// This method is intended to initially update the index of a project after it is opened.
187
187
public func scheduleBuildGraphGenerationAndBackgroundIndexAllFiles( ) async {
188
188
generateBuildGraphTask = Task ( priority: . low) {
189
- let signposter = Logger ( subsystem: LoggingScope . subsystem, category: " preparation " ) . makeSignposter ( )
190
- let signpostID = signposter. makeSignpostID ( )
191
- let state = signposter. beginInterval ( " Preparing " , id: signpostID, " Generating build graph " )
192
- defer {
193
- signposter. endInterval ( " Preparing " , state)
194
- }
195
- await testHooks. buildGraphGenerationDidStart ? ( )
196
- await orLog ( " Generating build graph " ) { try await self . buildSystemManager. generateBuildGraph ( ) }
197
- await testHooks. buildGraphGenerationDidFinish ? ( )
198
- let index = index. checked ( for: . modifiedFiles)
199
- let filesToIndex = await self . buildSystemManager. sourceFiles ( ) . lazy. map ( \. uri)
200
- . filter { uri in
201
- guard let url = uri. fileURL else {
202
- // The URI is not a file, so there's nothing we can index.
203
- return false
204
- }
205
- return !index. hasUpToDateUnit ( for: url)
189
+ await withLoggingSubsystemAndScope (
190
+ subsystem: " org.swift.sourcekit-lsp.indexing " ,
191
+ scope: " build-graph-generation "
192
+ ) {
193
+ logger. log (
194
+ " Starting build graph generation with priority \( Task . currentPriority. rawValue, privacy: . public) "
195
+ )
196
+ let signposter = logger. makeSignposter ( )
197
+ let signpostID = signposter. makeSignpostID ( )
198
+ let state = signposter. beginInterval ( " Preparing " , id: signpostID, " Generating build graph " )
199
+ defer {
200
+ signposter. endInterval ( " Preparing " , state)
206
201
}
207
- await scheduleBackgroundIndex ( files: filesToIndex)
208
- generateBuildGraphTask = nil
202
+ await testHooks. buildGraphGenerationDidStart ? ( )
203
+ let startDate = Date ( )
204
+ await orLog ( " Generating build graph " ) { try await self . buildSystemManager. generateBuildGraph ( ) }
205
+ await testHooks. buildGraphGenerationDidFinish ? ( )
206
+ let index = index. checked ( for: . modifiedFiles)
207
+ let filesToIndex = await self . buildSystemManager. sourceFiles ( ) . lazy. map ( \. uri)
208
+ . filter { uri in
209
+ guard let url = uri. fileURL else {
210
+ // The URI is not a file, so there's nothing we can index.
211
+ return false
212
+ }
213
+ return !index. hasUpToDateUnit ( for: url)
214
+ }
215
+ await scheduleBackgroundIndex ( files: filesToIndex)
216
+ logger. log (
217
+ " Finished build graph generation in \( Date ( ) . timeIntervalSince ( startDate) * 1000 , privacy: . public) ms "
218
+ )
219
+ generateBuildGraphTask = nil
220
+ }
209
221
}
210
222
indexStatusDidChange ( )
211
223
}
0 commit comments