Class SmithyBuildTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
build command.
This task will build all projections specified in the smithy-build configs provided as task inputs.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.gradle.api.model.ObjectFactoryObject factory used to create new gradle domain objects such asFileCollections.Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionSmithyBuildTask(org.gradle.api.model.ObjectFactory objectFactory, org.gradle.StartParameter startParameter) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureLoggingOptions(List<String> args) Add --stacktrace and --logging settings based on Gradle's settings.voidexecute()protected voidexecuteCliProcess(String command, List<String> additionalArgs, org.gradle.api.file.FileCollection sources, boolean disableModelDiscovery) Executes the given CLI command.abstract org.gradle.api.provider.Property<Boolean>Sets whether to fail a Smithy CLI task if an unknown trait is encountered.abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection>Classpath to use for build dependencies.abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection>Base classpath used for executing the smithy cli.abstract org.gradle.api.provider.Property<Boolean>getFork()Whether to fork a new process for executing the smithy cli.abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection>Classpath used for discovery of additional Smithy models during cli execution.abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection>Gets the list of models to execute a CLI command on.abstract org.gradle.api.file.DirectoryPropertyOutput directory for Smithy build artifacts.org.gradle.api.provider.Provider<org.gradle.api.file.Directory>getPluginProjectionDirectory(String projection, String plugin) Convenience method to get the directory containing plugin artifacts.abstract org.gradle.api.provider.SetProperty<String>Tags that are searched for in classpaths when determining which models are projected into the created JAR.abstract org.gradle.api.provider.Property<String>Set the minimum reported validation severity.abstract org.gradle.api.provider.Property<org.gradle.api.logging.configuration.ShowStacktrace>Sets the detail to include in stack traces.abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection>Smithy build configs to use for building models.abstract org.gradle.api.provider.Property<String>Projection to treat as the "source" or primary projection.protected voidwriteHeading(String text) Writes header-formatted text to the build output.Methods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Field Details
-
objectFactory
protected final org.gradle.api.model.ObjectFactory objectFactoryObject factory used to create new gradle domain objects such asFileCollections.
-
-
Constructor Details
-
SmithyBuildTask
@Inject public SmithyBuildTask(org.gradle.api.model.ObjectFactory objectFactory, org.gradle.StartParameter startParameter)
-
-
Method Details
-
getProjectionSourceTags
@Input @Optional public abstract org.gradle.api.provider.SetProperty<String> getProjectionSourceTags()Tags that are searched for in classpaths when determining which models are projected into the created JAR.This plugin will look through the JARs in the discovery classpath to see if they contain a META-INF/MANIFEST.MF attribute named "Smithy-Tags" that matches any of the given projection source tags. The Smithy models found in each matching JAR are copied into the JAR being projected. This allows a projection JAR to aggregate models into a single JAR.
-
getSmithyBuildConfigs
@InputFiles @PathSensitive(RELATIVE) public abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection> getSmithyBuildConfigs()Smithy build configs to use for building models.- Returns:
- list of smithy-build config json files
-
getSourceProjection
Projection to treat as the "source" or primary projection. -
getOutputDir
@OutputDirectory @Optional public abstract org.gradle.api.file.DirectoryProperty getOutputDir()Output directory for Smithy build artifacts. -
getSeverity
Set the minimum reported validation severity.This value should be one of: NOTE, WARNING [default], DANGER, ERROR.
- Returns:
- minimum validator severity
-
execute
public void execute() -
getPluginProjectionDirectory
public org.gradle.api.provider.Provider<org.gradle.api.file.Directory> getPluginProjectionDirectory(String projection, String plugin) Convenience method to get the directory containing plugin artifacts.- Parameters:
projection- projection nameplugin- name of plugin to get artifact directory for- Returns:
- provider for the plugin artifact directory
-
getCliClasspath
@Classpath public abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection> getCliClasspath()Base classpath used for executing the smithy cli.Note: this classpath must contain the smithy-cli jar.
-
getAllowUnknownTraits
Sets whether to fail a Smithy CLI task if an unknown trait is encountered.Defaults to
false- Returns:
- flag indicating state of allowUnknownTraits setting
-
getModelDiscoveryClasspath
@Classpath @Optional public abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection> getModelDiscoveryClasspath()Classpath used for discovery of additional Smithy models during cli execution.Defaults to an empty collection.
-
getBuildClasspath
@Classpath @Optional public abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection> getBuildClasspath()Classpath to use for build dependencies. -
getModels
@InputFiles @Optional @PathSensitive(RELATIVE) public abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection> getModels()Gets the list of models to execute a CLI command on.These models are also considered "sources" when building a JAR for a project. A source model is a model that appears in the
META-INF/smithydirectory of a JAR.This method will return an empty
FileCollectionand nevernull.- Returns:
- Returns the models to validate.
-
getFork
Whether to fork a new process for executing the smithy cli.If false, the smithy cli will be executed in a new thread instead of a new process
Defaults to
false- Returns:
- flag indicating fork setting.
-
getShowStackTrace
@Input @Optional public abstract org.gradle.api.provider.Property<org.gradle.api.logging.configuration.ShowStacktrace> getShowStackTrace()Sets the detail to include in stack traces.Defaults to
ShowStacktrace.INTERNAL_EXCEPTIONS- Returns:
- stack trace setting.
-
executeCliProcess
protected void executeCliProcess(String command, List<String> additionalArgs, org.gradle.api.file.FileCollection sources, boolean disableModelDiscovery) Executes the given CLI command.This method will take care of adding --discover, --discover-classpath, and --allow-unknown-traits.
- Parameters:
command- The command to execute.additionalArgs- Custom arguments that aren't one of the shared args.sources- Source files to execute the command on
-
writeHeading
Writes header-formatted text to the build output.- Parameters:
text- text to write as a header.
-
configureLoggingOptions
Add --stacktrace and --logging settings based on Gradle's settings.
-