Search in sources :

Example 1 with AttributeMatcher

use of org.gradle.internal.component.model.AttributeMatcher in project gradle by gradle.

the class VariantAttributeMatchingCache method matchAttributes.

private boolean matchAttributes(AttributeContainer actual, AttributeContainer requested, boolean ignoreAdditionalActualAttributes) {
    Map<AttributeContainer, Boolean> cache;
    AttributeMatcher schemaToMatchOn;
    if (ignoreAdditionalActualAttributes) {
        if (requested.isEmpty()) {
            return true;
        }
        schemaToMatchOn = schema.ignoreAdditionalProducerAttributes();
        cache = getCache(requested).ignoreExtraActual;
    } else {
        // ignore additional requested
        if (actual.isEmpty()) {
            return true;
        }
        schemaToMatchOn = schema.ignoreAdditionalConsumerAttributes();
        cache = getCache(requested).ignoreExtraRequested;
    }
    Boolean match = cache.get(actual);
    if (match == null) {
        match = schemaToMatchOn.isMatching(actual, requested);
        cache.put(actual, match);
    }
    return match;
}
Also used : AttributeMatcher(org.gradle.internal.component.model.AttributeMatcher) AttributeContainer(org.gradle.api.attributes.AttributeContainer)

Aggregations

AttributeContainer (org.gradle.api.attributes.AttributeContainer)1 AttributeMatcher (org.gradle.internal.component.model.AttributeMatcher)1