當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。