Search in sources :

Example 21 with StyledTextOutput

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

the class ComponentReport method report.

@TaskAction
public void report() {
    Project project = getProject();
    StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
    ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver(), getBinaryRenderer());
    renderer.setOutput(textOutput);
    renderer.startProject(project);
    Collection<ComponentSpec> components = new ArrayList<ComponentSpec>();
    ComponentSpecContainer componentSpecs = modelElement("components", ComponentSpecContainer.class);
    if (componentSpecs != null) {
        components.addAll(componentSpecs.values());
    }
    ModelMap<ComponentSpec> testSuites = modelElement("testSuites", modelMap(ComponentSpec.class));
    if (testSuites != null) {
        components.addAll(testSuites.values());
    }
    renderer.renderComponents(components);
    ProjectSourceSet sourceSets = modelElement("sources", ProjectSourceSet.class);
    if (sourceSets != null) {
        renderer.renderSourceSets(sourceSets);
    }
    BinaryContainer binaries = modelElement("binaries", BinaryContainer.class);
    if (binaries != null) {
        renderer.renderBinaries(binaries.values());
    }
    renderer.completeProject(project);
    renderer.complete();
}
Also used : Project(org.gradle.api.Project) ProjectSourceSet(org.gradle.language.base.ProjectSourceSet) ComponentSpecContainer(org.gradle.platform.base.ComponentSpecContainer) ComponentReportRenderer(org.gradle.api.reporting.components.internal.ComponentReportRenderer) BinaryContainer(org.gradle.platform.base.BinaryContainer) ArrayList(java.util.ArrayList) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) ComponentSpec(org.gradle.platform.base.ComponentSpec) TaskAction(org.gradle.api.tasks.TaskAction)

Example 22 with StyledTextOutput

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

the class DependentComponentsReport method report.

@TaskAction
public void report() {
    // Cross-project ModelRegistry operations do not happen concurrently.
    synchronized (DependentComponentsReport.class) {
        Project project = getProject();
        ModelRegistry modelRegistry = getModelRegistry();
        DependentBinariesResolver dependentBinariesResolver = modelRegistry.find("dependentBinariesResolver", DependentBinariesResolver.class);
        StyledTextOutput textOutput = getTextOutputFactory().create(DependentComponentsReport.class);
        TextDependentComponentsReportRenderer reportRenderer = new TextDependentComponentsReportRenderer(dependentBinariesResolver, showNonBuildable, showTestSuites);
        reportRenderer.setOutput(textOutput);
        reportRenderer.startProject(project);
        Set<ComponentSpec> allComponents = getAllComponents(modelRegistry);
        if (showTestSuites) {
            allComponents.addAll(getAllTestSuites(modelRegistry));
        }
        reportRenderer.renderComponents(getReportedComponents(allComponents));
        reportRenderer.renderLegend();
        reportRenderer.completeProject(project);
        reportRenderer.complete();
    }
}
Also used : Project(org.gradle.api.Project) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) DependentBinariesResolver(org.gradle.platform.base.internal.dependents.DependentBinariesResolver) TextDependentComponentsReportRenderer(org.gradle.api.reporting.dependents.internal.TextDependentComponentsReportRenderer) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) ComponentSpec(org.gradle.platform.base.ComponentSpec) TaskAction(org.gradle.api.tasks.TaskAction)

Example 23 with StyledTextOutput

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

the class TaskReportRenderer method complete.

@Override
public void complete() {
    if (!detail) {
        StyledTextOutput output = getTextOutput();
        BuildClientMetaData clientMetaData = getClientMetaData();
        output.println();
        output.text("To see all tasks and more detail, run ");
        clientMetaData.describeCommand(output.withStyle(UserInput), "tasks --all");
        output.println();
        output.println();
        output.text("To see more detail about a task, run ");
        clientMetaData.describeCommand(output.withStyle(UserInput), "help --task <task>");
        output.println();
    }
    super.complete();
}
Also used : BuildClientMetaData(org.gradle.initialization.BuildClientMetaData) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput)

Example 24 with StyledTextOutput

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

the class ReportGeneratingProfileListener method renderReportUrl.

private void renderReportUrl(File reportFile) {
    StyledTextOutput textOutput = textOutputFactory.create(ReportGeneratingProfileListener.class, LogLevel.LIFECYCLE);
    textOutput.println();
    String reportUrl = new ConsoleRenderer().asClickableFileUrl(reportFile);
    textOutput.formatln("See the profiling report at: %s", reportUrl);
}
Also used : ConsoleRenderer(org.gradle.internal.logging.ConsoleRenderer) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput)

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