@@ -40,9 +40,9 @@ public final class Core: Sendable {
4040 /// Get a configured instance of the core.
4141 ///
4242 /// - 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? {
4444 // Enable macro expression interning during loading.
45- return await MacroNamespace.withExpressionInterningEnabled {
45+ return await MacroNamespace.withExpressionInterningEnabled { () -> Core? in
4646 let hostOperatingSystem: OperatingSystem
4747 do {
4848 hostOperatingSystem = try ProcessInfo.processInfo.hostOperatingSystem()
@@ -56,7 +56,7 @@ public final class Core: Sendable {
5656 // Load specs from service plugins if requested since we don't have a Service in certain tests
5757 // Here we don't have access to `core.pluginPaths` like we do in the call below,
5858 // 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, [])
6060 #endif
6161
6262 let resolvedDeveloperPath: DeveloperPath
@@ -83,20 +83,20 @@ public final class Core: Sendable {
8383
8484 let core: Core
8585 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)
8787 } catch {
8888 delegate.error("\(error)")
8989 return nil
9090 }
9191
9292 if UserDefaults.enablePluginManagerLogging {
93- let plugins = await core.pluginManager.pluginsByIdentifier
93+ let plugins = core.pluginManager.pluginsByIdentifier
9494 delegate.emit(Diagnostic(behavior: .note, location: .unknown, data: DiagnosticData("Loaded \(plugins.count) plugins"), childDiagnostics: plugins.sorted(byKey: <).map { (identifier, plugin) in
9595 Diagnostic(behavior: .note, location: .path(plugin.path), data: DiagnosticData("Loaded plugin: \(identifier) from \(plugin.path.str)"))
9696 }))
9797 }
9898
99- for diagnostic in await core.pluginManager.loadingDiagnostics {
99+ for diagnostic in core.pluginManager.loadingDiagnostics {
100100 // Only emit "severe" diagnostics (warning, error) from the plugin manager if the logging dwrite isn't set.
101101 if UserDefaults.enablePluginManagerLogging || [.error, .warning].contains(diagnostic.behavior) {
102102 delegate.emit(diagnostic)
@@ -106,7 +106,7 @@ public final class Core: Sendable {
106106 #if !USE_STATIC_PLUGIN_INITIALIZATION
107107 // In a package context, plugins are statically linked into the build system.
108108 // 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)
110110 #endif
111111
112112 await core.initializeSpecRegistry()
@@ -167,7 +167,7 @@ public final class Core: Sendable {
167167 /// The host operating system.
168168 public let hostOperatingSystem: OperatingSystem
169169
170- public let pluginManager: PluginManager
170+ public let pluginManager: any PluginManager
171171
172172 public enum DeveloperPath: Sendable, Hashable {
173173 // A path to an Xcode install's "/Contents/Developer" directory
@@ -220,7 +220,7 @@ public final class Core: Sendable {
220220
221221 public let connectionMode: ServiceHostConnectionMode
222222
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 {
224224 self.delegate = delegate
225225 self.hostOperatingSystem = hostOperatingSystem
226226 self.pluginManager = pluginManager
@@ -739,7 +739,7 @@ struct CoreRegistryDelegate : PlatformRegistryDelegate, SDKRegistryDelegate, Spe
739739 return specRegistry.internalMacroNamespace
740740 }
741741
742- var pluginManager: PluginManager {
742+ var pluginManager: any PluginManager {
743743 core.pluginManager
744744 }
745745
0 commit comments