api / org.gradle.api / NamedDomainObjectCollection / addRule

addRule

abstract fun addRule(rule: Rule): Rule

Adds a rule to this collection. The given rule is invoked when an unknown object is requested by name.

Parameters

rule - The rule to add.

Return
The added rule.

abstract fun addRule(description: String, ruleAction: Closure<Any>): Rule

Adds a rule to this collection. The given closure is executed when an unknown object is requested by name. The requested name is passed to the closure as a parameter.

Parameters

description - The description of the rule.

ruleAction - The closure to execute to apply the rule.

Return
The added rule.

abstract fun addRule(description: String, ruleAction: Action<String>): Rule

Adds a rule to this collection. The given action is executed when an unknown object is requested by name. The requested name is passed to the action.

Parameters

description - The description of the rule.

ruleAction - The action to execute to apply the rule.

Return
The added rule.

Since
3.3