Package org.gradle.plugins.signing
Class SignOperation
- java.lang.Object
-
- org.gradle.plugins.signing.SignOperation
-
- All Implemented Interfaces:
SignatureSpec
public abstract class SignOperation extends java.lang.Object implements SignatureSpec
A sign operation creates digital signatures for one or more files orpublish artifacts.The external representation of the signature is specified by the
signature type property, while thesignatoryproperty specifies who is to sign.A sign operation manages one or more
Signatureobjects. Thesignmethods are used to register things to generate signatures for. Theexecute()method generates the signatures for all of the registered items at that time.
-
-
Constructor Summary
Constructors Constructor Description SignOperation()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description SignOperationconfigure(Closure closure)Executes the given closure against this object.SignOperationexecute()Generates actual signature files for all of the registered signatures.java.lang.StringgetDisplayName()FileCollectiongetFilesToSign()All of the files that will be signed by this operation.SignatorygetSignatory()The signatory that will be performing the signing.FileCollectiongetSignatureFiles()All of the signature files that will be generated by this operation.java.util.List<Signature>getSignatures()The registered signatures.SignatureTypegetSignatureType()The signature representation that will be created.SignaturegetSingleSignature()Returns the single registered signature.booleanisRequired()Whether or not it is required that this signature be generated.voidsetRequired(boolean required)Whether or not it is required that this signature be generated.voidsetSignatory(Signatory signatory)Sets the signatory that will be signing the input.voidsetSignatureType(SignatureType signatureType)Sets the signature representation that the signatures will be produced as.SignOperationsign(java.io.File... files)Registers signatures for the given files.SignOperationsign(java.lang.String classifier, java.io.File... files)Registers signatures (with the given classifier) for the given filesSignOperationsign(PublishArtifact... artifacts)Registers signatures for the given artifacts.SignOperationsignatory(Signatory signatory)Change the signatory for signature generation.SignOperationsignatureType(SignatureType type)Change the signature type for signature generation.protected abstract FileCollectiontoFileCollection(java.util.List<java.io.File> files)java.lang.StringtoString()
-
-
-
Method Detail
-
getDisplayName
public java.lang.String getDisplayName()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setSignatureType
public void setSignatureType(SignatureType signatureType)
Description copied from interface:SignatureSpecSets the signature representation that the signatures will be produced as.- Specified by:
setSignatureTypein interfaceSignatureSpec- Parameters:
signatureType- the signature type to use
-
getSignatureType
public SignatureType getSignatureType()
Description copied from interface:SignatureSpecThe signature representation that will be created.- Specified by:
getSignatureTypein interfaceSignatureSpec- Returns:
- the signature type, or
nullif none specified.
-
setSignatory
public void setSignatory(Signatory signatory)
Description copied from interface:SignatureSpecSets the signatory that will be signing the input.- Specified by:
setSignatoryin interfaceSignatureSpec- Parameters:
signatory- The signatory
-
getSignatory
public Signatory getSignatory()
Description copied from interface:SignatureSpecThe signatory that will be performing the signing.- Specified by:
getSignatoryin interfaceSignatureSpec- Returns:
- the signatory, or
nullif none specified.
-
setRequired
public void setRequired(boolean required)
Description copied from interface:SignatureSpecWhether or not it is required that this signature be generated.- Specified by:
setRequiredin interfaceSignatureSpec- Parameters:
required- Whether or not it is required that this signature be generated.- See Also:
SignatureSpec.isRequired()
-
isRequired
public boolean isRequired()
Description copied from interface:SignatureSpecWhether or not it is required that this signature be generated. A signature may not be able to be generated if a signatory and/or a signature type have not been specified. If it is required and cannot be generated, an exception will be thrown. Otherwise, it will not be generated.- Specified by:
isRequiredin interfaceSignatureSpec- Returns:
- Whether or not it is required that this signature be generated.
-
sign
public SignOperation sign(PublishArtifact... artifacts)
Registers signatures for the given artifacts.- Returns:
- this
- See Also:
Signature(File, SignatureSpec, Object...)
-
sign
public SignOperation sign(java.io.File... files)
Registers signatures for the given files.- Returns:
- this
- See Also:
Signature(File, SignatureSpec, Object...)
-
sign
public SignOperation sign(java.lang.String classifier, java.io.File... files)
Registers signatures (with the given classifier) for the given files- Returns:
- this
- See Also:
Signature(PublishArtifact, SignatureSpec, Object...)
-
signatureType
public SignOperation signatureType(SignatureType type)
Change the signature type for signature generation.
-
signatory
public SignOperation signatory(Signatory signatory)
Change the signatory for signature generation.
-
configure
public SignOperation configure(Closure closure)
Executes the given closure against this object.
-
execute
public SignOperation execute()
Generates actual signature files for all of the registered signatures.The signatures are generated with the configuration they have at this time, which includes the signature type and signatory of this operation at this time.
This method can be called multiple times, with the signatures being generated with their current configuration each time.
- Returns:
- this
- See Also:
Signature.generate()
-
getSignatures
public java.util.List<Signature> getSignatures()
The registered signatures.
-
getSingleSignature
public Signature getSingleSignature()
Returns the single registered signature.- Returns:
- The signature.
- Throws:
java.lang.IllegalStateException- if there is not exactly one registered signature.
-
getFilesToSign
public FileCollection getFilesToSign()
All of the files that will be signed by this operation.
-
getSignatureFiles
public FileCollection getSignatureFiles()
All of the signature files that will be generated by this operation.
-
toFileCollection
protected abstract FileCollection toFileCollection(java.util.List<java.io.File> files)
-
-