gradle
8.6

# setRequired

open fun setRequired(required: Boolean)(source)

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

open fun setRequired(required: Any)(source)

Whether 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("publish") }
    }

Content copied to clipboard
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
    }

Content copied to clipboard