Class SmithyExtension

java.lang.Object
software.amazon.smithy.gradle.SmithyExtension

public abstract class SmithyExtension extends Object
Gradle configuration settings for Smithy plugins.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SmithyExtension(org.gradle.api.Project project, org.gradle.api.model.ObjectFactory objectFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.provider.Property<Boolean>
    Gets whether unknown traits in the model should be ignored.
    abstract org.gradle.api.provider.Property<Boolean>
    Gets whether to fork when running the Smithy CLI.
    abstract org.gradle.api.provider.Property<Boolean>
    Gets whether to execute the format task on files in the Smithy source set
    abstract org.gradle.api.file.DirectoryProperty
    Gets the output directory for running Smithy build.
    org.gradle.api.provider.Provider<Path>
    getPluginProjectionPath(String projection, String plugin)
    Convenience method to get the directory containing plugin artifacts.
    abstract org.gradle.api.provider.SetProperty<String>
    Get the tags that are searched for in classpaths when determining which models are projected into the created JAR.
    abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection>
    Gets a collection of smithy-build.json files to use when building the model.
    abstract org.gradle.api.provider.Property<String>
    Gets the projection name in use by the extension as the source (primary) projection.
    org.gradle.api.NamedDomainObjectContainer<SmithySourceDirectorySet>
    Collection of SourceDirectorySet associated with the SmithyExtension.
    abstract org.gradle.api.provider.SetProperty<String>
    Get the tags that are added to the JAR.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SmithyExtension

      @Inject public SmithyExtension(org.gradle.api.Project project, org.gradle.api.model.ObjectFactory objectFactory)
  • Method Details

    • getSourceSets

      public org.gradle.api.NamedDomainObjectContainer<SmithySourceDirectorySet> getSourceSets()
      Collection of SourceDirectorySet associated with the SmithyExtension.
      Returns:
      container containing SourceDirectorySets associated with SmithyExtension.
    • getFormat

      public abstract org.gradle.api.provider.Property<Boolean> getFormat()
      Gets whether to execute the format task on files in the Smithy source set

      By default formatting is run on all `.smithy` files in the Smithy source set.

    • getSmithyBuildConfigs

      public abstract org.gradle.api.provider.Property<org.gradle.api.file.FileCollection> getSmithyBuildConfigs()
      Gets a collection of smithy-build.json files to use when building the model.
      Returns:
      Returns the collection of build configurations.
    • getSourceProjection

      public abstract org.gradle.api.provider.Property<String> getSourceProjection()
      Gets the projection name in use by the extension as the source (primary) projection.
      Returns:
      Returns the projection name. Defaults to "source".
    • getProjectionSourceTags

      public abstract org.gradle.api.provider.SetProperty<String> getProjectionSourceTags()
      Get the 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 buildscript 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.

      Returns:
      Returns the tags. This will never return null.
    • getTags

      public abstract org.gradle.api.provider.SetProperty<String> getTags()
      Get the tags that are added to the JAR.

      These tags are placed in the META-INF/MANIFEST.MF attribute named "Smithy-Tags" as a comma separated list. JARs with Smithy-Tags can be queried when building projections so that the Smithy models found in each matching JAR are placed into the projection JAR.

      Returns:
      Returns the Smithy-Tags values that will be added to the created JAR.
    • getAllowUnknownTraits

      public abstract org.gradle.api.provider.Property<Boolean> getAllowUnknownTraits()
      Gets whether unknown traits in the model should be ignored.

      By default, the build will fail if unknown traits are encountered. This can be set to true to allow unknown traits to pass through the model and be loaded as a DynamicTrait.

      Returns:
      Returns true if unknown traits are allowed.
    • getFork

      public abstract org.gradle.api.provider.Property<Boolean> getFork()
      Gets whether to fork when running the Smithy CLI.

      By default, the CLI is run in the same process as Gradle, but inside a thread with a custom class loader. This should work in most cases, but there is an option to run inside a process if necessary.

      Returns:
      Returns true if the CLI should fork.
    • getOutputDirectory

      public abstract org.gradle.api.file.DirectoryProperty getOutputDirectory()
      Gets the output directory for running Smithy build.
      Returns:
      Returns the output directory.
    • getPluginProjectionPath

      public org.gradle.api.provider.Provider<Path> getPluginProjectionPath(String projection, String plugin)
      Convenience method to get the directory containing plugin artifacts.
      Parameters:
      projection - projection name
      plugin - name of plugin to get artifact directory for
      Returns:
      path to plugin artifact directory