Search in sources :

Example 1 with ComponentSelectionCause

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

the class ComponentSelectionReasonSerializer method readDescriptions.

private List<ComponentSelectionDescriptor> readDescriptions(Decoder decoder) throws IOException {
    int size = decoder.readSmallInt();
    ImmutableList.Builder<ComponentSelectionDescriptor> builder = new ImmutableList.Builder<ComponentSelectionDescriptor>();
    for (int i = 0; i < size; i++) {
        ComponentSelectionCause cause = ComponentSelectionCause.values()[decoder.readByte()];
        String desc = readDescriptionText(decoder);
        builder.add(new DefaultComponentSelectionDescriptor(cause, desc));
    }
    return builder.build();
}
Also used : ComponentSelectionDescriptor(org.gradle.api.artifacts.result.ComponentSelectionDescriptor) ImmutableList(com.google.common.collect.ImmutableList) ComponentSelectionCause(org.gradle.api.artifacts.result.ComponentSelectionCause)

Example 2 with ComponentSelectionCause

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

the class ComponentSelectionDescriptorSerializer method read.

@Override
public ComponentSelectionDescriptor read(Decoder decoder) throws IOException {
    ComponentSelectionCause cause = ComponentSelectionCause.values()[decoder.readByte()];
    String desc = decoder.readString();
    String defaultReason = cause.getDefaultReason();
    if (desc.equals(defaultReason)) {
        return componentSelectionDescriptorFactory.newDescriptor(cause);
    }
    return componentSelectionDescriptorFactory.newDescriptor(cause, desc);
}
Also used : ComponentSelectionCause(org.gradle.api.artifacts.result.ComponentSelectionCause)

Aggregations

ComponentSelectionCause (org.gradle.api.artifacts.result.ComponentSelectionCause)2 ImmutableList (com.google.common.collect.ImmutableList)1 ComponentSelectionDescriptor (org.gradle.api.artifacts.result.ComponentSelectionDescriptor)1