Search in sources :

Example 1 with DefaultResolvedVariantResult

use of org.gradle.api.internal.artifacts.result.DefaultResolvedVariantResult in project gradle by gradle.

the class NodeState method getResolvedVariant.

public ResolvedVariantResult getResolvedVariant() {
    if (cachedVariantResult != null) {
        return cachedVariantResult;
    }
    DisplayName name = Describables.of(metaData.getName());
    List<? extends Capability> capabilities = metaData.getCapabilities().getCapabilities();
    AttributeContainer attributes = desugar(metaData.getAttributes());
    List<Capability> resolvedVariantCapabilities = capabilities.isEmpty() ? Collections.singletonList(component.getImplicitCapability()) : ImmutableList.copyOf(capabilities);
    cachedVariantResult = new DefaultResolvedVariantResult(component.getComponentId(), name, attributes, resolvedVariantCapabilities, findExternalVariant());
    return cachedVariantResult;
}
Also used : Capability(org.gradle.api.capabilities.Capability) ShadowedCapability(org.gradle.internal.component.external.model.ShadowedCapability) DefaultResolvedVariantResult(org.gradle.api.internal.artifacts.result.DefaultResolvedVariantResult) DisplayName(org.gradle.internal.DisplayName) AttributeContainer(org.gradle.api.attributes.AttributeContainer)

Example 2 with DefaultResolvedVariantResult

use of org.gradle.api.internal.artifacts.result.DefaultResolvedVariantResult in project gradle by gradle.

the class ResolvedVariantResultSerializer method read.

@Override
public ResolvedVariantResult read(Decoder decoder) throws IOException {
    int index = decoder.readSmallInt();
    if (index == -1) {
        return null;
    }
    if (index == read.size()) {
        ComponentIdentifier owner = componentIdentifierSerializer.read(decoder);
        String variantName = decoder.readString();
        AttributeContainer attributes = attributeContainerSerializer.read(decoder);
        List<Capability> capabilities = readCapabilities(decoder);
        read.add(null);
        ResolvedVariantResult externalVariant = read(decoder);
        DefaultResolvedVariantResult result = new DefaultResolvedVariantResult(owner, Describables.of(variantName), attributes, capabilities, externalVariant);
        this.read.set(index, result);
        return result;
    }
    return read.get(index);
}
Also used : Capability(org.gradle.api.capabilities.Capability) DefaultResolvedVariantResult(org.gradle.api.internal.artifacts.result.DefaultResolvedVariantResult) DefaultResolvedVariantResult(org.gradle.api.internal.artifacts.result.DefaultResolvedVariantResult) ResolvedVariantResult(org.gradle.api.artifacts.result.ResolvedVariantResult) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) AttributeContainer(org.gradle.api.attributes.AttributeContainer)

Aggregations

AttributeContainer (org.gradle.api.attributes.AttributeContainer)2 Capability (org.gradle.api.capabilities.Capability)2 DefaultResolvedVariantResult (org.gradle.api.internal.artifacts.result.DefaultResolvedVariantResult)2 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ResolvedVariantResult (org.gradle.api.artifacts.result.ResolvedVariantResult)1 DisplayName (org.gradle.internal.DisplayName)1 ShadowedCapability (org.gradle.internal.component.external.model.ShadowedCapability)1