Search in sources :

Example 6 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 7 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 8 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)

Example 9 with StyledTextOutput

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

the class AbstractReportTaskTest method passesEachProjectToRenderer.

@Test
public void passesEachProjectToRenderer() throws IOException {
    final Project child1 = createChildProject(project, "child1");
    final Project child2 = createChildProject(project, "child2");
    task.setProjects(project.getAllprojects());
    context.checking(new Expectations() {

        {
            Sequence sequence = context.sequence("seq");
            one(renderer).setClientMetaData((BuildClientMetaData) with(notNullValue()));
            inSequence(sequence);
            one(renderer).setOutput((StyledTextOutput) with(notNullValue()));
            inSequence(sequence);
            one(renderer).startProject(project);
            inSequence(sequence);
            one(generator).run();
            inSequence(sequence);
            one(renderer).completeProject(project);
            inSequence(sequence);
            one(renderer).startProject(child1);
            inSequence(sequence);
            one(generator).run();
            inSequence(sequence);
            one(renderer).completeProject(child1);
            inSequence(sequence);
            one(renderer).startProject(child2);
            inSequence(sequence);
            one(generator).run();
            inSequence(sequence);
            one(renderer).completeProject(child2);
            inSequence(sequence);
            one(renderer).complete();
            inSequence(sequence);
        }
    });
    task.generate();
}
Also used : Expectations(org.jmock.Expectations) BuildClientMetaData(org.gradle.initialization.BuildClientMetaData) Project(org.gradle.api.Project) TestUtil.createChildProject(org.gradle.util.TestUtil.createChildProject) Sequence(org.jmock.Sequence) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) Test(org.junit.Test)

Example 10 with StyledTextOutput

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

the class AbstractReportTaskTest method completesRendererAtEndOfGeneration.

@Test
public void completesRendererAtEndOfGeneration() throws IOException {
    context.checking(new Expectations() {

        {
            Sequence sequence = context.sequence("sequence");
            one(renderer).setClientMetaData((BuildClientMetaData) with(notNullValue()));
            inSequence(sequence);
            one(renderer).setOutput((StyledTextOutput) with(notNullValue()));
            inSequence(sequence);
            one(renderer).startProject(project);
            inSequence(sequence);
            one(generator).run();
            inSequence(sequence);
            one(renderer).completeProject(project);
            inSequence(sequence);
            one(renderer).complete();
            inSequence(sequence);
        }
    });
    task.generate();
}
Also used : Expectations(org.jmock.Expectations) BuildClientMetaData(org.gradle.initialization.BuildClientMetaData) Sequence(org.jmock.Sequence) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) Test(org.junit.Test)

Aggregations

StyledTextOutput (org.gradle.internal.logging.text.StyledTextOutput)24 Project (org.gradle.api.Project)6 TaskAction (org.gradle.api.tasks.TaskAction)5 BuildClientMetaData (org.gradle.initialization.BuildClientMetaData)5 LinePrefixingStyledTextOutput (org.gradle.internal.logging.text.LinePrefixingStyledTextOutput)5 GraphRenderer (org.gradle.internal.graph.GraphRenderer)4 StringWriter (java.io.StringWriter)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 BufferingStyledTextOutput (org.gradle.internal.logging.text.BufferingStyledTextOutput)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 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 LinkedHashSet (java.util.LinkedHashSet)1