Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## org.gradle.plugins.signing
[Groovy] Class Signature

    java.lang.Object
      org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact
          org.gradle.plugins.signing.Signature

    class Signature
    extends org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact

A digital signature file artifact.

A signature file is always generated from another file, which may be a PublishArtifact.

Property Summary
`java.lang.String` | `classifier` The classifier of the signature artifact.
`java.util.Date` | `date` The date of the signature arifact.
`java.lang.String` | `extension` The extension of the signature artifact.
`java.io.File` | `file` The signature file.
`java.lang.String` | `name` The name of the signature artifact.
`SignatureSpec` | `signatureSpec` The specification of how to generate the signature.
`PublishArtifact` | `toSignArtifact` The artifact that this signature is for, which may be `null` if this signature is not for an artifact.
`java.lang.String` | `type` The type of the signature artifact.

Constructor Summary
`Signature(PublishArtifact toSign, SignatureSpec signatureSpec, java.lang.Object... tasks)` Creates a signature artifact for the given public artifact.
`Signature(java.io.File toSign, SignatureSpec signatureSpec, java.lang.Object... tasks)` Creates a signature artifact for the given file.
`Signature(java.io.File toSign, java.lang.String classifier, SignatureSpec signatureSpec, java.lang.Object... tasks)` Creates a signature artifact for the given file, with the given classifier.
`Signature(groovy.lang.Closure toSign, groovy.lang.Closure classifier, SignatureSpec signatureSpec, java.lang.Object... tasks)` Creates a signature artifact for the file returned by the `toSign` closure.

Method Summary
`void` | `generate()` Generates the signature file.
`java.lang.String` | `getClassifier()` The classifier of the signature artifact.
`java.util.Date` | `getDate()` The date of the signature artifact.
`java.lang.String` | `getExtension()` The extension of the signature artifact.
`java.io.File` | `getFile()` The file for the generated signature, which may not yet exist.
`java.lang.String` | `getName()` The name of the signature artifact.
`Signatory` | `getSignatory()` The signatory of this signature file.
`SignatureType` | `getSignatureType()` The file representation type of the signature.
`java.io.File` | `getToSign()` The file that is to be signed.
`java.lang.String` | `getType()` The type of the signature artifact.

Methods inherited from class org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact
org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#toString(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#getBuildDependencies(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#builtBy([Ljava.lang.Object;), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#wait(long), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#wait(long, int), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#wait(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#equals(java.lang.Object), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#hashCode(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#getClass(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#notify(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#notifyAll(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#getName(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#getType(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#getFile(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#getDate(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#getExtension(), org.gradle.api.internal.artifacts.publish.AbstractPublishArtifact#getClassifier()

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Property Detail

### classifier

    java.lang.String classifier

  The classifier of the signature artifact.
  See Also:
    getClassifier()

### date

    java.util.Date date

  The date of the signature arifact.
  See Also:
    getDate()

### extension

    java.lang.String extension

  The extension of the signature artifact.
  See Also:
    getExtension()

### file

    java.io.File file

  The signature file.
  See Also:
    getFile()

### name

    java.lang.String name

  The name of the signature artifact.
  See Also:
    getName()

### signatureSpec

    SignatureSpec signatureSpec

  The specification of how to generate the signature.

### toSignArtifact

    final PublishArtifact toSignArtifact

  The artifact that this signature is for, which may be `null` if this signature is not for an artifact.

### type

    java.lang.String type

  The type of the signature artifact.
  See Also:
    getType()

Constructor Detail

### Signature

    Signature(PublishArtifact toSign, SignatureSpec signatureSpec, java.lang.Object... tasks)

  Creates a signature artifact for the given public artifact.

  The file to sign will be the file of the given artifact and the classifier of this signature artifact will default to the classifier of the given artifact to sign.

  The artifact to sign may change after being used as the source for this signature.

  Parameters:
    `toSign` - The artifact that is to be signed
    `signatureSpec` - The specification of how the artifact is to be signed
    `tasks` - The task(s) that will invoke generate() on this signature (optional)

### Signature

    Signature(java.io.File toSign, SignatureSpec signatureSpec, java.lang.Object... tasks)

  Creates a signature artifact for the given file.
  Parameters:
    `toSign` - The file that is to be signed
    `signatureSpec` - The specification of how the artifact is to be signed
    `tasks` - The task(s) that will invoke generate() on this signature (optional)

### Signature

    Signature(java.io.File toSign, java.lang.String classifier, SignatureSpec signatureSpec, java.lang.Object... tasks)

  Creates a signature artifact for the given file, with the given classifier.
  Parameters:
    `toSign` - The file that is to be signed
    `classifier` - The classifier to assign to the signature (should match the files)
    `signatureSpec` - The specification of how the artifact is to be signed
    `tasks` - The task(s) that will invoke generate() on this signature (optional)

### Signature

    Signature(groovy.lang.Closure toSign, groovy.lang.Closure classifier, SignatureSpec signatureSpec, java.lang.Object... tasks)

  Creates a signature artifact for the file returned by the `toSign` closure.

  The closures will be “evaluated” on demand whenever the value is needed (e.g. at generation time)

  Parameters:
    `toSign` - A closure that produces a File for the object to sign (non File return values will be used as the path to the file)
    `classifier` - A closure that produces the classifier to assign to the signature artifact on demand
    `signatureSpec` - The specification of how the artifact is to be signed
    `tasks` - The task(s) that will invoke generate() on this signature (optional)

Method Detail

### generate

    void generate()

  Generates the signature file.

  In order to generate the signature, the file to sign, signatory and signature type must be known (i.e. non `null`).

  throws:
    InvalidUserDataException if the there is insufficient information available to generate the signature.

### getClassifier

    java.lang.String getClassifier()

  The classifier of the signature artifact.

  Defaults to the classifier of the source artifact (if signing an artifact) or the given classifier at construction (if given).

  Returns:
    The classifier. May be `null` if unknown at this time.

### getDate

    java.util.Date getDate()

  The date of the signature artifact.

  Defaults to the last modified time of the signature file (if exists)

  Returns:
    The date of the signature. May be `null` if unknown at this time.

### getExtension

    java.lang.String getExtension()

  The extension of the signature artifact.

  Defaults to the specified file extension of the signature type.

  Returns:
    The extension. May be `null` if unknown at this time.

### getFile

    java.io.File getFile()

  The file for the generated signature, which may not yet exist.

  Defaults to a file alongside the file to sign with the extension of the signature type.

  Returns:
    The signature file. May be `null` if unknown at this time.

### getName

    java.lang.String getName()

  The name of the signature artifact.

  Defaults to the name of the signature file.

  Returns:
    The name. May be `null` if unknown at this time.

### getSignatory

    Signatory getSignatory()

  The signatory of this signature file.
  Returns:
    The signatory. May be `null` if unknown at this time.

### getSignatureType

    SignatureType getSignatureType()

  The file representation type of the signature.
  Returns:
    The signature type. May be `null` if unknown at this time.

### getToSign

    java.io.File getToSign()

  The file that is to be signed.
  Returns:
    The file. May be `null` if unknown at this time.

### getType

    java.lang.String getType()

  The type of the signature artifact.

  Defaults to the extension of the file to sign plus the extension of the signature type. For example, when signing the file ‘my.zip’ with a signature type with extension ‘sig’, the default type is ‘zip.sig’.

  Returns:
    The type. May be `null` if the file to sign or signature type are unknown at this time.

Groovy Documentation