Search in sources :

Example 1 with ComponentSpec

use of org.gradle.platform.base.ComponentSpec in project gradle by gradle.

the class DependentComponentsReport method getReportedComponents.

private Set<ComponentSpec> getReportedComponents(Set<ComponentSpec> allComponents) {
    if (components == null || components.isEmpty()) {
        return allComponents;
    }
    Set<ComponentSpec> reportedComponents = Sets.newLinkedHashSet();
    List<String> notFound = Lists.newArrayList(components);
    for (ComponentSpec candidate : allComponents) {
        String candidateName = candidate.getName();
        if (components.contains(candidateName)) {
            reportedComponents.add(candidate);
            notFound.remove(candidateName);
        }
    }
    if (!notFound.isEmpty()) {
        onComponentsNotFound(notFound);
    }
    return reportedComponents;
}
Also used : ComponentSpec(org.gradle.platform.base.ComponentSpec)

Example 2 with ComponentSpec

use of org.gradle.platform.base.ComponentSpec in project gradle by gradle.

the class DependentComponentsUtils method getAllComponents.

public static Set<ComponentSpec> getAllComponents(ModelRegistry registry) {
    Set<ComponentSpec> components = Sets.newLinkedHashSet();
    ComponentSpecContainer componentSpecs = modelElement(registry, "components", ComponentSpecContainer.class);
    if (componentSpecs != null) {
        components.addAll(componentSpecs.values());
    }
    return components;
}
Also used : ComponentSpecContainer(org.gradle.platform.base.ComponentSpecContainer) ComponentSpec(org.gradle.platform.base.ComponentSpec)

Example 3 with ComponentSpec

use of org.gradle.platform.base.ComponentSpec 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 4 with ComponentSpec

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

Aggregations

ComponentSpec (org.gradle.platform.base.ComponentSpec)4 Project (org.gradle.api.Project)2 TaskAction (org.gradle.api.tasks.TaskAction)2 StyledTextOutput (org.gradle.internal.logging.text.StyledTextOutput)2 ComponentSpecContainer (org.gradle.platform.base.ComponentSpecContainer)2 ArrayList (java.util.ArrayList)1 ComponentReportRenderer (org.gradle.api.reporting.components.internal.ComponentReportRenderer)1 TextDependentComponentsReportRenderer (org.gradle.api.reporting.dependents.internal.TextDependentComponentsReportRenderer)1 ProjectSourceSet (org.gradle.language.base.ProjectSourceSet)1 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)1 BinaryContainer (org.gradle.platform.base.BinaryContainer)1 DependentBinariesResolver (org.gradle.platform.base.internal.dependents.DependentBinariesResolver)1