use of org.gradle.platform.base.ComponentSpecContainer 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.ComponentSpecContainer in project gradle by gradle.
the class ProjectLibraryBinaryLocator method getBinaries.
// Converts the binaries of a project library into regular binary instances
@Nullable
@Override
public DomainObjectSet<NativeLibraryBinary> getBinaries(LibraryIdentifier libraryIdentifier) {
ModelRegistry projectModel = projectModelResolver.resolveProjectModel(libraryIdentifier.getProjectPath());
ComponentSpecContainer components = projectModel.find("components", ComponentSpecContainer.class);
if (components == null) {
return null;
}
String libraryName = libraryIdentifier.getLibraryName();
NativeLibrarySpec library = components.withType(NativeLibrarySpec.class).get(libraryName);
if (library == null) {
return null;
}
ModelMap<NativeBinarySpec> projectBinaries = library.getBinaries().withType(NativeBinarySpec.class);
DomainObjectSet<NativeLibraryBinary> binaries = new DefaultDomainObjectSet<NativeLibraryBinary>(NativeLibraryBinary.class);
for (NativeBinarySpec nativeBinarySpec : projectBinaries.values()) {
binaries.add((NativeLibraryBinary) nativeBinarySpec);
}
return binaries;
}
use of org.gradle.platform.base.ComponentSpecContainer 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();
}
Aggregations