api / org.gradle.api.attributes / DisambiguationRuleChain / add

add

abstract fun add(rule: Class<out AttributeDisambiguationRule<T>>): Unit

Adds an arbitrary disambiguation rule to the chain.

A disambiguation rule can select the best match from a list of candidates.

A rule can express an preference by calling the @{link MultipleCandidatesDetails#closestMatch(Object) method to tell that a candidate is the best one.

It is not mandatory for a rule to choose, and it is not an error to select multiple candidates.

Parameters

rule - the rule to add

Since
4.0

abstract fun add(rule: Class<out AttributeDisambiguationRule<T>>, configureAction: Action<in ActionConfiguration>): Unit

Adds an arbitrary disambiguation rule to the chain, possibly configuring the rule as well.

Parameters

rule - the rule to add

configureAction - the action to use to configure the rule

Since
4.0