本文整理汇总了Java中org.gradle.platform.base.ComponentSpec类的典型用法代码示例。如果您正苦于以下问题:Java ComponentSpec类的具体用法?Java ComponentSpec怎么用?Java ComponentSpec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComponentSpec类属于org.gradle.platform.base包,在下文中一共展示了ComponentSpec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: report
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
@TaskAction
public void report() {
// Output reports per execution, not mixed.
// 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();
}
}
示例2: getReportedComponents
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
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;
}
示例3: of
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
public static DependentComponentsRenderableDependency of(ComponentSpec componentSpec, ComponentSpecInternal internalProtocol, LinkedHashSet<DependentComponentsRenderableDependency> children) {
ComponentSpecIdentifier id = internalProtocol.getIdentifier();
String name = DependentComponentsUtils.getBuildScopedTerseName(id);
String description = componentSpec.getDisplayName();
boolean buildable = true;
if (componentSpec instanceof VariantComponentSpec) {
// Consider variant aware components with no buildable binaries as non-buildables
VariantComponentSpec variantComponentSpec = (VariantComponentSpec) componentSpec;
buildable = Iterables.any(variantComponentSpec.getBinaries().values(), new Predicate<BinarySpec>() {
@Override
public boolean apply(BinarySpec binarySpec) {
return binarySpec.isBuildable();
}
});
}
boolean testSuite = false;
return new DependentComponentsRenderableDependency(id, name, description, buildable, testSuite, children);
}
示例4: renderComponents
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
public void renderComponents(Collection<ComponentSpec> components) {
if (components.isEmpty()) {
getTextOutput().withStyle(Info).println("No components defined for this project.");
return;
}
boolean seen = false;
for (ComponentSpec component : components) {
if (seen) {
getBuilder().getOutput().println();
} else {
seen = true;
}
componentRenderer.render(component, getBuilder());
componentSourceSets.addAll(component.getSource());
componentBinaries.addAll(component.getBinaries());
}
}
示例5: getComponentAs
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
@Nullable
protected <T extends ComponentSpec> T getComponentAs(Class<T> componentType) {
if (componentNode == null) {
return null;
}
ModelType<T> modelType = ModelType.of(componentType);
return componentNode.canBeViewedAs(modelType)
? componentNode.asImmutable(modelType, componentNode.getDescriptor()).getInstance()
: null;
}
示例6: create
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
public static <T extends DefaultComponentSpec> T create(Class<? extends ComponentSpec> publicType, Class<T> implementationType, ComponentSpecIdentifier identifier, MutableModelNode modelNode) {
NEXT_COMPONENT_INFO.set(new ComponentInfo(identifier, modelNode, publicType));
try {
try {
return DirectInstantiator.INSTANCE.newInstance(implementationType);
} catch (ObjectInstantiationException e) {
throw new ModelInstantiationException(String.format("Could not create component of type %s", publicType.getSimpleName()), e.getCause());
}
} finally {
NEXT_COMPONENT_INFO.set(null);
}
}
示例7: collectLocalComponents
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
private void collectLocalComponents(ModelRegistry projectModel, String container, List<VariantComponent> librarySpecs) {
ModelMap<ComponentSpec> components = projectModel.find(container, COMPONENT_MAP_TYPE);
if (components != null) {
ModelMap<? extends VariantComponentSpec> libraries = components.withType(VariantComponentSpec.class);
librarySpecs.addAll(libraries.values());
}
}
示例8: getAllComponents
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
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;
}
示例9: getAllTestSuites
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
public static Set<ComponentSpec> getAllTestSuites(ModelRegistry registry) {
Set<ComponentSpec> components = Sets.newLinkedHashSet();
ModelMap<ComponentSpec> testSuites = modelElement(registry, "testSuites", modelMap(ComponentSpec.class));
if (testSuites != null) {
components.addAll(testSuites.values());
}
return components;
}
示例10: getRenderableDependencyOf
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
private DependentComponentsRenderableDependency getRenderableDependencyOf(final ComponentSpec componentSpec, ComponentSpecInternal internalProtocol) {
if (resolver != null && componentSpec instanceof VariantComponentSpec) {
VariantComponentSpec variantComponentSpec = (VariantComponentSpec) componentSpec;
LinkedHashSet<DependentComponentsRenderableDependency> children = Sets.newLinkedHashSet();
for (BinarySpecInternal binarySpec : variantComponentSpec.getBinaries().withType(BinarySpecInternal.class)) {
DependentBinariesResolutionResult resolvedBinary = resolver.resolve(binarySpec);
children.add(DependentComponentsRenderableDependency.of(resolvedBinary.getRoot()));
}
return DependentComponentsRenderableDependency.of(componentSpec, internalProtocol, children);
} else {
return DependentComponentsRenderableDependency.of(componentSpec, internalProtocol);
}
}
示例11: renderComponents
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
public void renderComponents(Set<ComponentSpec> components) {
if (components.isEmpty()) {
getTextOutput().withStyle(Info).println("No components.");
return;
}
for (ComponentSpec component : components) {
getBuilder().item(component, dependentComponentsRenderer);
}
}
示例12: report
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
@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();
}
示例13: renderComponents
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
public void renderComponents(Collection<ComponentSpec> components) {
if (components.isEmpty()) {
getTextOutput().withStyle(Info).println("No components defined for this project.");
return;
}
boolean seen = false;
for (ComponentSpec component : components) {
if (seen) {
getBuilder().getOutput().println();
} else {
seen = true;
}
getBuilder().item(component, componentRenderer);
}
}
示例14: render
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
@Override
public void render(ComponentSpec component, TextReportBuilder builder) {
builder.heading(StringUtils.capitalize(component.getDisplayName()));
if (component instanceof SourceComponentSpec) {
SourceComponentSpec sourceComponentSpec = (SourceComponentSpec) component;
builder.getOutput().println();
builder.collection("Source sets", CollectionUtils.sort(sourceComponentSpec.getSources().values(), SourceSetRenderer.SORT_ORDER), sourceSetRenderer, "source sets");
}
if (component instanceof VariantComponentSpec) {
VariantComponentSpec variantComponentSpec = (VariantComponentSpec) component;
builder.getOutput().println();
builder.collection("Binaries", CollectionUtils.sort(variantComponentSpec.getBinaries().values(), TypeAwareBinaryRenderer.SORT_ORDER), binaryRenderer, "binaries");
}
}
示例15: report
import org.gradle.platform.base.ComponentSpec; //导入依赖的package包/类
@TaskAction
public void report() {
Project project = getProject();
StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver());
renderer.setOutput(textOutput);
renderer.startProject(project);
Collection<ComponentSpec> components = new ArrayList<ComponentSpec>();
ComponentSpecContainer componentSpecs = project.getExtensions().findByType(ComponentSpecContainer.class);
if (componentSpecs != null) {
components.addAll(componentSpecs);
}
try {
TestSuiteContainer testSuites = getModelRegistry().get(ModelPath.path("testSuites"), ModelType.of(TestSuiteContainer.class));
components.addAll(testSuites);
} catch (IllegalStateException e) {
// TODO - need a better contract here
// Ignore for now
}
renderer.renderComponents(components);
ProjectSourceSet sourceSets = project.getExtensions().findByType(ProjectSourceSet.class);
if (sourceSets != null) {
renderer.renderSourceSets(sourceSets);
}
BinaryContainer binaries = project.getExtensions().findByType(BinaryContainer.class);
if (binaries != null) {
renderer.renderBinaries(binaries);
}
renderer.completeProject(project);
renderer.complete();
}