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;
}
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;
}
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();
}
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();
}
}
Aggregations