Search in sources :

Example 1 with ComponentSelectionReason

use of org.gradle.api.artifacts.result.ComponentSelectionReason in project gradle by gradle.

the class ComponentSelectionReasonSerializer method read.

public ComponentSelectionReason read(Decoder decoder) throws IOException {
    byte id = decoder.readByte();
    ComponentSelectionReason out = REASONS.get(id);
    if (out == null) {
        throw new IllegalArgumentException("Unable to find selection reason with id: " + id);
    }
    return out;
}
Also used : ComponentSelectionReason(org.gradle.api.artifacts.result.ComponentSelectionReason)

Example 2 with ComponentSelectionReason

use of org.gradle.api.artifacts.result.ComponentSelectionReason in project gradle by gradle.

the class DependencyResultSerializer method read.

public DependencyResult read(Decoder decoder, Map<Long, ComponentSelector> selectors, Map<ComponentSelector, ModuleVersionResolveException> failures) throws IOException {
    Long selectorId = decoder.readSmallLong();
    ComponentSelector requested = selectors.get(selectorId);
    byte resultByte = decoder.readByte();
    if (resultByte == SUCCESSFUL) {
        Long selectedId = decoder.readSmallLong();
        return new DefaultDependencyResult(requested, selectedId, null, null);
    } else if (resultByte == FAILED) {
        ComponentSelectionReason reason = componentSelectionReasonSerializer.read(decoder);
        ModuleVersionResolveException failure = failures.get(requested);
        return new DefaultDependencyResult(requested, null, reason, failure);
    } else {
        throw new IllegalArgumentException("Unknown result type: " + resultByte);
    }
}
Also used : ComponentSelectionReason(org.gradle.api.artifacts.result.ComponentSelectionReason) ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) ModuleVersionResolveException(org.gradle.internal.resolve.ModuleVersionResolveException)

Example 3 with ComponentSelectionReason

use of org.gradle.api.artifacts.result.ComponentSelectionReason in project gradle by gradle.

the class ComponentResultSerializer method read.

public ComponentResult read(Decoder decoder) throws IOException {
    long resultId = decoder.readSmallLong();
    ModuleVersionIdentifier id = idSerializer.read(decoder);
    ComponentSelectionReason reason = reasonSerializer.read(decoder);
    ComponentIdentifier componentId = componentIdSerializer.read(decoder);
    String variantName = decoder.readString();
    AttributeContainer attributes = attributeContainerSerializer.read(decoder);
    return new DetachedComponentResult(resultId, id, reason, componentId, variantName, attributes);
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) ComponentSelectionReason(org.gradle.api.artifacts.result.ComponentSelectionReason) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) AttributeContainer(org.gradle.api.attributes.AttributeContainer)

Aggregations

ComponentSelectionReason (org.gradle.api.artifacts.result.ComponentSelectionReason)3 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)1 AttributeContainer (org.gradle.api.attributes.AttributeContainer)1 ModuleVersionResolveException (org.gradle.internal.resolve.ModuleVersionResolveException)1