Search in sources :

Example 1 with DependentBinariesResolver

use of org.gradle.platform.base.internal.dependents.DependentBinariesResolver 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)

Aggregations

TextDependentComponentsReportRenderer (org.gradle.api.reporting.dependents.internal.TextDependentComponentsReportRenderer)1 TaskAction (org.gradle.api.tasks.TaskAction)1 ProjectDetails (org.gradle.api.tasks.diagnostics.internal.ProjectDetails)1 StyledTextOutput (org.gradle.internal.logging.text.StyledTextOutput)1 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)1 ComponentSpec (org.gradle.platform.base.ComponentSpec)1 DependentBinariesResolver (org.gradle.platform.base.internal.dependents.DependentBinariesResolver)1