当前位置: 首页>>代码示例>>Java>>正文


Java ComponentSpec类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:27,代码来源:DependentComponentsReport.java

示例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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:DependentComponentsReport.java

示例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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:DependentComponentsRenderableDependency.java

示例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());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:ComponentReportRenderer.java

示例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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:BaseBinarySpec.java

示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:DefaultComponentSpec.java

示例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());
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultLocalLibraryResolver.java

示例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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DependentComponentsUtils.java

示例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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DependentComponentsUtils.java

示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:DependentComponentsRenderer.java

示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:TextDependentComponentsReportRenderer.java

示例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();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:36,代码来源:ComponentReport.java

示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:ComponentReportRenderer.java

示例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");
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:ComponentRenderer.java

示例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();
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:39,代码来源:ComponentReport.java


注:本文中的org.gradle.platform.base.ComponentSpec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。