use of org.gradle.api.internal.artifacts.result.DefaultUnresolvedDependencyResult in project gradle by gradle.
the class ResolvedComponentResultSerializer method writeComponent.
private void writeComponent(Encoder encoder, ResolvedComponentResult component, Map<ResolvedComponentResult, Integer> components) throws Exception {
Integer id = components.get(component);
if (id != null) {
// Already seen
encoder.writeSmallInt(id);
return;
}
id = components.size();
components.put(component, id);
encoder.writeSmallInt(id);
moduleVersionIdSerializer.write(encoder, component.getModuleVersion());
componentIdSerializer.write(encoder, component.getId());
componentSelectionReasonSerializer.write(encoder, component.getSelectionReason());
List<ResolvedVariantResult> variants = component.getVariants();
encoder.writeSmallInt(variants.size());
for (ResolvedVariantResult variant : variants) {
resolvedVariantResultSerializer.write(encoder, variant);
}
Set<? extends DependencyResult> dependencies = component.getDependencies();
encoder.writeSmallInt(dependencies.size());
for (DependencyResult dependency : dependencies) {
boolean successful = dependency instanceof ResolvedDependencyResult;
encoder.writeBoolean(successful);
if (successful) {
DefaultResolvedDependencyResult dependencyResult = (DefaultResolvedDependencyResult) dependency;
componentSelectorSerializer.write(encoder, dependencyResult.getRequested());
writeComponent(encoder, dependencyResult.getSelected(), components);
} else {
DefaultUnresolvedDependencyResult dependencyResult = (DefaultUnresolvedDependencyResult) dependency;
componentSelectorSerializer.write(encoder, dependencyResult.getRequested());
}
}
}
Aggregations