Search in sources :

Example 1 with VariantNameBuilder

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.VariantNameBuilder in project gradle by gradle.

the class DefaultResolvedComponentResult method getVariant.

@Override
@SuppressWarnings("deprecation")
public ResolvedVariantResult getVariant() {
    if (variants.isEmpty()) {
        return new DefaultResolvedVariantResult(componentId, Describables.of("<empty>"), ImmutableAttributes.EMPTY, Collections.emptyList(), null);
    }
    // Returns an approximation of a composite variant
    List<String> parts = variants.stream().map(ResolvedVariantResult::getDisplayName).collect(Collectors.toList());
    DisplayName variantName = new VariantNameBuilder().getVariantName(parts);
    ResolvedVariantResult firstVariant = variants.get(0);
    return new DefaultResolvedVariantResult(componentId, variantName, firstVariant.getAttributes(), firstVariant.getCapabilities(), null);
}
Also used : ResolvedVariantResult(org.gradle.api.artifacts.result.ResolvedVariantResult) DisplayName(org.gradle.internal.DisplayName) VariantNameBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.VariantNameBuilder)

Aggregations

ResolvedVariantResult (org.gradle.api.artifacts.result.ResolvedVariantResult)1 VariantNameBuilder (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.VariantNameBuilder)1 DisplayName (org.gradle.internal.DisplayName)1