Class SmithyJarStagingTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
software.amazon.smithy.gradle.tasks.SmithyJarStagingTask
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>

@DisableCachingByDefault(because="Staging is a cheap copy of build outputs and is not worth caching") public abstract class SmithyJarStagingTask extends org.gradle.api.DefaultTask
Stages Smithy source files and manifest generated by the sources plugin into the correct file structure for inclusion in a JAR as resources.

The smithy source files and smithy manifest file are expected to exist at META-INF/smithy/* within a JAR in order to be discoverable by the Smithy CLI.

The temporary staging directory created by this task is named staging-$TaskName in order to ensure that multiple staging tasks can be run without naming collisions.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    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

    Constructors
    Constructor
    Description
    SmithyJarStagingTask(org.gradle.api.file.FileSystemOperations fileSystemOperations, org.gradle.api.file.ProjectLayout projectLayout)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    abstract org.gradle.api.file.DirectoryProperty
    Input directory containing the smithy build artifacts to use for staging.
    abstract org.gradle.api.file.DirectoryProperty
    Output Directory of the task.
    abstract org.gradle.api.provider.Property<String>
    Projection to stage sources for.
    org.gradle.api.provider.Provider<File>
    Get the staged source directory.
    org.gradle.api.provider.Provider<File>
    Get the smithy staging directory path without the wrapping META-INF directory.

    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, usesService

    Methods 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, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • SmithyJarStagingTask

      @Inject public SmithyJarStagingTask(org.gradle.api.file.FileSystemOperations fileSystemOperations, org.gradle.api.file.ProjectLayout projectLayout)
  • Method Details

    • getInputDirectory

      @InputDirectory @PathSensitive(RELATIVE) public abstract org.gradle.api.file.DirectoryProperty getInputDirectory()
      Input directory containing the smithy build artifacts to use for staging.

      This should almost always be the output directory of a SmithyBuildTask.

    • getProjection

      @Input public abstract org.gradle.api.provider.Property<String> getProjection()
      Projection to stage sources for.

      Defaults to "source".

      Note: The projection must exist in one of the smithy-build configs used to generate the input directory.

    • getOutputDir

      @Internal public abstract org.gradle.api.file.DirectoryProperty getOutputDir()
      Output Directory of the task.

      Note: Marked as internal so that it is not checked for caching, although it can be used as an input property.

    • getSmithyStagingDir

      @OutputDirectory public org.gradle.api.provider.Provider<File> getSmithyStagingDir()
      Get the smithy staging directory path without the wrapping META-INF directory.

      This output should be used when including staging directory as a metaInf file for a jar task. For example:

        tasks.register("MyJarTask") {
           // Include the staged files as a metaInf resource
           metaInf.from(stagingTask.smithyStagingDir.get())
           // Other inputs for the jar task
        }
       
    • getSmithyMetaInfDir

      @OutputDirectory public org.gradle.api.provider.Provider<File> getSmithyMetaInfDir()
      Get the staged source directory.

      This output should be used when including the staging directory in the resource sourceSet for a project.

    • copyModelsToStaging

      public void copyModelsToStaging()