Plugin
Defines functionality common to all SwiftPM plugins, such as the way to instantiate the plugin.
Protocols.swift:20protocol Plugin
A future improvement to SwiftPM would be to allow usage of a plugin to also provide configuration parameters for that plugin. A proposal that adds such a facility should also add initializers to set those values as plugin properties.
Requirements
Type members
init(
) Instantiates the plugin. This happens once per invocation of the plugin; there is no facility for keeping in-memory state from one invocation to the next. Most plugins do not need to implement the initializer.
Citizens in PackagePlugin
Type members
static func main(
) async throws Main entry point of the plugin — sets up a communication channel with the plugin host and runs the main message loop.
Subtypes
protocol BuildToolPlugin
Defines functionality for all plugins having a
buildTool
capability.protocol CommandPlugin
Defines functionality for all plugins that have a
command
capability.