api / org.gradle.api.attributes

Package org.gradle.api.attributes

Types

Attribute

open class Attribute<T : Any> : Named

An attribute is a named entity with a type. It is used in conjunction with a AttributeContainer to provide a type safe container for attributes. This class isn't intended to store the value of an attribute, but only represent the identity of the attribute. It means that an attribute must be immutable and can potentially be pooled. Attributes can be created using the factory method.

AttributeCompatibilityRule

interface AttributeCompatibilityRule<T : Any> : Action<CompatibilityCheckDetails<T>>

A rule that determines whether a given attribute value is compatible some provided attribute value.

AttributeContainer

interface AttributeContainer : HasAttributes

An attribute container is a container of Attribute, which are strongly typed named entities. Such a container is responsible for storing and getting attributes in a type safe way. In particular, attributes are strongly typed, meaning that when we get a value from the container, the returned value type is inferred from the type of the attribute. In a way, an attribute container is similar to a java.util.Map where the entry is a "typed String" and the value is of the string type. However the set of methods available to the container is much more limited. It is not allowed to have two attributes with the same name but different types in the container.

AttributeDisambiguationRule

interface AttributeDisambiguationRule<T : Any> : Action<MultipleCandidatesDetails<T>>

A rule that selects the best value out of a set of two or more candidates.

AttributeMatchingStrategy

interface AttributeMatchingStrategy<T : Any>

An attribute matching strategy is responsible for providing information about how an Attribute is matched during dependency resolution. In particular, it will tell if a value, provided by a consumer, is compatible with a value provided by a candidate.

AttributesSchema

interface AttributesSchema

An attributes schema stores information about Attribute and how they can be matched together.

CompatibilityCheckDetails

interface CompatibilityCheckDetails<T : Any>

Provides context about attribute compatibility checks, and allows the user to define when an attribute is compatible with another.

CompatibilityRuleChain

interface CompatibilityRuleChain<T : Any>

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 CompatibilityCheckDetails#compatible() or CompatibilityCheckDetails#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.

DisambiguationRuleChain

interface DisambiguationRuleChain<T : Any>

A chain of disambiguation rules. By default the chain is empty and will not do any disambiguation.

For a given set of rules, the execution is done in order, and interrupts as soon as a rule selected at least one candidate (through MultipleCandidatesDetails#closestMatch(Object)).

If the end of the rule chain is reached and that no rule selected a candidate then the candidate list is returned unmodified, meaning we still have an ambiguous match.

HasAttributes

interface HasAttributes

Represents something that carries attributes by utilizing an AttributeContainer

HasConfigurableAttributes

interface HasConfigurableAttributes<SELF : Any> : HasAttributes

Represents something that carries attributes by utilizing an AttributeContainer that is configurable.

MultipleCandidatesDetails

interface MultipleCandidatesDetails<T : Any>

Provides context about candidates for an attribute. In particular, this class gives access to the list of candidates on the producer side.

Usage

interface Usage : Named

Represents the usage of a configuration. Typical usages include compilation or runtime. This interface allows the user to customize usages by implementing this interface.