Package software.amazon.smithy.build
Interface SmithyBuildPlugin
- All Known Implementing Classes:
BuildInfoPlugin
,ConfigurableSmithyBuildPlugin
,ModelPlugin
,NullabilityReportPlugin
,RunPlugin
,Smithy2Cfn
,Smithy2OpenApi
,SourcesPlugin
public interface SmithyBuildPlugin
Plugin extension class for SmithyBuild.
Plugins are used to contribute artifacts to SmithyBuild by writing
files to the FileManifest
stored in the provided
PluginContext
via the PluginContext.getFileManifest()
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Function<String,
Optional<SmithyBuildPlugin>> Creates a SmithyBuildPlugin factory function using SPI and the current Thread's context class loader.static Function<String,
Optional<SmithyBuildPlugin>> createServiceFactory
(ClassLoader classLoader) Creates a SmithyBuildPlugin factory function using SPI.static Function<String,
Optional<SmithyBuildPlugin>> createServiceFactory
(Iterable<SmithyBuildPlugin> plugins) Creates a factory function used that creates SmithyBuildPlugins using a list of resolved plugins.void
execute
(PluginContext context) Executes the plugin, creating any number of artifacts.getName()
Gets the name of the plugin.default boolean
isSerial()
Plugins can choose whether or not projections they are in can be run in parallel with other projections.default boolean
Plugins can choose whether or not to create artifacts based on whether or not the projection encountered error or unsuppressed danger events.
-
Method Details
-
getName
String getName()Gets the name of the plugin.- Returns:
- Returns the name (e.g., "MyPlugin").
-
requiresValidModel
default boolean requiresValidModel()Plugins can choose whether or not to create artifacts based on whether or not the projection encountered error or unsuppressed danger events.By default plugins require that there are no errors or danger events for a given projected model.
- Returns:
- Returns true if the plugin should only be called if there are no error or unsuppressed danger violations for the projection.
-
isSerial
default boolean isSerial()Plugins can choose whether or not projections they are in can be run in parallel with other projections.By default plugins allow parallel execution.
- Returns:
- Returns true if the plugin should be run serially, false if it can be run in parallel with other plugins.
-
execute
Executes the plugin, creating any number of artifacts.- Parameters:
context
- Plugin context for build execution.
-
createServiceFactory
static Function<String,Optional<SmithyBuildPlugin>> createServiceFactory(Iterable<SmithyBuildPlugin> plugins) Creates a factory function used that creates SmithyBuildPlugins using a list of resolved plugins.- Parameters:
plugins
- Plugins to lookup by name in the factory function.- Returns:
- Returns the created factory function.
-
createServiceFactory
Creates a SmithyBuildPlugin factory function using SPI and the current Thread's context class loader.- Returns:
- Returns the created factory function.
- See Also:
-
createServiceFactory
Creates a SmithyBuildPlugin factory function using SPI.This factory is used in
SmithyBuild
to create plugins from configuration names.- Parameters:
classLoader
- Class loader used to find plugin implementations.- Returns:
- Returns the created factory function.
-