CompatibilityRuleChain

A chain of compatibility checks, implemented as action rules. By default the chain is empty and will eventually tell the values are incompatible if no rule expressed an opinion.

For a given set of rules, the execution is done in order, and interrupts as soon as a rule expressed an option (through compatible or incompatible).

If the end of the rule chain is reached and that no rule expressed an opinion then we apply an equality check by default, and eventually fail if they are not equal.

Functions

Link copied to clipboard
abstract fun add(rule: Class<out AttributeCompatibilityRule<T>>)
Adds an arbitrary compatibility rule to the chain.
abstract fun add(rule: Class<out AttributeCompatibilityRule<T>>, configureAction: Action<in ActionConfiguration>)
Adds an arbitrary compatibility rule to the chain, possibly configuring the rule as well.
Link copied to clipboard
inline fun <T : Any> CompatibilityRuleChain<T>.add(rule: KClass<out AttributeCompatibilityRule<T>>, configureAction: Action<in ActionConfiguration>)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.attributes.CompatibilityRuleChain.add.

Link copied to clipboard
abstract fun ordered(comparator: Comparator<in T>)
Adds an ordered check rule to this chain.
Link copied to clipboard
abstract fun reverseOrdered(comparator: Comparator<in T>)
Adds an reverse ordered check rule to this chain.