Search in sources :

Example 1 with VariantComponentSpec

use of org.gradle.platform.base.VariantComponentSpec in project gradle by gradle.

the class NativeComponents method createBuildDependentComponentsTasks.

public static void createBuildDependentComponentsTasks(ModelMap<Task> tasks, ComponentSpecContainer components) {
    for (final VariantComponentSpec component : components.withType(NativeComponentSpec.class).withType(VariantComponentSpec.class)) {
        tasks.create(getAssembleDependentComponentsTaskName(component), DefaultTask.class, new Action<DefaultTask>() {

            @Override
            public void execute(DefaultTask assembleDependents) {
                assembleDependents.setGroup("Build Dependents");
                assembleDependents.setDescription("Assemble dependents of " + component.getDisplayName() + ".");
            }
        });
        tasks.create(getBuildDependentComponentsTaskName(component), DefaultTask.class, new Action<DefaultTask>() {

            @Override
            public void execute(DefaultTask buildDependents) {
                buildDependents.setGroup("Build Dependents");
                buildDependents.setDescription("Build dependents of " + component.getDisplayName() + ".");
            }
        });
    }
}
Also used : VariantComponentSpec(org.gradle.platform.base.VariantComponentSpec) NativeComponentSpec(org.gradle.nativeplatform.NativeComponentSpec) DefaultTask(org.gradle.api.DefaultTask)

Example 2 with VariantComponentSpec

use of org.gradle.platform.base.VariantComponentSpec in project gradle by gradle.

the class DependentComponentsRenderableDependency method of.

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);
}
Also used : ComponentSpecIdentifier(org.gradle.platform.base.internal.ComponentSpecIdentifier) VariantComponentSpec(org.gradle.platform.base.VariantComponentSpec) BinarySpec(org.gradle.platform.base.BinarySpec) Predicate(com.google.common.base.Predicate)

Example 3 with VariantComponentSpec

use of org.gradle.platform.base.VariantComponentSpec in project gradle by gradle.

the class DependentComponentsRenderer method getRenderableDependencyOf.

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);
    }
}
Also used : VariantComponentSpec(org.gradle.platform.base.VariantComponentSpec) BinarySpecInternal(org.gradle.platform.base.internal.BinarySpecInternal) DependentBinariesResolutionResult(org.gradle.platform.base.internal.dependents.DependentBinariesResolutionResult)

Example 4 with VariantComponentSpec

use of org.gradle.platform.base.VariantComponentSpec in project gradle by gradle.

the class ComponentRenderer method render.

@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");
    }
}
Also used : VariantComponentSpec(org.gradle.platform.base.VariantComponentSpec) SourceComponentSpec(org.gradle.platform.base.SourceComponentSpec)

Aggregations

VariantComponentSpec (org.gradle.platform.base.VariantComponentSpec)4 Predicate (com.google.common.base.Predicate)1 DefaultTask (org.gradle.api.DefaultTask)1 NativeComponentSpec (org.gradle.nativeplatform.NativeComponentSpec)1 BinarySpec (org.gradle.platform.base.BinarySpec)1 SourceComponentSpec (org.gradle.platform.base.SourceComponentSpec)1 BinarySpecInternal (org.gradle.platform.base.internal.BinarySpecInternal)1 ComponentSpecIdentifier (org.gradle.platform.base.internal.ComponentSpecIdentifier)1 DependentBinariesResolutionResult (org.gradle.platform.base.internal.dependents.DependentBinariesResolutionResult)1