Search in sources :

Example 11 with TreeFormatter

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

the class ProjectLayoutSetupRegistry method get.

/**
 * Locates the {@link BuildInitializer} with the given type.
 */
public BuildInitializer get(String type) {
    if (!registeredProjectDescriptors.containsKey(type)) {
        TreeFormatter formatter = new TreeFormatter();
        formatter.node("The requested build type '" + type + "' is not supported. Supported types");
        formatter.startChildren();
        for (String candidate : getAllTypes()) {
            formatter.node("'" + candidate + "'");
        }
        formatter.endChildren();
        throw new GradleException(formatter.toString());
    }
    return registeredProjectDescriptors.get(type);
}
Also used : TreeFormatter(org.gradle.internal.logging.text.TreeFormatter) GradleException(org.gradle.api.GradleException)

Example 12 with TreeFormatter

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

the class AbstractBinaryRenderer method renderBuildAbility.

private void renderBuildAbility(BinarySpec binary, TextReportBuilder builder) {
    BinaryBuildAbility buildAbility = ((BinarySpecInternal) binary).getBuildAbility();
    if (!buildAbility.isBuildable()) {
        TreeFormatter formatter = new TreeFormatter();
        buildAbility.explain(formatter);
        builder.item(formatter.toString());
    }
}
Also used : BinarySpecInternal(org.gradle.platform.base.internal.BinarySpecInternal) BinaryBuildAbility(org.gradle.platform.base.internal.BinaryBuildAbility) TreeFormatter(org.gradle.internal.logging.text.TreeFormatter)

Example 13 with TreeFormatter

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

the class LockOutOfDateException method createLockOutOfDateException.

public static LockOutOfDateException createLockOutOfDateException(String configurationName, Iterable<String> errors) {
    TreeFormatter treeFormatter = new TreeFormatter();
    treeFormatter.node("Dependency lock state for configuration '" + configurationName + "' is out of date");
    treeFormatter.startChildren();
    for (String error : errors) {
        treeFormatter.node(error);
    }
    treeFormatter.endChildren();
    return new LockOutOfDateException(treeFormatter.toString(), ImmutableList.copyOf(errors));
}
Also used : TreeFormatter(org.gradle.internal.logging.text.TreeFormatter)

Example 14 with TreeFormatter

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

the class AbstractMinimalProvider method cannotQueryValueOf.

private String cannotQueryValueOf(Value<? extends T> value) {
    TreeFormatter formatter = new TreeFormatter();
    formatter.node("Cannot query the value of ").append(getDisplayName().getDisplayName()).append(" because it has no value available.");
    if (!value.getPathToOrigin().isEmpty()) {
        formatter.node("The value of ").append(getTypedDisplayName().getDisplayName()).append(" is derived from");
        formatter.startChildren();
        for (DisplayName displayName : value.getPathToOrigin()) {
            formatter.node(displayName.getDisplayName());
        }
        formatter.endChildren();
    }
    return formatter.toString();
}
Also used : TreeFormatter(org.gradle.internal.logging.text.TreeFormatter) DisplayName(org.gradle.internal.DisplayName)

Example 15 with TreeFormatter

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

the class AbstractProperty method getProducerTask.

@Nullable
private Task getProducerTask() {
    if (producer == null) {
        return null;
    }
    Task task = producer.getTaskThatOwnsThisObject();
    if (task == null) {
        TreeFormatter formatter = new TreeFormatter();
        formatter.node(getDisplayName().getCapitalizedDisplayName());
        formatter.append(" is declared as an output property of ");
        format(producer, formatter);
        formatter.append(" but does not have a task associated with it.");
        throw new IllegalStateException(formatter.toString());
    }
    return task;
}
Also used : Task(org.gradle.api.Task) TreeFormatter(org.gradle.internal.logging.text.TreeFormatter) Nullable(javax.annotation.Nullable)

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