Search in sources :

Example 1 with ProjectDetails

use of org.gradle.api.tasks.diagnostics.internal.ProjectDetails in project gradle by gradle.

the class ComponentReport method report.

@TaskAction
public void report() {
    ProjectInternal project = (ProjectInternal) getProject();
    project.prepareForRuleBasedPlugins();
    StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
    ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver(), getBinaryRenderer());
    renderer.setOutput(textOutput);
    ProjectDetails projectDetails = ProjectDetails.of(project);
    renderer.startProject(projectDetails);
    Collection<ComponentSpec> components = new ArrayList<>();
    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(projectDetails);
    renderer.complete();
}
Also used : ProjectDetails(org.gradle.api.tasks.diagnostics.internal.ProjectDetails) ProjectSourceSet(org.gradle.language.base.ProjectSourceSet) ComponentSpecContainer(org.gradle.platform.base.ComponentSpecContainer) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) 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 2 with ProjectDetails

use of org.gradle.api.tasks.diagnostics.internal.ProjectDetails in project gradle by gradle.

the class DependentComponentsReport method report.

@TaskAction
public void report() {
    // Once we are here, the project lock is held. If we synchronize to avoid cross-project operations, we will have a dead lock.
    getWorkerLeaseService().runAsIsolatedTask(() -> {
        // Cross-project ModelRegistry operations do not happen concurrently.
        synchronized (DependentComponentsReport.class) {
            ((ProjectInternal) getProject()).getOwner().applyToMutableState(project -> {
                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);
                ProjectDetails projectDetails = ProjectDetails.of(project);
                reportRenderer.startProject(projectDetails);
                Set<ComponentSpec> allComponents = getAllComponents(modelRegistry);
                if (showTestSuites) {
                    allComponents.addAll(getAllTestSuites(modelRegistry));
                }
                reportRenderer.renderComponents(getReportedComponents(allComponents));
                reportRenderer.renderLegend();
                reportRenderer.completeProject(projectDetails);
                reportRenderer.complete();
            });
        }
    });
}
Also used : ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) ProjectDetails(org.gradle.api.tasks.diagnostics.internal.ProjectDetails) 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 3 with ProjectDetails

use of org.gradle.api.tasks.diagnostics.internal.ProjectDetails in project gradle by gradle.

the class ModelReport method report.

@TaskAction
public void report() {
    ProjectInternal project = (ProjectInternal) getProject();
    project.prepareForRuleBasedPlugins();
    StyledTextOutput textOutput = getTextOutputFactory().create(ModelReport.class);
    ModelNodeRenderer renderer = new ModelNodeRenderer(isShowHidden(), getFormat());
    TextModelReportRenderer textModelReportRenderer = new TextModelReportRenderer(renderer);
    textModelReportRenderer.setOutput(textOutput);
    ProjectDetails projectDetails = ProjectDetails.of(project);
    textModelReportRenderer.startProject(projectDetails);
    ModelRegistry modelRegistry = getModelRegistry();
    ModelNode rootNode = modelRegistry.realizeNode(ModelPath.ROOT);
    // Ensure binding validation has been done. This should happen elsewhere
    modelRegistry.bindAllReferences();
    textModelReportRenderer.render(rootNode);
    textModelReportRenderer.completeProject(projectDetails);
    textModelReportRenderer.complete();
}
Also used : ProjectDetails(org.gradle.api.tasks.diagnostics.internal.ProjectDetails) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ModelNodeRenderer(org.gradle.api.reporting.model.internal.ModelNodeRenderer) TextModelReportRenderer(org.gradle.api.reporting.model.internal.TextModelReportRenderer) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) ModelNode(org.gradle.model.internal.core.ModelNode) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

TaskAction (org.gradle.api.tasks.TaskAction)3 ProjectDetails (org.gradle.api.tasks.diagnostics.internal.ProjectDetails)3 StyledTextOutput (org.gradle.internal.logging.text.StyledTextOutput)3 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)2 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)2 ComponentSpec (org.gradle.platform.base.ComponentSpec)2 ArrayList (java.util.ArrayList)1 ComponentReportRenderer (org.gradle.api.reporting.components.internal.ComponentReportRenderer)1 TextDependentComponentsReportRenderer (org.gradle.api.reporting.dependents.internal.TextDependentComponentsReportRenderer)1 ModelNodeRenderer (org.gradle.api.reporting.model.internal.ModelNodeRenderer)1 TextModelReportRenderer (org.gradle.api.reporting.model.internal.TextModelReportRenderer)1 ProjectSourceSet (org.gradle.language.base.ProjectSourceSet)1 ModelNode (org.gradle.model.internal.core.ModelNode)1 BinaryContainer (org.gradle.platform.base.BinaryContainer)1 ComponentSpecContainer (org.gradle.platform.base.ComponentSpecContainer)1 DependentBinariesResolver (org.gradle.platform.base.internal.dependents.DependentBinariesResolver)1