@@ -51,13 +51,13 @@ public final class Core: Sendable {
51
51
return nil
52
52
}
53
53
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
+ }
61
61
62
62
let resolvedDeveloperPath : DeveloperPath
63
63
do {
@@ -81,6 +81,12 @@ public final class Core: Sendable {
81
81
return nil
82
82
}
83
83
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
+
84
90
let core : Core
85
91
do {
86
92
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 {
103
109
}
104
110
}
105
111
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
-
112
112
await core. initializeSpecRegistry ( )
113
113
114
114
await core. initializePlatformRegistry ( )
@@ -313,19 +313,19 @@ public final class Core: Sendable {
313
313
} ( )
314
314
315
315
/// 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
+ }
321
321
322
322
var result = [ Path] ( )
323
323
324
324
// If we are inferior, then search the built products directory first.
325
325
//
326
326
// FIXME: This is error prone, as it won't validate that any of these are installed in the expected location.
327
327
// 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 {
329
329
result. append ( inferiorProductsPath)
330
330
}
331
331
@@ -359,8 +359,7 @@ public final class Core: Sendable {
359
359
}
360
360
361
361
return result. map { $0. normalize ( ) }
362
- #endif
363
- } ( )
362
+ }
364
363
365
364
/// The list of SDK search paths.
366
365
@_spi ( Testing) public lazy var sdkPaths : [ ( Path , Platform ? ) ] = {
0 commit comments