api / org.gradle.plugins.signing / SigningExtension / setRequired

setRequired

open fun setRequired(required: Boolean): Unit

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

Since
4.0

open fun setRequired(required: Any): Unit

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 }