Search in sources :

Example 11 with DependencyMetadata

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

the class RealisedIvyModuleResolveMetadataSerializationHelper method writeDependencies.

@Override
protected void writeDependencies(Encoder encoder, ConfigurationMetadata configuration, Map<ExternalDependencyDescriptor, Integer> deduplicationDependencyCache) throws IOException {
    List<? extends DependencyMetadata> dependencies = configuration.getDependencies();
    encoder.writeSmallInt(dependencies.size());
    for (DependencyMetadata dependency : dependencies) {
        if (dependency instanceof GradleDependencyMetadata) {
            encoder.writeByte(GRADLE_DEPENDENCY_METADATA);
            writeDependencyMetadata(encoder, (GradleDependencyMetadata) dependency);
        } else if (dependency instanceof ConfigurationBoundExternalDependencyMetadata) {
            ConfigurationBoundExternalDependencyMetadata dependencyMetadata = (ConfigurationBoundExternalDependencyMetadata) dependency;
            ExternalDependencyDescriptor dependencyDescriptor = dependencyMetadata.getDependencyDescriptor();
            if (dependencyDescriptor instanceof IvyDependencyDescriptor) {
                encoder.writeByte(IVY_DEPENDENCY_METADATA);
                boolean addedByRule = configuration instanceof RealisedConfigurationMetadata && ((RealisedConfigurationMetadata) configuration).isAddedByRule();
                writeIvyDependency(encoder, (IvyDependencyDescriptor) dependencyDescriptor, configuration.getName(), addedByRule);
            } else {
                throw new IllegalStateException("Unknown type of dependency descriptor: " + dependencyDescriptor.getClass());
            }
            encoder.writeNullableString(dependency.getReason());
        }
    }
}
Also used : GradleDependencyMetadata(org.gradle.internal.component.external.model.GradleDependencyMetadata) ConfigurationBoundExternalDependencyMetadata(org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata) ExternalDependencyDescriptor(org.gradle.internal.component.external.model.ExternalDependencyDescriptor) GradleDependencyMetadata(org.gradle.internal.component.external.model.GradleDependencyMetadata) DependencyMetadata(org.gradle.internal.component.model.DependencyMetadata) ModuleDependencyMetadata(org.gradle.internal.component.external.model.ModuleDependencyMetadata) ConfigurationBoundExternalDependencyMetadata(org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata) RealisedConfigurationMetadata(org.gradle.internal.component.external.model.RealisedConfigurationMetadata)

Aggregations

DependencyMetadata (org.gradle.internal.component.model.DependencyMetadata)11 ConfigurationBoundExternalDependencyMetadata (org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata)3 ModuleDependencyMetadata (org.gradle.internal.component.external.model.ModuleDependencyMetadata)3 LocalFileDependencyMetadata (org.gradle.internal.component.local.model.LocalFileDependencyMetadata)3 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)2 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)2 ExternalDependencyDescriptor (org.gradle.internal.component.external.model.ExternalDependencyDescriptor)2 GradleDependencyMetadata (org.gradle.internal.component.external.model.GradleDependencyMetadata)2 RealisedConfigurationMetadata (org.gradle.internal.component.external.model.RealisedConfigurationMetadata)2 ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)1 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)1 AttributeContainerInternal (org.gradle.api.internal.attributes.AttributeContainerInternal)1 AttributeMergingException (org.gradle.api.internal.attributes.AttributeMergingException)1 ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)1 ForcedDependencyMetadataWrapper (org.gradle.internal.component.external.model.ForcedDependencyMetadataWrapper)1 ModuleComponentResolveMetadata (org.gradle.internal.component.external.model.ModuleComponentResolveMetadata)1 MutableModuleComponentResolveMetadata (org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata)1 ConfigurationMetadata (org.gradle.internal.component.model.ConfigurationMetadata)1