@@ -145,7 +145,7 @@ private extension BuildSystemSpec {
145145 private static func createBuiltInBuildSystemAdapter(
146146 projectRoot: URL ,
147147 messagesToSourceKitLSPHandler: any MessageHandler ,
148- buildSystemTestHooks : BuildSystemTestHooks ,
148+ buildSystemHooks : BuildSystemHooks ,
149149 _ createBuildSystem: @Sendable ( _ connectionToSourceKitLSP: any Connection ) async throws -> BuiltInBuildSystem ?
150150 ) async -> BuildSystemAdapter ? {
151151 let connectionToSourceKitLSP = LocalConnection (
@@ -164,7 +164,7 @@ private extension BuildSystemSpec {
164164 let buildSystemAdapter = BuiltInBuildSystemAdapter (
165165 underlyingBuildSystem: buildSystem,
166166 connectionToSourceKitLSP: connectionToSourceKitLSP,
167- buildSystemTestHooks : buildSystemTestHooks
167+ buildSystemHooks : buildSystemHooks
168168 )
169169 let connectionToBuildSystem = LocalConnection (
170170 receiverName: " \( type ( of: buildSystem) ) for \( projectRoot. lastPathComponent) "
@@ -178,7 +178,7 @@ private extension BuildSystemSpec {
178178 func createBuildSystemAdapter(
179179 toolchainRegistry: ToolchainRegistry ,
180180 options: SourceKitLSPOptions ,
181- buildSystemTestHooks testHooks : BuildSystemTestHooks ,
181+ buildSystemHooks : BuildSystemHooks ,
182182 messagesToSourceKitLSPHandler: any MessageHandler
183183 ) async -> BuildSystemAdapter ? {
184184 switch self . kind {
@@ -199,7 +199,7 @@ private extension BuildSystemSpec {
199199 return await Self . createBuiltInBuildSystemAdapter (
200200 projectRoot: projectRoot,
201201 messagesToSourceKitLSPHandler: messagesToSourceKitLSPHandler,
202- buildSystemTestHooks : testHooks
202+ buildSystemHooks : buildSystemHooks
203203 ) { connectionToSourceKitLSP in
204204 CompilationDatabaseBuildSystem (
205205 projectRoot: projectRoot,
@@ -214,26 +214,26 @@ private extension BuildSystemSpec {
214214 return await Self . createBuiltInBuildSystemAdapter (
215215 projectRoot: projectRoot,
216216 messagesToSourceKitLSPHandler: messagesToSourceKitLSPHandler,
217- buildSystemTestHooks : testHooks
217+ buildSystemHooks : buildSystemHooks
218218 ) { connectionToSourceKitLSP in
219219 try await SwiftPMBuildSystem (
220220 projectRoot: projectRoot,
221221 toolchainRegistry: toolchainRegistry,
222222 options: options,
223223 connectionToSourceKitLSP: connectionToSourceKitLSP,
224- testHooks: testHooks . swiftPMTestHooks
224+ testHooks: buildSystemHooks . swiftPMTestHooks
225225 )
226226 }
227227 #else
228228 return nil
229229 #endif
230- case . testBuildSystem :
230+ case . injected ( let injector ) :
231231 return await Self . createBuiltInBuildSystemAdapter (
232232 projectRoot: projectRoot,
233233 messagesToSourceKitLSPHandler: messagesToSourceKitLSPHandler,
234- buildSystemTestHooks : testHooks
234+ buildSystemHooks : buildSystemHooks
235235 ) { connectionToSourceKitLSP in
236- TestBuildSystem ( projectRoot: projectRoot, connectionToSourceKitLSP: connectionToSourceKitLSP)
236+ await injector . createBuildSystem ( projectRoot: projectRoot, connectionToSourceKitLSP: connectionToSourceKitLSP)
237237 }
238238 }
239239 }
@@ -275,19 +275,6 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
275275 }
276276 }
277277
278- /// If the underlying build system is a `TestBuildSystem`, return it. Otherwise, `nil`
279- ///
280- /// - Important: For testing purposes only.
281- package var testBuildSystem : TestBuildSystem ? {
282- get async {
283- switch buildSystemAdapter {
284- case . builtIn( let builtInBuildSystemAdapter, _) : return await builtInBuildSystemAdapter. testBuildSystem
285- case . external: return nil
286- case nil : return nil
287- }
288- }
289- }
290-
291278 /// Provider of file to main file mappings.
292279 private var mainFilesProvider : MainFilesProvider ?
293280
@@ -367,7 +354,7 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
367354 toolchainRegistry: ToolchainRegistry ,
368355 options: SourceKitLSPOptions ,
369356 connectionToClient: BuildSystemManagerConnectionToClient ,
370- buildSystemTestHooks : BuildSystemTestHooks
357+ buildSystemHooks : BuildSystemHooks
371358 ) async {
372359 self . toolchainRegistry = toolchainRegistry
373360 self . options = options
@@ -376,7 +363,7 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
376363 self . buildSystemAdapter = await buildSystemSpec? . createBuildSystemAdapter (
377364 toolchainRegistry: toolchainRegistry,
378365 options: options,
379- buildSystemTestHooks : buildSystemTestHooks ,
366+ buildSystemHooks : buildSystemHooks ,
380367 messagesToSourceKitLSPHandler: WeakMessageHandler ( self )
381368 )
382369
@@ -432,7 +419,7 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
432419 let adapter = BuiltInBuildSystemAdapter (
433420 underlyingBuildSystem: legacyBuildServer,
434421 connectionToSourceKitLSP: legacyBuildServer. connectionToSourceKitLSP,
435- buildSystemTestHooks : buildSystemTestHooks
422+ buildSystemHooks : buildSystemHooks
436423 )
437424 let connectionToBuildSystem = LocalConnection ( receiverName: " Legacy BSP server " )
438425 connectionToBuildSystem. start ( handler: adapter)
0 commit comments