Search in sources :

Example 1 with DefaultUnresolvedDependencyResult

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());
        }
    }
}
Also used : DefaultUnresolvedDependencyResult(org.gradle.api.internal.artifacts.result.DefaultUnresolvedDependencyResult) ResolvedVariantResult(org.gradle.api.artifacts.result.ResolvedVariantResult) DependencyResult(org.gradle.api.artifacts.result.DependencyResult) ResolvedDependencyResult(org.gradle.api.artifacts.result.ResolvedDependencyResult) DefaultUnresolvedDependencyResult(org.gradle.api.internal.artifacts.result.DefaultUnresolvedDependencyResult) DefaultResolvedDependencyResult(org.gradle.api.internal.artifacts.result.DefaultResolvedDependencyResult) DefaultResolvedDependencyResult(org.gradle.api.internal.artifacts.result.DefaultResolvedDependencyResult) ResolvedDependencyResult(org.gradle.api.artifacts.result.ResolvedDependencyResult) DefaultResolvedDependencyResult(org.gradle.api.internal.artifacts.result.DefaultResolvedDependencyResult)

Aggregations

DependencyResult (org.gradle.api.artifacts.result.DependencyResult)1 ResolvedDependencyResult (org.gradle.api.artifacts.result.ResolvedDependencyResult)1 ResolvedVariantResult (org.gradle.api.artifacts.result.ResolvedVariantResult)1 DefaultResolvedDependencyResult (org.gradle.api.internal.artifacts.result.DefaultResolvedDependencyResult)1 DefaultUnresolvedDependencyResult (org.gradle.api.internal.artifacts.result.DefaultUnresolvedDependencyResult)1