Search in sources :

Example 1 with StyledTextOutput

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

the class CacheStatisticsReporter method buildFinished.

@Override
public void buildFinished(TaskExecutionStatistics statistics) {
    StyledTextOutput textOutput = textOutputFactory.create(BuildResultLogger.class, LogLevel.LIFECYCLE);
    textOutput.println();
    int allTasks = statistics.getAllTasksCount();
    int allExecutedTasks = statistics.getTasksCount(TaskExecutionOutcome.EXECUTED);
    int skippedTasks = statistics.getTasksCount(TaskExecutionOutcome.SKIPPED);
    int upToDateTasks = statistics.getTasksCount(TaskExecutionOutcome.UP_TO_DATE);
    int noSourceTasks = statistics.getTasksCount(TaskExecutionOutcome.NO_SOURCE);
    int fromCacheTasks = statistics.getTasksCount(TaskExecutionOutcome.FROM_CACHE);
    int cacheableExecutedTasks = statistics.getCacheMissCount();
    int nonCacheableExecutedTasks = allExecutedTasks - cacheableExecutedTasks;
    textOutput.formatln("%d tasks in build, out of which %d (%d%%) were executed", allTasks, allExecutedTasks, roundedPercentOf(allExecutedTasks, allTasks));
    statisticsLine(textOutput, skippedTasks, allTasks, "skipped");
    statisticsLine(textOutput, upToDateTasks, allTasks, "up-to-date");
    statisticsLine(textOutput, noSourceTasks, allTasks, "no-source");
    statisticsLine(textOutput, fromCacheTasks, allTasks, "loaded from cache");
    statisticsLine(textOutput, cacheableExecutedTasks, allTasks, "cache miss");
    statisticsLine(textOutput, nonCacheableExecutedTasks, allTasks, "not cacheable");
}
Also used : StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput)

Example 2 with StyledTextOutput

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

the class DefaultTextReportBuilder method renderItem.

private void renderItem(Action<TextReportBuilder> action) {
    StyledTextOutput original = textOutput;
    int originalDepth = depth;
    boolean originalItems = hasTitledItems;
    try {
        hasTitledItems = false;
        action.execute(this);
    } finally {
        textOutput = original;
        depth = originalDepth;
        hasTitledItems = originalItems;
    }
}
Also used : LinePrefixingStyledTextOutput(org.gradle.internal.logging.text.LinePrefixingStyledTextOutput) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput)

Example 3 with StyledTextOutput

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

the class DefaultTextReportBuilder method item.

@Override
public void item(String title, String value) {
    hasTitledItems = true;
    StyledTextOutput itemOutput = new LinePrefixingStyledTextOutput(textOutput, INDENT, false);
    itemOutput.append(title).append(": ");
    itemOutput.append(value).println();
}
Also used : LinePrefixingStyledTextOutput(org.gradle.internal.logging.text.LinePrefixingStyledTextOutput) LinePrefixingStyledTextOutput(org.gradle.internal.logging.text.LinePrefixingStyledTextOutput) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput)

Example 4 with StyledTextOutput

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

the class Help method displayHelp.

@TaskAction
void displayHelp() {
    StyledTextOutput output = getTextOutputFactory().create(Help.class);
    BuildClientMetaData metaData = getClientMetaData();
    if (taskPath != null) {
        printTaskHelp(output);
    } else {
        printDefaultHelp(output, metaData);
    }
}
Also used : BuildClientMetaData(org.gradle.initialization.BuildClientMetaData) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) TaskAction(org.gradle.api.tasks.TaskAction)

Example 5 with StyledTextOutput

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

the class AsciiDependencyReportRenderer method startConfiguration.

@Override
public void startConfiguration(final Configuration configuration) {
    if (hasConfigs) {
        getTextOutput().println();
    }
    hasConfigs = true;
    GraphRenderer renderer = new GraphRenderer(getTextOutput());
    renderer.visit(new Action<StyledTextOutput>() {

        public void execute(StyledTextOutput styledTextOutput) {
            getTextOutput().withStyle(Identifier).text(configuration.getName());
            getTextOutput().withStyle(Description).text(getDescription(configuration));
            if (!configuration.isCanBeResolved()) {
                getTextOutput().withStyle(Info).text(" (n)");
            }
        }
    }, true);
    NodeRenderer nodeRenderer = new SimpleNodeRenderer();
    dependencyGraphRenderer = new DependencyGraphRenderer(renderer, nodeRenderer, legendRenderer);
}
Also used : NodeRenderer(org.gradle.api.tasks.diagnostics.internal.graph.NodeRenderer) SimpleNodeRenderer(org.gradle.api.tasks.diagnostics.internal.graph.SimpleNodeRenderer) DependencyGraphRenderer(org.gradle.api.tasks.diagnostics.internal.graph.DependencyGraphRenderer) GraphRenderer(org.gradle.internal.graph.GraphRenderer) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) SimpleNodeRenderer(org.gradle.api.tasks.diagnostics.internal.graph.SimpleNodeRenderer) DependencyGraphRenderer(org.gradle.api.tasks.diagnostics.internal.graph.DependencyGraphRenderer)

Aggregations

StyledTextOutput (org.gradle.internal.logging.text.StyledTextOutput)26 Project (org.gradle.api.Project)6 LinePrefixingStyledTextOutput (org.gradle.internal.logging.text.LinePrefixingStyledTextOutput)6 TaskAction (org.gradle.api.tasks.TaskAction)5 BuildClientMetaData (org.gradle.initialization.BuildClientMetaData)5 GraphRenderer (org.gradle.internal.graph.GraphRenderer)4 BufferingStyledTextOutput (org.gradle.internal.logging.text.BufferingStyledTextOutput)3 StringWriter (java.io.StringWriter)2 ArrayList (java.util.ArrayList)2 CircularReferenceException (org.gradle.api.CircularReferenceException)2 DependencyGraphRenderer (org.gradle.api.tasks.diagnostics.internal.graph.DependencyGraphRenderer)2 NodeRenderer (org.gradle.api.tasks.diagnostics.internal.graph.NodeRenderer)2 DirectedGraphRenderer (org.gradle.internal.graph.DirectedGraphRenderer)2 ModelNode (org.gradle.model.internal.core.ModelNode)2 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)2 ComponentSpec (org.gradle.platform.base.ComponentSpec)2 Expectations (org.jmock.Expectations)2 Sequence (org.jmock.Sequence)2 Test (org.junit.Test)2 Collection (java.util.Collection)1