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 SigningExtension

    java.lang.Object
      org.gradle.plugins.signing.SigningExtension

    class SigningExtension

The global signing configuration for a project.

Property Summary
`static String` | `DEFAULT_CONFIGURATION_NAME` The name of the configuration that all signature artifacts will be placed into ("signatures")
`Configuration` | `configuration` The configuration that signature artifacts will be placed into.
`Project` | `project` The project that the settings are for
`SignatoryProvider` | `signatories` The provider of signatories.
`SignatureTypeProvider` | `signatureTypes` The provider of signature types.

Constructor Summary
`SigningExtension(Project project)` Configures the signing settings for the given project.

Method Summary
`protected void` | `addSignatureSpecConventions(SignatureSpec spec)` Adds conventions to the given spec, using this settings object's default signatory and signature type as the default signatory and signature type for the spec.
`protected def` | `addSignaturesToConfiguration(Sign task, Configuration configuration)`
`protected SignatoryProvider` | `createSignatoryProvider()` Provides the signatory provider.
`protected SignatureTypeProvider` | `createSignatureTypeProvider()` Provides the signature type provider.
`protected SignOperation` | `doSignOperation(Closure setup)`
`Configuration` | `getConfiguration()` The configuration that signature artifacts are added to.
`protected Configuration` | `getDefaultConfiguration()` Provides the configuration that signature artifacts are added to.
`Signatory` | `getSignatory()` The signatory that will be used for signing when an explicit signatory has not been specified.
`SignatureType` | `getSignatureType()` The signature type that will be used for signing files when an explicit signature type has not been specified.
`boolean` | `isRequired()` Whether or not this task should fail if no signatory or signature type are configured at generation time.
`void` | `setRequired(Object required)` Whether or not this task should fail if no signatory or signature type are configured at generation time.
`List` | `sign(Task... tasksToSign)` Creates signing tasks that depend on and sign the "archive" produced by the given tasks.
`List` | `sign(Configuration... configurations)` Creates signing tasks that sign Configuration#getAllArtifacts()#getAllArtifacts() of the given configurations.
`SignOperation` | `sign(PublishArtifact... publishArtifacts)` Digitally signs the publish artifacts, generating signature files alongside them.
`SignOperation` | `sign(File... files)` Digitally signs the files, generating signature files alongside them.
`SignOperation` | `sign(String classifier, File... files)` Digitally signs the files, generating signature files alongside them.
`SignOperation` | `sign(Closure closure)` Creates a new SignOperation using the given closure to configure it before executing it.
`Signature` | `signPom(MavenDeployment mavenDeployment, Closure closure = null)` Signs the POM artifact for the given maven deployment.
`SignatoryProvider` | `signatories(Closure closure)` Configures the signatory provider (delegating to its SignatoryProvider#configure(SigningExtension,Closure)#configure(SigningExtension,Closure)).

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Property Detail

### DEFAULT_CONFIGURATION_NAME

    static final String DEFAULT_CONFIGURATION_NAME

  The name of the configuration that all signature artifacts will be placed into ("signatures")

### configuration

    Configuration configuration

  The configuration that signature artifacts will be placed into.

  Changing this will not affect any signing already configured.

### project

    final Project project

  The project that the settings are for

### signatories

    SignatoryProvider signatories

  The provider of signatories.

### signatureTypes

    SignatureTypeProvider signatureTypes

  The provider of signature types.

Constructor Detail

### SigningExtension

    SigningExtension(Project project)

  Configures the signing settings for the given project.

Method Detail

### addSignatureSpecConventions

    protected void addSignatureSpecConventions(SignatureSpec spec)

  Adds conventions to the given spec, using this settings object's default signatory and signature type as the default signatory and signature type for the spec.

### addSignaturesToConfiguration

    protected def addSignaturesToConfiguration(Sign task, Configuration configuration)

### createSignatoryProvider

    protected SignatoryProvider createSignatoryProvider()

  Provides the signatory provider. Called once during construction.

### createSignatureTypeProvider

    protected SignatureTypeProvider createSignatureTypeProvider()

  Provides the signature type provider. Called once during construction.

### doSignOperation

    protected SignOperation doSignOperation(Closure setup)

### getConfiguration

    Configuration getConfiguration()

  The configuration that signature artifacts are added to.

### getDefaultConfiguration

    protected Configuration getDefaultConfiguration()

  Provides the configuration that signature artifacts are added to. Called once during construction.

### getSignatory

    Signatory getSignatory()

  The signatory that will be used for signing when an explicit signatory has not been specified.

  Delegates to the signatory provider's default signatory.

### getSignatureType

    SignatureType getSignatureType()

  The signature type that will be used for signing files when an explicit signature type has not been specified.

  Delegates to the signature type provider's default type.

### isRequired

    boolean isRequired()

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

  Defaults to `true`.

  See Also:
    setRequired(Object)

### setRequired

    void setRequired(Object required)

  Whether or not this task should fail if no signatory or signature type are configured at generation time. If `required` is a Callable, it will be stored and "called" on demand (i.e. when isRequired() is called) and the return value will be interpreting according to the Groovy Truth. For example:

       signing {
         required = { gradle.taskGraph.hasTask("uploadArchives") }
       }

  Because the task graph is not known until Gradle starts executing, we must use defer the decision. We can do this via using a Closure (which is a Callable). For any other type, the value will be stored and evaluated on demand according to the Groovy Truth.

       signing {
         required = false
       }

### sign

    List sign(Task... tasksToSign)

  Creates signing tasks that depend on and sign the "archive" produced by the given tasks.

  The created tasks will be named "sign<input task name capitalized>". That is, given a task with the name "jar" the created task will be named "signJar".

  If the task is not an AbstractArchiveTask, an InvalidUserDataException will be thrown.

  The signature artifact for the created task is added to the for this settings object.

  Parameters:
    `task` - The tasks whose archives are to be signed
  Returns:
    the created tasks.

### sign

    List sign(Configuration... configurations)

  Creates signing tasks that sign Configuration#getAllArtifacts()#getAllArtifacts() of the given configurations.

  The created tasks will be named "sign<configuration name capitalized>". That is, given a configuration with the name "archives" the created task will be named "signArchives". The signature artifact for the created task is added to the for this settings object.

  Parameters:
    `task` - The configurations whose archives are to be signed
  Returns:
    the created tasks.

### sign

    SignOperation sign(PublishArtifact... publishArtifacts)

  Digitally signs the publish artifacts, generating signature files alongside them.

  The project's default signatory and default signature type from the SigningExtension will be used to generate the signature. The returned SignOperation gives access to the created signature files.

  If there is no configured default signatory available, the sign operation will fail.

  Parameters:
    `publishArtifacts` - The publish artifacts to sign
  Returns:
    The executed SignOperation

### sign

    SignOperation sign(File... files)

  Digitally signs the files, generating signature files alongside them.

  The project's default signatory and default signature type from the SigningExtension will be used to generate the signature. The returned SignOperation gives access to the created signature files.

  If there is no configured default signatory available, the sign operation will fail.

  Parameters:
    `publishArtifacts` - The files to sign.
  Returns:
    The executed SignOperation.

### sign

    SignOperation sign(String classifier, File... files)

  Digitally signs the files, generating signature files alongside them.

  The project's default signatory and default signature type from the SigningExtension will be used to generate the signature. The returned SignOperation gives access to the created signature files.

  If there is no configured default signatory available, the sign operation will fail.

  Parameters:
    `classifier` - The classifier to assign to the created signature artifacts.
    `publishArtifacts` - The publish artifacts to sign.
  Returns:
    The executed SignOperation.

### sign

    SignOperation sign(Closure closure)

  Creates a new SignOperation using the given closure to configure it before executing it.

  The project's default signatory and default signature type from the SigningExtension will be used to generate the signature. The returned SignOperation gives access to the created signature files.

  If there is no configured default signatory available (and one is not explicitly specified in this operation's configuration), the sign operation will fail.

  Parameters:
    `closure` - The configuration of the SignOperation.
  Returns:
    The executed SignOperation.

### signPom

    Signature signPom(MavenDeployment mavenDeployment, Closure closure = null)

  Signs the POM artifact for the given maven deployment.

  You can use this method to sign the generated pom when publishing to a maven repository with the maven plugin.

       uploadArchives {
         repositories {
           mavenDeployer {
             beforeDeployment { MavenDeployment deployment ->
               signing.signPom(deployment)
             }
           }
         }
       }

  You can optionally provide a configuration closure to fine tune the SignOperation for the POM.

  If isRequired() is false and the signature cannot be generated (e.g. no configured signatory), this method will silently do nothing. That is, a signature for the POM file will not be uploaded.

  Parameters:
    `mavenDeployment` - The deployment to sign the POM of
    `closure` - the configuration of the underlying SignOperation for the pom (optional)
  Returns:
    the generated signature artifact

### signatories

    SignatoryProvider signatories(Closure closure)

  Configures the signatory provider (delegating to its SignatoryProvider#configure(SigningExtension,Closure)#configure(SigningExtension,Closure)).
  Parameters:
    `closure` - the signatory provider configuration DSL
  Returns:
    the configured signatory provider

Gradle API 1.1-rc-1