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());
}
}
}
Aggregations