Package org.gradle.plugins.signing

## Class Sign

- java.lang.Object
- - org.gradle.api.internal.AbstractTask
  - - org.gradle.api.DefaultTask
    - - org.gradle.plugins.signing.Sign

- All Implemented Interfaces:
    `java.lang.Comparable<Task>`, `org.gradle.api.internal.DynamicObjectAware`, `org.gradle.api.internal.TaskInternal`, `ExtensionAware`, `Task`, `SignatureSpec`, `Configurable<Task>`

      @DisableCachingByDefault(because="Not made cacheable, yet")
      public class Sign
      extends DefaultTask
      implements SignatureSpec

  A task for creating digital signature files for one or more; tasks, files, publishable artifacts or configurations.

  The task produces `Signature`

  objects that are publishable artifacts and can be assigned to another configuration.

  The signature objects are created with defaults and using this tasks signatory and signature type.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.gradle.api.Task

      `Task.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
    --- | ---
    `Sign()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `generate()` | Generates the signature files.
    `protected org.gradle.api.internal.CollectionCallbackActionDecorator` | `getCallbackActionDecorator()` | Required for decorating reports container callbacks for tracing user code application.
    `protected org.gradle.api.internal.file.FileCollectionFactory` | `getFileCollectionFactory()` |
    `FileCollection` | `getFilesToSign()` | All of the files that will be signed by this task.
    `Signatory` | `getSignatory()` | Returns the signatory for this signing task.
    `FileCollection` | `getSignatureFiles()` | All of the signature files that will be generated by this operation.
    `DomainObjectSet<Signature>` | `getSignatures()` | The signatures generated by this task.
    `java.util.Map<java.lang.String,​Signature>` | `getSignaturesByKey()` | The signatures generated by this task mapped by a unique key used for up-to-date checking.
    `SignatureType` | `getSignatureType()` | The signature representation that will be created.
    `Signature` | `getSingleSignature()` | Returns the single signature generated by this task.
    `boolean` | `isRequired()` | Whether or not this task should fail if no signatory or signature type are configured at generation time.
    `void` | `required​(boolean required)` | Change whether or not this task should fail if no signatory or signature type are configured at the time of generation.
    `void` | `setRequired​(boolean required)` | Whether or not it is required that this signature be generated.
    `void` | `setSignatory​(Signatory signatory)` | Sets the signatory that will be signing the input.
    `void` | `setSignatureType​(SignatureType signatureType)` | Sets the signature representation that the signatures will be produced as.
    `void` | `sign​(java.io.File... files)` | Configures the task to sign each of the given files
    `void` | `sign​(java.lang.String classifier, java.io.File... files)` | Configures the task to sign each of the given artifacts, using the given classifier as the classifier for the resultant signature publish artifact.
    `void` | `sign​(Configuration... configurations)` | Configures the task to sign every artifact of the given configurations
    `void` | `sign​(PublishArtifact... publishArtifacts)` | Configures the task to sign each of the given artifacts
    `void` | `sign​(Publication... publications)` | Configures the task to sign every artifact of the given publications
    `void` | `sign​(Task... tasks)` | Configures the task to sign the archive produced for each of the given tasks (which must be archive tasks).
    `void` | `signatory​(Signatory signatory)` | Changes the signatory of the signatures.

    - ### 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

      `appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, 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, getConvention, notCompatibleWithConfigurationCache`

- - ### Constructor Detail

    - #### Sign

          @Inject
          public Sign()

  - ### Method Detail

    - #### sign

          public void sign​(Task... tasks)

      Configures the task to sign the archive produced for each of the given tasks (which must be archive tasks).

    - #### sign

          public void sign​(PublishArtifact... publishArtifacts)

      Configures the task to sign each of the given artifacts

    - #### sign

          public void sign​(java.io.File... files)

      Configures the task to sign each of the given files

    - #### sign

          public void sign​(java.lang.String classifier,
                           java.io.File... files)

      Configures the task to sign each of the given artifacts, using the given classifier as the classifier for the resultant signature publish artifact.

    - #### sign

          public void sign​(Configuration... configurations)

      Configures the task to sign every artifact of the given configurations

    - #### sign

          public void sign​(Publication... publications)

      Configures the task to sign every artifact of the given publications
      Since:
        4.8

    - #### signatory

          public void signatory​(Signatory signatory)

      Changes the signatory of the signatures.

    - #### required

          public void required​(boolean required)

      Change whether or not this task should fail if no signatory or signature type are configured at the time of generation.

    - #### generate

          public void generate()

      Generates the signature files.

    - #### getSignatures

          @Internal
          public DomainObjectSet<Signature> getSignatures()

      The signatures generated by this task.

    - #### getSignaturesByKey

          public java.util.Map<java.lang.String,​Signature> getSignaturesByKey()

      The signatures generated by this task mapped by a unique key used for up-to-date checking.
      Since:
        5.1

    - #### getSingleSignature

          @Internal
          public Signature getSingleSignature()

      Returns the single signature generated by this task.
      Returns:
        The signature.
      Throws:
        `java.lang.IllegalStateException` - if there is not exactly one signature.

    - #### getFileCollectionFactory

          @Inject
          protected org.gradle.api.internal.file.FileCollectionFactory getFileCollectionFactory()

    - #### getFilesToSign

          @Internal
          public FileCollection getFilesToSign()

      All of the files that will be signed by this task.

    - #### getSignatureFiles

          @Internal
          public FileCollection getSignatureFiles()

      All of the signature files that will be generated by this operation.

    - #### getSignatureType

          @Optional
          public SignatureType getSignatureType()

      Description copied from interface: `SignatureSpec`
      The signature representation that will be created.
      Specified by:
        `getSignatureType` in interface `SignatureSpec`
      Returns:
        the signature type, or `null` if none specified.

    - #### setSignatureType

          public void setSignatureType​(SignatureType signatureType)

      Description copied from interface: `SignatureSpec`
      Sets the signature representation that the signatures will be produced as.
      Specified by:
        `setSignatureType` in interface `SignatureSpec`
      Parameters:
        `signatureType` - the signature type to use

    - #### getSignatory

          @Optional
          public Signatory getSignatory()

      Returns the signatory for this signing task.
      Specified by:
        `getSignatory` in interface `SignatureSpec`
      Returns:
        the signatory

    - #### setSignatory

          public void setSignatory​(Signatory signatory)

      Description copied from interface: `SignatureSpec`
      Sets the signatory that will be signing the input.
      Specified by:
        `setSignatory` in interface `SignatureSpec`
      Parameters:
        `signatory` - The signatory

    - #### isRequired

          @Input
          public boolean isRequired()

      Whether or not this task should fail if no signatory or signature type are configured at generation time.

      Defaults to `true`.

      Specified by:
        `isRequired` in interface `SignatureSpec`
      Returns:
        Whether or not it is required that this signature be generated.

    - #### setRequired

          public void setRequired​(boolean required)

      Description copied from interface: `SignatureSpec`
      Whether or not it is required that this signature be generated.
      Specified by:
        `setRequired` in interface `SignatureSpec`
      Parameters:
        `required` - Whether or not it is required that this signature be generated.
      See Also:
        `SignatureSpec.isRequired()`

    - #### getCallbackActionDecorator

          @Inject
          protected org.gradle.api.internal.CollectionCallbackActionDecorator getCallbackActionDecorator()

      Required for decorating reports container callbacks for tracing user code application.
      Since:
        5.1