@@ -40,9 +40,9 @@ public final class Core: Sendable {
40
40
/// Get a configured instance of the core.
41
41
///
42
42
/// - returns: An initialized Core instance on which all discovery and loading will have been completed. If there are errors during that process, they will be logged to `stderr` and no instance will be returned. Otherwise, the initialized object is returned.
43
- public static func getInitializedCore( _ delegate: any CoreDelegate , pluginManager: PluginManager , developerPath: DeveloperPath ? = nil , resourceSearchPaths: [ Path ] = [ ] , inferiorProductsPath: Path ? = nil , extraPluginRegistration: @PluginExtensionSystemActor ( _ pluginPaths: [ Path ] ) -> Void = { _ in } , additionalContentPaths: [ Path ] = [ ] , environment: [ String : String ] = [ : ] , buildServiceModTime: Date , connectionMode: ServiceHostConnectionMode ) async -> Core ? {
43
+ public static func getInitializedCore( _ delegate: any CoreDelegate , pluginManager: MutablePluginManager , developerPath: DeveloperPath ? = nil , resourceSearchPaths: [ Path ] = [ ] , inferiorProductsPath: Path ? = nil , extraPluginRegistration: @PluginExtensionSystemActor ( _ pluginManager : MutablePluginManager , _ pluginPaths: [ Path ] ) -> Void = { _ , _ in } , additionalContentPaths: [ Path ] = [ ] , environment: [ String : String ] = [ : ] , buildServiceModTime: Date , connectionMode: ServiceHostConnectionMode ) async -> Core ? {
44
44
// Enable macro expression interning during loading.
45
- return await MacroNamespace . withExpressionInterningEnabled {
45
+ return await MacroNamespace . withExpressionInterningEnabled { ( ) -> Core ? in
46
46
let hostOperatingSystem : OperatingSystem
47
47
do {
48
48
hostOperatingSystem = try ProcessInfo . processInfo. hostOperatingSystem ( )
@@ -56,7 +56,7 @@ public final class Core: Sendable {
56
56
// Load specs from service plugins if requested since we don't have a Service in certain tests
57
57
// Here we don't have access to `core.pluginPaths` like we do in the call below,
58
58
// but it doesn't matter because it will return an empty array when USE_STATIC_PLUGIN_INITIALIZATION is defined.
59
- await extraPluginRegistration ( [ ] )
59
+ await extraPluginRegistration ( pluginManager , [ ] )
60
60
#endif
61
61
62
62
let resolvedDeveloperPath : DeveloperPath
@@ -83,20 +83,20 @@ public final class Core: Sendable {
83
83
84
84
let core : Core
85
85
do {
86
- core = try await Core ( delegate: delegate, hostOperatingSystem: hostOperatingSystem, pluginManager: pluginManager, developerPath: resolvedDeveloperPath, resourceSearchPaths: resourceSearchPaths, inferiorProductsPath: inferiorProductsPath, additionalContentPaths: additionalContentPaths, environment: environment, buildServiceModTime: buildServiceModTime, connectionMode: connectionMode)
86
+ 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)
87
87
} catch {
88
88
delegate. error ( " \( error) " )
89
89
return nil
90
90
}
91
91
92
92
if UserDefaults . enablePluginManagerLogging {
93
- let plugins = await core. pluginManager. pluginsByIdentifier
93
+ let plugins = core. pluginManager. pluginsByIdentifier
94
94
delegate. emit ( Diagnostic ( behavior: . note, location: . unknown, data: DiagnosticData ( " Loaded \( plugins. count) plugins " ) , childDiagnostics: plugins. sorted ( byKey: < ) . map { ( identifier, plugin) in
95
95
Diagnostic ( behavior: . note, location: . path( plugin. path) , data: DiagnosticData ( " Loaded plugin: \( identifier) from \( plugin. path. str) " ) )
96
96
} ) )
97
97
}
98
98
99
- for diagnostic in await core. pluginManager. loadingDiagnostics {
99
+ for diagnostic in core. pluginManager. loadingDiagnostics {
100
100
// Only emit "severe" diagnostics (warning, error) from the plugin manager if the logging dwrite isn't set.
101
101
if UserDefaults . enablePluginManagerLogging || [ . error, . warning] . contains ( diagnostic. behavior) {
102
102
delegate. emit ( diagnostic)
@@ -106,7 +106,7 @@ public final class Core: Sendable {
106
106
#if !USE_STATIC_PLUGIN_INITIALIZATION
107
107
// In a package context, plugins are statically linked into the build system.
108
108
// Load specs from service plugins if requested since we don't have a Service in certain tests
109
- await extraPluginRegistration ( core. pluginPaths)
109
+ await extraPluginRegistration ( core. pluginManager , core . pluginPaths)
110
110
#endif
111
111
112
112
await core. initializeSpecRegistry ( )
@@ -167,7 +167,7 @@ public final class Core: Sendable {
167
167
/// The host operating system.
168
168
public let hostOperatingSystem : OperatingSystem
169
169
170
- public let pluginManager : PluginManager
170
+ public let pluginManager : any PluginManager
171
171
172
172
public enum DeveloperPath : Sendable , Hashable {
173
173
// A path to an Xcode install's "/Contents/Developer" directory
@@ -220,7 +220,7 @@ public final class Core: Sendable {
220
220
221
221
public let connectionMode : ServiceHostConnectionMode
222
222
223
- @_spi ( Testing) public init ( delegate: any CoreDelegate , hostOperatingSystem: OperatingSystem , pluginManager: PluginManager , developerPath: DeveloperPath , resourceSearchPaths: [ Path ] , inferiorProductsPath: Path ? , additionalContentPaths: [ Path ] , environment: [ String : String ] , buildServiceModTime: Date , connectionMode: ServiceHostConnectionMode ) async throws {
223
+ @_spi ( Testing) public init ( delegate: any CoreDelegate , hostOperatingSystem: OperatingSystem , pluginManager: any PluginManager , developerPath: DeveloperPath , resourceSearchPaths: [ Path ] , inferiorProductsPath: Path ? , additionalContentPaths: [ Path ] , environment: [ String : String ] , buildServiceModTime: Date , connectionMode: ServiceHostConnectionMode ) async throws {
224
224
self . delegate = delegate
225
225
self . hostOperatingSystem = hostOperatingSystem
226
226
self . pluginManager = pluginManager
@@ -739,7 +739,7 @@ struct CoreRegistryDelegate : PlatformRegistryDelegate, SDKRegistryDelegate, Spe
739
739
return specRegistry. internalMacroNamespace
740
740
}
741
741
742
- var pluginManager : PluginManager {
742
+ var pluginManager : any PluginManager {
743
743
core. pluginManager
744
744
}
745
745
0 commit comments