VariantSelector

public interface VariantSelector


Selector to reduce the number of variants that are of interests when calling any of the variant API like AndroidComponentsExtension.beforeVariants.

Summary

Public methods

abstract @NonNull VariantSelector
all()

Creates a VariantSelector of ComponentIdentity that includes all the variants for the current module.

abstract @NonNull VariantSelector

Returns a new selector for ComponentIdentity objects with a given build type.

abstract @NonNull VariantSelector
withFlavor(
    @NonNull Pair<@NonNull String, @NonNull String> flavorToDimension
)

Returns a new selector for ComponentIdentity objects with a given (dimension, flavorName).

abstract @NonNull VariantSelector
withFlavor(@NonNull String dimension, @NonNull String flavorName)

Returns a new selector for ComponentIdentity objects with a given (flavorName).

abstract @NonNull VariantSelector

Returns a new selector for ComponentIdentity objects with a given name.

abstract @NonNull VariantSelector

Returns a new selector for ComponentIdentity objects with a given name pattern.

Public methods

all

abstract @NonNull VariantSelector all()

Creates a VariantSelector of ComponentIdentity that includes all the variants for the current module.

Returns
@NonNull VariantSelector

a VariantSelector for all variants.

withBuildType

abstract @NonNull VariantSelector withBuildType(@NonNull String buildType)

Returns a new selector for ComponentIdentity objects with a given build type.

Parameters
@NonNull String buildType

Build type to filter ComponentIdentity on.

Returns
@NonNull VariantSelector

An instance of VariantSelector to further filter variants.

withFlavor

abstract @NonNull VariantSelector withFlavor(
    @NonNull Pair<@NonNull String, @NonNull String> flavorToDimension
)

Returns a new selector for ComponentIdentity objects with a given (dimension, flavorName).

Parameters
@NonNull Pair<@NonNull String, @NonNull String> flavorToDimension

Dimension and flavor to filter ComponentIdentity on.

Returns
@NonNull VariantSelector

VariantSelector instance to further filter instances of ComponentIdentity

withFlavor

abstract @NonNull VariantSelector withFlavor(@NonNull String dimension, @NonNull String flavorName)

Returns a new selector for ComponentIdentity objects with a given (flavorName).

Parameters
@NonNull String dimension

dimension name

@NonNull String flavorName

flavor name to filter ComponentIdentity on.

Returns
@NonNull VariantSelector

VariantSelector instance to further filter instances of ComponentIdentity

withName

abstract @NonNull VariantSelector withName(@NonNull String name)

Returns a new selector for ComponentIdentity objects with a given name.

Parameters
@NonNull String name

String to test against the org.gradle.api.Named.getName for equality.

withName

abstract @NonNull VariantSelector withName(@NonNull Pattern pattern)

Returns a new selector for ComponentIdentity objects with a given name pattern.

Parameters
@NonNull Pattern pattern

Pattern to apply on the org.gradle.api.Named.getName to filter ComponentIdentity instances on