Search in sources :

Example 1 with VariantWithOverloadAttributes

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

the class ProjectArtifactSetResolver method mapVariant.

private ResolvedVariant mapVariant(ModuleVersionIdentifier ownerId, ModuleSources moduleSources, ExcludeSpec exclusions, ArtifactTypeRegistry artifactTypeRegistry, VariantResolveMetadata variant) {
    VariantResolveMetadata.Identifier identifier = variant.getIdentifier();
    if (identifier == null) {
        throw new IllegalArgumentException(String.format("Project variant %s does not have an identifier.", variant.asDescribable()));
    }
    // Apply any artifact type mappings to the attributes of the variant
    ImmutableAttributes variantAttributes = artifactTypeRegistry.mapAttributesFor(variant.getAttributes().asImmutable(), variant.getArtifacts());
    if (exclusions.mayExcludeArtifacts()) {
        // Some artifact may be excluded, so do not reuse. It might be better to apply the exclusions and reuse if none of them apply
        return DefaultArtifactSet.toResolvedVariant(variant, ownerId, moduleSources, exclusions, artifactResolver, allProjectArtifacts, variantAttributes, calculatedValueContainerFactory);
    }
    VariantWithOverloadAttributes key = new VariantWithOverloadAttributes(identifier, variantAttributes);
    return allProjectVariants.computeIfAbsent(key, k -> DefaultArtifactSet.toResolvedVariant(variant, ownerId, moduleSources, exclusions, artifactResolver, allProjectArtifacts, variantAttributes, calculatedValueContainerFactory));
}
Also used : VariantWithOverloadAttributes(org.gradle.internal.component.model.VariantWithOverloadAttributes) ImmutableAttributes(org.gradle.api.internal.attributes.ImmutableAttributes) VariantResolveMetadata(org.gradle.internal.component.model.VariantResolveMetadata)

Aggregations

ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)1 VariantResolveMetadata (org.gradle.internal.component.model.VariantResolveMetadata)1 VariantWithOverloadAttributes (org.gradle.internal.component.model.VariantWithOverloadAttributes)1