Package software.amazon.smithy.build
Interface SmithyBuildPlugin
-
- All Known Implementing Classes:
BuildInfoPlugin
,ConfigurableSmithyBuildPlugin
,ModelPlugin
,NullabilityReportPlugin
,RunPlugin
,Smithy2Cfn
,Smithy2OpenApi
,SourcesPlugin
,TraitCodegenPlugin
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 providedPluginContext
via thePluginContext.getFileManifest()
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static java.util.function.Function<java.lang.String,java.util.Optional<SmithyBuildPlugin>>
createServiceFactory()
Creates a SmithyBuildPlugin factory function using SPI and the current Thread's context class loader.static java.util.function.Function<java.lang.String,java.util.Optional<SmithyBuildPlugin>>
createServiceFactory(java.lang.ClassLoader classLoader)
Creates a SmithyBuildPlugin factory function using SPI.static java.util.function.Function<java.lang.String,java.util.Optional<SmithyBuildPlugin>>
createServiceFactory(java.lang.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.java.lang.String
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
requiresValidModel()
Plugins can choose whether or not to create artifacts based on whether or not the projection encountered error or unsuppressed danger events.
-
-
-
Method Detail
-
getName
java.lang.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
void execute(PluginContext context)
Executes the plugin, creating any number of artifacts.- Parameters:
context
- Plugin context for build execution.
-
createServiceFactory
static java.util.function.Function<java.lang.String,java.util.Optional<SmithyBuildPlugin>> createServiceFactory(java.lang.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
static java.util.function.Function<java.lang.String,java.util.Optional<SmithyBuildPlugin>> createServiceFactory()
Creates a SmithyBuildPlugin factory function using SPI and the current Thread's context class loader.- Returns:
- Returns the created factory function.
- See Also:
Thread.getContextClassLoader()
-
createServiceFactory
static java.util.function.Function<java.lang.String,java.util.Optional<SmithyBuildPlugin>> createServiceFactory(java.lang.ClassLoader classLoader)
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.
-
-