Search in sources :

Example 1 with ComponentVariant

use of org.gradle.internal.component.external.model.ComponentVariant in project gradle by gradle.

the class RealisedIvyModuleResolveMetadataSerializationHelper method readMetadata.

public ModuleComponentResolveMetadata readMetadata(Decoder decoder, DefaultIvyModuleResolveMetadata resolveMetadata) throws IOException {
    Map<String, List<GradleDependencyMetadata>> variantToDependencies = readVariantDependencies(decoder);
    ImmutableList<? extends ComponentVariant> variants = resolveMetadata.getVariants();
    ImmutableList.Builder<AbstractRealisedModuleComponentResolveMetadata.ImmutableRealisedVariantImpl> builder = ImmutableList.builder();
    for (ComponentVariant variant : variants) {
        builder.add(new AbstractRealisedModuleComponentResolveMetadata.ImmutableRealisedVariantImpl(resolveMetadata.getId(), variant.getName(), variant.getAttributes().asImmutable(), variant.getDependencies(), variant.getDependencyConstraints(), variant.getFiles(), ImmutableCapabilities.of(variant.getCapabilities().getCapabilities()), variantToDependencies.get(variant.getName()), variant.isExternalVariant()));
    }
    ImmutableList<AbstractRealisedModuleComponentResolveMetadata.ImmutableRealisedVariantImpl> realisedVariants = builder.build();
    return new RealisedIvyModuleResolveMetadata(resolveMetadata, realisedVariants, readIvyConfigurations(decoder, resolveMetadata));
}
Also used : ComponentVariant(org.gradle.internal.component.external.model.ComponentVariant) ImmutableList(com.google.common.collect.ImmutableList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) AbstractRealisedModuleComponentResolveMetadata(org.gradle.internal.component.external.model.AbstractRealisedModuleComponentResolveMetadata)

Example 2 with ComponentVariant

use of org.gradle.internal.component.external.model.ComponentVariant in project gradle by gradle.

the class RealisedMavenModuleResolveMetadataSerializationHelper method readMetadata.

public ModuleComponentResolveMetadata readMetadata(Decoder decoder, DefaultMavenModuleResolveMetadata resolveMetadata, Map<Integer, MavenDependencyDescriptor> deduplicationDependencyCache) throws IOException {
    Map<String, List<GradleDependencyMetadata>> variantToDependencies = readVariantDependencies(decoder);
    ImmutableList<? extends ComponentVariant> variants = resolveMetadata.getVariants();
    ImmutableList.Builder<AbstractRealisedModuleComponentResolveMetadata.ImmutableRealisedVariantImpl> builder = ImmutableList.builder();
    for (ComponentVariant variant : variants) {
        builder.add(new AbstractRealisedModuleComponentResolveMetadata.ImmutableRealisedVariantImpl(resolveMetadata.getId(), variant.getName(), variant.getAttributes().asImmutable(), variant.getDependencies(), variant.getDependencyConstraints(), variant.getFiles(), ImmutableCapabilities.of(variant.getCapabilities().getCapabilities()), variantToDependencies.get(variant.getName()), variant.isExternalVariant()));
    }
    ImmutableList<AbstractRealisedModuleComponentResolveMetadata.ImmutableRealisedVariantImpl> realisedVariants = builder.build();
    Map<String, ConfigurationMetadata> configurations = readMavenConfigurations(decoder, resolveMetadata, deduplicationDependencyCache);
    ImmutableList<ConfigurationMetadata> derivedVariants = readDerivedVariants(decoder, resolveMetadata, deduplicationDependencyCache);
    return new RealisedMavenModuleResolveMetadata(resolveMetadata, realisedVariants, derivedVariants, configurations);
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) AbstractRealisedModuleComponentResolveMetadata(org.gradle.internal.component.external.model.AbstractRealisedModuleComponentResolveMetadata) ConfigurationMetadata(org.gradle.internal.component.model.ConfigurationMetadata) RealisedConfigurationMetadata(org.gradle.internal.component.external.model.RealisedConfigurationMetadata) ComponentVariant(org.gradle.internal.component.external.model.ComponentVariant) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)2 List (java.util.List)2 AbstractRealisedModuleComponentResolveMetadata (org.gradle.internal.component.external.model.AbstractRealisedModuleComponentResolveMetadata)2 ComponentVariant (org.gradle.internal.component.external.model.ComponentVariant)2 RealisedConfigurationMetadata (org.gradle.internal.component.external.model.RealisedConfigurationMetadata)1 ConfigurationMetadata (org.gradle.internal.component.model.ConfigurationMetadata)1