api / org.gradle.api.attributes / CompatibilityRuleChain / add

add

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

Adds an arbitrary compatibility rule to the chain.

A compatibility rule can tell if two values are compatible. Compatibility doesn't mean equality. Typically two different Java platforms can be compatible, without being equal.

A rule can express an opinion by calling the @{link CompatibilityCheckDetails#compatible()} method to tell that two attributes are compatible, or it can call CompatibilityCheckDetails#incompatible() to say that they are not compatible. It is not mandatory for a rule to express an opinion.

Parameters

rule - the rule to add to the chain

Since
4.0

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

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

Parameters

rule - the rule to add to the chain

configureAction - the action to use to configure the rule

Since
4.0