PluginModule
PluginModule.swift:16final class PluginModule
final class PluginModule
import PackageModel
class Module
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
init(name: String, sources: Sources, apiVersion: ToolsVersion, pluginCapability: PluginCapability, dependencies: [Module.Dependency] = [], packageAccess: Bool)
override class var typeDescription: String { get }
Description of the module type used in swift package describe
output. Preserved for backwards compatibility.
let apiVersion: ToolsVersion
API version to use for PackagePlugin API availability.
let capability: PluginCapability
Declared capability of the plugin.
import SPMBuildCore
func dependencies(satisfying environment: BuildEnvironment) -> [Dependency]
func invoke(action: PluginAction, buildEnvironment: BuildEnvironment, scriptRunner: PluginScriptRunner, workingDirectory: AbsolutePath, outputDirectory: AbsolutePath, toolSearchDirectories: [AbsolutePath], accessibleTools: [String : (path: AbsolutePath, triples: [String]?)], writableDirectories: [AbsolutePath], readOnlyDirectories: [AbsolutePath], allowNetworkConnections: [SandboxNetworkPermission], pkgConfigDirectories: [AbsolutePath], sdkRootPath: AbsolutePath?, fileSystem: FileSystem, modulesGraph: ModulesGraph, observabilityScope: ObservabilityScope, callbackQueue: DispatchQueue, delegate: PluginInvocationDelegate) async throws -> Bool
func invoke(action: PluginAction, buildEnvironment: BuildEnvironment, scriptRunner: PluginScriptRunner, workingDirectory: AbsolutePath, outputDirectory: AbsolutePath, toolSearchDirectories: [AbsolutePath], accessibleTools: [String : (path: AbsolutePath, triples: [String]?)], writableDirectories: [AbsolutePath], readOnlyDirectories: [AbsolutePath], allowNetworkConnections: [SandboxNetworkPermission], pkgConfigDirectories: [AbsolutePath], sdkRootPath: AbsolutePath?, fileSystem: FileSystem, modulesGraph: ModulesGraph, observabilityScope: ObservabilityScope, callbackQueue: DispatchQueue, delegate: PluginInvocationDelegate, completion: @escaping (Result<Bool, Error>) -> Void)
Invokes the plugin by compiling its source code (if needed) and then running it as a subprocess. The specified plugin action determines which entry point is called in the subprocess, and the package and the tool mapping determine the context that is available to the plugin.
func processAccessibleTools(packageGraph: ModulesGraph, fileSystem: FileSystem, environment: BuildEnvironment, for hostTriple: Triple, builtToolHandler: (_ name: String, _ path: RelativePath) throws -> AbsolutePath?) throws -> [String : (path: AbsolutePath, triples: [String]?)]