use of org.gradle.internal.text.TreeFormatter in project gradle by gradle.
the class AmbiguousConfigurationSelectionException method generateMessage.
private static String generateMessage(AttributeContainer fromConfigurationAttributes, AttributesSchema consumerSchema, List<? extends ConfigurationMetadata> matches, ComponentResolveMetadata targetComponent) {
Set<String> ambiguousConfigurations = Sets.newTreeSet(Lists.transform(matches, CONFIG_NAME));
Set<String> requestedAttributes = Sets.newTreeSet(Iterables.transform(fromConfigurationAttributes.keySet(), ATTRIBUTE_NAME));
TreeFormatter formatter = new TreeFormatter();
formatter.node("Cannot choose between the following configurations on ");
formatter.append(targetComponent.getComponentId().getDisplayName());
formatter.startChildren();
for (String configuration : ambiguousConfigurations) {
formatter.node(configuration);
}
formatter.endChildren();
formatter.node("All of them match the consumer attributes");
// We're sorting the names of the configurations and later attributes
// to make sure the output is consistently the same between invocations
formatter.startChildren();
for (final String ambiguousConf : ambiguousConfigurations) {
formatConfiguration(formatter, fromConfigurationAttributes, consumerSchema, matches, requestedAttributes, ambiguousConf);
}
formatter.endChildren();
return formatter.toString();
}
use of org.gradle.internal.text.TreeFormatter in project gradle by gradle.
the class AmbiguousTransformException method format.
private static String format(String producerDisplayName, AttributeContainerInternal requested, List<Pair<ResolvedVariant, ConsumerVariantMatchResult.ConsumerVariant>> candidates) {
TreeFormatter formatter = new TreeFormatter();
formatter.node("Found multiple transforms that can produce a variant of " + producerDisplayName + " for consumer attributes");
formatAttributes(formatter, requested);
formatter.node("Found the following transforms");
formatter.startChildren();
for (Pair<ResolvedVariant, ConsumerVariantMatchResult.ConsumerVariant> candidate : candidates) {
formatter.node("Transform from " + candidate.getLeft().asDescribable().getDisplayName());
formatAttributes(formatter, candidate.getLeft().getAttributes());
}
formatter.endChildren();
return formatter.toString();
}
use of org.gradle.internal.text.TreeFormatter in project gradle by gradle.
the class AmbiguousVariantSelectionException method format.
private static String format(String producerDisplayName, AttributeContainerInternal consumer, List<? extends ResolvedVariant> variants, AttributeMatcher matcher) {
TreeFormatter formatter = new TreeFormatter();
formatter.node("More than one variant of " + producerDisplayName + " matches the consumer attributes");
formatter.startChildren();
for (ResolvedVariant variant : variants) {
formatter.node(variant.asDescribable().getCapitalizedDisplayName());
formatAttributeMatches(formatter, consumer, matcher, variant.getAttributes());
}
formatter.endChildren();
return formatter.toString();
}
use of org.gradle.internal.text.TreeFormatter in project gradle by gradle.
the class IncompatibleConfigurationSelectionException method generateMessage.
private static String generateMessage(AttributeContainerInternal fromConfigurationAttributes, AttributeMatcher attributeMatcher, ComponentResolveMetadata targetComponent, String targetConfiguration) {
TreeFormatter formatter = new TreeFormatter();
formatter.node("Configuration '" + targetConfiguration + "' in " + targetComponent.getId().getDisplayName() + " does not match the consumer attributes");
formatConfiguration(formatter, fromConfigurationAttributes, attributeMatcher, targetComponent.getConfiguration(targetConfiguration));
return formatter.toString();
}
Aggregations