@@ -51,13 +51,13 @@ public final class Core: Sendable {
5151 return nil
5252 }
5353
54- # if USE_STATIC_PLUGIN_INITIALIZATION
55- // In a package context, plugins are statically linked into the build system.
56- // Load specs from service plugins if requested since we don't have a Service in certain tests
57- // Here we don't have access to `core.pluginPaths` like we do in the call below,
58- // but it doesn't matter because it will return an empty array when USE_STATIC_PLUGIN_INITIALIZATION is defined.
59- await extraPluginRegistration ( pluginManager, [ ] )
60- #endif
54+ if useStaticPluginInitialization {
55+ // In a package context, plugins are statically linked into the build system.
56+ // Load specs from service plugins if requested since we don't have a Service in certain tests
57+ // Here we don't have access to `core.pluginPaths` like we do in the call below,
58+ // but it doesn't matter because `core.pluginPaths` will return an empty array when USE_STATIC_PLUGIN_INITIALIZATION is defined.
59+ await extraPluginRegistration ( pluginManager, [ ] )
60+ }
6161
6262 let resolvedDeveloperPath : DeveloperPath
6363 do {
@@ -81,6 +81,12 @@ public final class Core: Sendable {
8181 return nil
8282 }
8383
84+ if !useStaticPluginInitialization {
85+ // In a package context, plugins are statically linked into the build system.
86+ // Load specs from service plugins if requested since we don't have a Service in certain tests.
87+ await extraPluginRegistration ( pluginManager, Self . pluginPaths ( inferiorProductsPath: inferiorProductsPath, developerPath: resolvedDeveloperPath) )
88+ }
89+
8490 let core : Core
8591 do {
8692 core = try await Core ( delegate: delegate, hostOperatingSystem: hostOperatingSystem, pluginManager: pluginManager. finalize ( ) , developerPath: resolvedDeveloperPath, resourceSearchPaths: resourceSearchPaths, inferiorProductsPath: inferiorProductsPath, additionalContentPaths: additionalContentPaths, environment: environment, buildServiceModTime: buildServiceModTime, connectionMode: connectionMode)
@@ -103,12 +109,6 @@ public final class Core: Sendable {
103109 }
104110 }
105111
106- #if !USE_STATIC_PLUGIN_INITIALIZATION
107- // In a package context, plugins are statically linked into the build system.
108- // Load specs from service plugins if requested since we don't have a Service in certain tests
109- await extraPluginRegistration ( core. pluginManager, core. pluginPaths)
110- #endif
111-
112112 await core. initializeSpecRegistry ( )
113113
114114 await core. initializePlatformRegistry ( )
@@ -313,19 +313,19 @@ public final class Core: Sendable {
313313 } ( )
314314
315315 /// The list of plugin search paths.
316- @ _spi ( Testing ) public lazy var pluginPaths : [ Path ] = {
317- # if USE_STATIC_PLUGIN_INITIALIZATION
318- // In a package context, plugins are statically linked into the build system.
319- return [ ]
320- #else
316+ private static func pluginPaths( inferiorProductsPath : Path ? , developerPath : DeveloperPath ) -> [ Path ] {
317+ if useStaticPluginInitialization {
318+ // In a package context, plugins are statically linked into the build system.
319+ return [ ]
320+ }
321321
322322 var result = [ Path] ( )
323323
324324 // If we are inferior, then search the built products directory first.
325325 //
326326 // FIXME: This is error prone, as it won't validate that any of these are installed in the expected location.
327327 // FIXME: If we remove, move or rename something in the built Xcode, then this will still find the old item in the installed Xcode.
328- if let inferiorProductsPath = self . inferiorProductsPath {
328+ if let inferiorProductsPath {
329329 result. append ( inferiorProductsPath)
330330 }
331331
@@ -359,8 +359,7 @@ public final class Core: Sendable {
359359 }
360360
361361 return result. map { $0. normalize ( ) }
362- #endif
363- } ( )
362+ }
364363
365364 /// The list of SDK search paths.
366365 @_spi ( Testing) public lazy var sdkPaths : [ ( Path , Platform ? ) ] = {
0 commit comments