Search in sources :

Example 36 with TreeFormatter

use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.

the class TextDependencyVerificationReportRenderer method startNewSection.

@Override
public void startNewSection(String title) {
    formatter = new TreeFormatter();
    formatter.node("Dependency verification failed for " + title);
}
Also used : TreeFormatter(org.gradle.internal.logging.text.TreeFormatter)

Example 37 with TreeFormatter

use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.

the class SimpleTextDependencyVerificationReportRenderer method startNewSection.

@Override
public void startNewSection(String title) {
    formatter = new TreeFormatter();
    formatter.node("Dependency verification failed for " + title);
}
Also used : TreeFormatter(org.gradle.internal.logging.text.TreeFormatter)

Example 38 with TreeFormatter

use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.

the class NodeState method computePathToRoot.

private String computePathToRoot() {
    TreeFormatter formatter = new TreeFormatter();
    formatter.node(getSimpleName());
    NodeState from = this;
    int depth = 0;
    do {
        from = getFromNode(from);
        if (from != null) {
            formatter.startChildren();
            formatter.node(from.getSimpleName());
            depth++;
        }
    } while (from != null && !(from instanceof RootNode));
    for (int i = 0; i < depth; i++) {
        formatter.endChildren();
    }
    formatter.node("Dependency resolution has ignored the cycle to produce a result. It is recommended to resolve the cycle by upgrading one or more dependencies.");
    return formatter.toString();
}
Also used : TreeFormatter(org.gradle.internal.logging.text.TreeFormatter)

Example 39 with TreeFormatter

use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.

the class VersionConflictException method buildMessage.

private static String buildMessage(String projectPath, String configurationName, Collection<Pair<List<? extends ModuleVersionIdentifier>, String>> conflicts) {
    TreeFormatter formatter = new TreeFormatter();
    String dependencyNotation = null;
    int count = 0;
    formatter.node("Conflict(s) found for the following module(s)");
    formatter.startChildren();
    for (Pair<List<? extends ModuleVersionIdentifier>, String> allConflict : conflicts) {
        if (count > MAX_SEEN_MODULE_COUNT) {
            formatter.node("... and more");
            break;
        }
        formatter.node(allConflict.right);
        count++;
        if (dependencyNotation == null) {
            ModuleVersionIdentifier identifier = allConflict.getLeft().get(0);
            dependencyNotation = identifier.getGroup() + ":" + identifier.getName();
        }
    }
    formatter.endChildren();
    appendInsight(projectPath, configurationName, formatter, dependencyNotation);
    return formatter.toString();
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) TreeFormatter(org.gradle.internal.logging.text.TreeFormatter) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList)

Example 40 with TreeFormatter

use of org.gradle.internal.logging.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 + " with requested attributes");
    formatAttributes(formatter, requested);
    formatter.node("Found the following transforms");
    Map<ResolvedVariant, List<ConsumerVariantMatchResult.ConsumerVariant>> variantToTransforms = candidates.stream().collect(Collectors.toMap(Pair::getLeft, candidate -> Lists.newArrayList(candidate.getRight()), (List<ConsumerVariantMatchResult.ConsumerVariant> orig, List<ConsumerVariantMatchResult.ConsumerVariant> add) -> {
        orig.addAll(add);
        return orig;
    }, LinkedHashMap::new));
    formatter.startChildren();
    for (Map.Entry<ResolvedVariant, List<ConsumerVariantMatchResult.ConsumerVariant>> entry : variantToTransforms.entrySet()) {
        formatter.node("From '" + entry.getKey().asDescribable().getDisplayName() + "'");
        formatter.startChildren();
        formatter.node("With source attributes");
        formatAttributes(formatter, entry.getKey().getAttributes());
        formatter.node("Candidate transform(s)");
        formatter.startChildren();
        for (ConsumerVariantMatchResult.ConsumerVariant transform : entry.getValue()) {
            formatter.node("Transform '" + transform.transformation.getDisplayName() + "' producing attributes:");
            formatAttributes(formatter, transform.attributes);
        }
        formatter.endChildren();
        formatter.endChildren();
    }
    formatter.endChildren();
    return formatter.toString();
}
Also used : ResolvedVariant(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedVariant) Pair(org.gradle.internal.Pair) LinkedHashMap(java.util.LinkedHashMap) List(java.util.List) Lists(com.google.common.collect.Lists) AmbiguousVariantSelectionException.formatAttributes(org.gradle.internal.component.AmbiguousVariantSelectionException.formatAttributes) TreeFormatter(org.gradle.internal.logging.text.TreeFormatter) Map(java.util.Map) VariantSelectionException(org.gradle.internal.component.VariantSelectionException) Collectors(java.util.stream.Collectors) AttributeContainerInternal(org.gradle.api.internal.attributes.AttributeContainerInternal) TreeFormatter(org.gradle.internal.logging.text.TreeFormatter) ResolvedVariant(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedVariant) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

TreeFormatter (org.gradle.internal.logging.text.TreeFormatter)46 ImmutableList (com.google.common.collect.ImmutableList)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Nullable (javax.annotation.Nullable)3 GradleException (org.gradle.api.GradleException)3 VariantTransformConfigurationException (org.gradle.api.artifacts.transform.VariantTransformConfigurationException)3 ResolvedVariant (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedVariant)3 Lists (com.google.common.collect.Lists)2 File (java.io.File)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 InvalidUserDataException (org.gradle.api.InvalidUserDataException)2 ArtifactTransformRegistration (org.gradle.api.internal.artifacts.ArtifactTransformRegistration)2 ConfigurationMetadata (org.gradle.internal.component.model.ConfigurationMetadata)2 ClassGenerationException (org.gradle.internal.instantiation.ClassGenerationException)2 Solution (org.gradle.problems.Solution)2 ImmutableMap (com.google.common.collect.ImmutableMap)1