T - the type used for the Build Type.D - the type used for the default configF - the type used for the product flavors.public class VariantConfiguration<T extends com.android.builder.model.BuildType,D extends com.android.builder.model.ProductFlavor,F extends com.android.builder.model.ProductFlavor>
extends java.lang.Object
| Constructor and Description |
|---|
VariantConfiguration(D defaultConfig,
com.android.builder.model.SourceProvider defaultSourceProvider,
ManifestAttributeSupplier mainManifestAttributeSupplier,
T buildType,
com.android.builder.model.SourceProvider buildTypeSourceProvider,
VariantType type,
com.android.builder.model.SigningConfig signingConfigOverride)
Creates the configuration with the base source sets for a given
VariantType. |
VariantConfiguration(D defaultConfig,
com.android.builder.model.SourceProvider defaultSourceProvider,
ManifestAttributeSupplier mainManifestAttributeSupplier,
T buildType,
com.android.builder.model.SourceProvider buildTypeSourceProvider,
VariantType type,
VariantConfiguration<T,D,F> testedConfig,
com.android.builder.model.SigningConfig signingConfigOverride)
Creates the configuration with the base source sets, and an optional tested variant.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBuildConfigField(java.lang.String type,
java.lang.String name,
java.lang.String value)
Adds a variant-specific BuildConfig field.
|
VariantConfiguration |
addProductFlavor(F productFlavor,
com.android.builder.model.SourceProvider sourceProvider,
java.lang.String dimensionName)
Add a new configured ProductFlavor.
|
void |
addResValue(java.lang.String type,
java.lang.String name,
java.lang.String value)
Adds a variant-specific res value.
|
java.lang.String |
computeBaseNameWithSplits(java.lang.String splitName)
Returns a base name that includes the given splits name.
|
java.lang.String |
computeDirNameWithSplits(java.lang.String... splitNames)
Returns a unique directory name (can include multiple folders) for the variant,
based on build type, flavor and test, and splits.
|
static <F extends com.android.builder.model.ProductFlavor> |
computeFlavorName(java.util.List<F> flavors)
Returns the flavor name for a variant composed of the given flavors, including all
flavor names in camel case (starting with a lower case).
|
static <B extends com.android.builder.model.BuildType> |
computeFullName(java.lang.String flavorName,
B buildType,
VariantType type,
VariantType testedType)
Returns the full, unique name of the variant in camel case (starting with a lower case),
including BuildType, Flavors and Test (if applicable).
|
java.lang.String |
computeFullNameWithSplits(java.lang.String splitName)
Returns a full name that includes the given splits name.
|
java.util.List<java.io.File> |
getAidlSourceList() |
java.lang.String |
getApplicationId()
Returns the application ID for this variant.
|
java.util.List<com.android.ide.common.res2.AssetSet> |
getAssetSets()
Returns the dynamic list of
AssetSet based on the configuration, its dependencies,
as well as tested config if applicable (test of a library). |
java.lang.String |
getBaseName()
Returns the full, unique name of the variant, including BuildType, flavors and test,
dash separated.
|
java.util.List<java.lang.Object> |
getBuildConfigItems()
Returns a list of items for the BuildConfig class.
|
T |
getBuildType() |
com.android.builder.model.SourceProvider |
getBuildTypeSourceSet()
The SourceProvider for the BuildType.
|
java.util.List<java.lang.Object> |
getConsumerProguardFiles() |
D |
getDefaultConfig() |
com.android.builder.model.SourceProvider |
getDefaultSourceSet() |
DexingType |
getDexingType() |
java.util.Collection<java.lang.String> |
getDirectorySegments()
Returns a unique directory name (can include multiple folders) for the variant,
based on build type, flavor and test.
|
java.lang.String |
getDirName()
Returns a unique directory name (can include multiple folders) for the variant,
based on build type, flavor and test.
|
java.lang.String |
getFlavorName()
Returns the flavor name of the variant, including all flavors in camel case (starting
with a lower case).
|
java.util.List<java.lang.String> |
getFlavorNamesWithDimensionNames()
Return the names of the applied flavors.
|
java.util.List<com.android.builder.model.SourceProvider> |
getFlavorSourceProviders()
Returns the list of SourceProviders for the flavors.
|
java.lang.String |
getFullName()
Returns the full, unique name of the variant in camel case (starting with a lower case),
including BuildType, Flavors and Test (if applicable).
|
java.lang.Boolean |
getFunctionalTest()
Returns functionalTest value to use to test this variant, or if the
variant is a test, the one to use to test the tested variant.
|
java.lang.Boolean |
getFunctionalTestFromManifest() |
java.lang.Boolean |
getHandleProfiling()
Returns handleProfiling value to use to test this variant, or if the
variant is a test, the one to use to test the tested variant.
|
java.lang.Boolean |
getHandleProfilingFromManifest() |
java.lang.String |
getIdOverride()
Returns the application id override value coming from the Product Flavor and/or the
Build Type.
|
java.lang.String |
getInstrumentationRunner()
Returns the instrumentationRunner to use to test this variant, or if the
variant is a test, the one to use to test the tested variant.
|
java.util.Map<java.lang.String,java.lang.String> |
getInstrumentationRunnerArguments()
Returns the instrumentationRunner arguments to use to test this variant, or if the
variant is a test, the ones to use to test the tested variant
|
java.lang.String |
getInstrumentationRunnerFromManifest() |
java.util.Collection<java.io.File> |
getJarJarRuleFiles() |
java.util.List<com.android.ide.common.res2.AssetSet> |
getJniLibsSets()
Returns the dynamic list of
AssetSet based on the configuration, its dependencies,
as well as tested config if applicable (test of a library). |
java.util.List<java.io.File> |
getJniSourceList() |
java.io.File |
getMainManifest() |
java.util.List<java.io.File> |
getManifestOverlays() |
java.util.Map<java.lang.String,java.lang.Object> |
getManifestPlaceholders()
Returns the merged manifest placeholders.
|
java.util.Map<java.lang.String,com.android.builder.model.ClassField> |
getMergedBuildConfigFields()
Return the merged build config fields for the variant.
|
com.android.builder.model.ProductFlavor |
getMergedFlavor() |
java.util.Map<java.lang.String,com.android.builder.model.ClassField> |
getMergedResValues()
Return the merged res values for the variant.
|
com.android.sdklib.AndroidVersion |
getMinSdkVersion()
Return the minSdkVersion for this variant.
|
int |
getMinSdkVersionValue()
Returns the minSdkVersion as integer.
|
java.io.File |
getMultiDexKeepFile() |
java.io.File |
getMultiDexKeepProguard() |
com.android.builder.model.SourceProvider |
getMultiFlavorSourceProvider() |
java.lang.String |
getOriginalApplicationId()
Returns the original application ID before any overrides from flavors.
|
AndroidDependency |
getOutput()
Returns the
AndroidLibrary that this library variant produces. |
java.lang.String |
getPackageFromManifest()
Reads the package name from the manifest.
|
java.util.List<F> |
getProductFlavors()
Returns the product flavors.
|
java.util.Set<java.io.File> |
getProguardFiles(java.util.List<java.io.File> defaultProguardConfig)
Returns the proguard config files coming from the project.
|
boolean |
getRenderscriptNdkModeEnabled()
Returns the renderscript NDK mode.
|
java.util.List<java.io.File> |
getRenderscriptSourceList()
Returns all the renderscript source folder from the main config, the flavors and the
build type.
|
boolean |
getRenderscriptSupportModeBlasEnabled()
Returns the renderscript BLAS support mode.
|
boolean |
getRenderscriptSupportModeEnabled()
Returns the renderscript support mode.
|
int |
getRenderscriptTarget() |
java.util.Set<java.io.File> |
getResourceFolders()
returns all the resource folders from all the sourcesets.
|
java.util.List<com.android.ide.common.res2.ResourceSet> |
getResourceSets(boolean validateEnabled)
Returns the dynamic list of
ResourceSet for the source folders only. |
java.util.List<java.lang.Object> |
getResValues()
Returns a list of generated resource values.
|
java.util.List<com.android.ide.common.res2.AssetSet> |
getShaderSets()
Returns the dynamic list of
AssetSet based on the configuration, its dependencies,
as well as tested config if applicable (test of a library). |
com.android.builder.model.SigningConfig |
getSigningConfig() |
java.util.List<com.android.builder.model.SourceProvider> |
getSortedSourceProviders()
Returns a list of sorted SourceProvider in order of ascending order, meaning, the earlier
items are meant to be overridden by later items.
|
java.lang.String |
getSplitFromManifest()
Reads the split name from the manifest.
|
com.android.builder.model.ApiVersion |
getTargetSdkVersion()
Return the targetSdkVersion for this variant.
|
java.lang.String |
getTestApplicationId() |
java.lang.String |
getTestedApplicationId() |
java.lang.String |
getTestedApplicationIdFromManifest() |
VariantConfiguration |
getTestedConfig() |
java.lang.String |
getTestLabel()
Gets the test label for this variant
|
java.lang.String |
getTestLabelFromManifest() |
java.util.Set<java.io.File> |
getTestProguardFiles()
Returns the proguard config files to be used for the test APK.
|
VariantType |
getType() |
com.android.builder.model.SourceProvider |
getVariantSourceProvider()
Returns the variant specific source provider
|
int |
getVersionCode()
Returns the version code for this variant.
|
int |
getVersionCodeFromManifest() |
java.lang.String |
getVersionName()
Returns the version name for this variant.
|
java.lang.String |
getVersionNameFromManifest() |
boolean |
hasFlavors() |
boolean |
isBundled()
Returns true if the variant output is a bundle.
|
boolean |
isLegacyMultiDexMode() |
boolean |
isMultiDexEnabled() |
boolean |
isSigningReady() |
boolean |
isTestCoverageEnabled() |
VariantConfiguration |
setMultiFlavorSourceProvider(com.android.builder.model.SourceProvider sourceProvider)
Sets the variant-specific source provider.
|
VariantConfiguration |
setOutput(AndroidDependency output)
Sets the output of this variant.
|
VariantConfiguration |
setVariantSourceProvider(com.android.builder.model.SourceProvider sourceProvider)
Sets the variant-specific source provider.
|
public VariantConfiguration(@NonNull
D defaultConfig,
@NonNull
com.android.builder.model.SourceProvider defaultSourceProvider,
@Nullable
ManifestAttributeSupplier mainManifestAttributeSupplier,
@NonNull
T buildType,
@Nullable
com.android.builder.model.SourceProvider buildTypeSourceProvider,
@NonNull
VariantType type,
@Nullable
com.android.builder.model.SigningConfig signingConfigOverride)
VariantType. Meant
for non-testing variants.defaultConfig - the default configuration. Required.defaultSourceProvider - the default source provider. RequiredbuildType - the build type for this variant. Required.buildTypeSourceProvider - the source provider for the build type.type - the type of the project.signingConfigOverride - an optional Signing override to be used for signing.public VariantConfiguration(@NonNull
D defaultConfig,
@NonNull
com.android.builder.model.SourceProvider defaultSourceProvider,
@Nullable
ManifestAttributeSupplier mainManifestAttributeSupplier,
@NonNull
T buildType,
@Nullable
com.android.builder.model.SourceProvider buildTypeSourceProvider,
@NonNull
VariantType type,
@Nullable
VariantConfiguration<T,D,F> testedConfig,
@Nullable
com.android.builder.model.SigningConfig signingConfigOverride)
defaultConfig - the default configuration. Required.defaultSourceProvider - the default source provider. RequiredbuildType - the build type for this variant. Required.buildTypeSourceProvider - the source provider for the build type.type - the type of the project.testedConfig - the reference to the tested project. Required if type is
Type.ANDROID_TESTsigningConfigOverride - an optional Signing override to be used for signing.@NonNull public java.lang.String getFullName()
@NonNull
public static <B extends com.android.builder.model.BuildType> java.lang.String computeFullName(@NonNull
java.lang.String flavorName,
@NonNull
B buildType,
@NonNull
VariantType type,
@Nullable
VariantType testedType)
flavorName - the flavor name, as computed by computeFlavorName(List)buildType - the build typetype - the variant type@NonNull
public java.lang.String computeFullNameWithSplits(@NonNull
java.lang.String splitName)
splitName - the split name@NonNull public java.lang.String getFlavorName()
public static <F extends com.android.builder.model.ProductFlavor> java.lang.String computeFlavorName(@NonNull
java.util.List<F> flavors)
flavors - the list of flavors@NonNull public java.lang.String getBaseName()
@NonNull
public java.lang.String computeBaseNameWithSplits(@NonNull
java.lang.String splitName)
splitName - the split name@NonNull public java.lang.String getDirName()
This always uses forward slashes ('/') as separator on all platform.
@NonNull public java.util.Collection<java.lang.String> getDirectorySegments()
@NonNull
public java.lang.String computeDirNameWithSplits(@NonNull
java.lang.String... splitNames)
This always uses forward slashes ('/') as separator on all platform.
@NonNull public java.util.List<java.lang.String> getFlavorNamesWithDimensionNames()
@NonNull public VariantConfiguration addProductFlavor(@NonNull F productFlavor, @NonNull com.android.builder.model.SourceProvider sourceProvider, @NonNull java.lang.String dimensionName)
productFlavor - the configured product flavorsourceProvider - the source provider for the product flavordimensionName - the name of the dimension associated with the flavorpublic VariantConfiguration setVariantSourceProvider(@Nullable com.android.builder.model.SourceProvider sourceProvider)
sourceProvider - the source provider for the product flavorpublic VariantConfiguration setMultiFlavorSourceProvider(@Nullable com.android.builder.model.SourceProvider sourceProvider)
sourceProvider - the source provider for the product flavor@Nullable public com.android.builder.model.SourceProvider getVariantSourceProvider()
@Nullable public com.android.builder.model.SourceProvider getMultiFlavorSourceProvider()
@NonNull public VariantConfiguration setOutput(AndroidDependency output)
output - the output of the library as an AndroidLibrary that will provides the
location of all the created items.@Nullable public AndroidDependency getOutput()
AndroidLibrary that this library variant produces. Used so that
related test variants can use it as a dependency. Returns null if this is not a library
variant.mOutput@NonNull public D getDefaultConfig()
@NonNull public com.android.builder.model.SourceProvider getDefaultSourceSet()
@NonNull public com.android.builder.model.ProductFlavor getMergedFlavor()
@NonNull public T getBuildType()
@Nullable public com.android.builder.model.SourceProvider getBuildTypeSourceSet()
public boolean hasFlavors()
@NonNull public java.util.List<F> getProductFlavors()
@NonNull public java.util.List<com.android.builder.model.SourceProvider> getFlavorSourceProviders()
@NonNull public VariantType getType()
@Nullable public VariantConfiguration getTestedConfig()
@Nullable public java.lang.String getOriginalApplicationId()
getApplicationId()@NonNull public java.lang.String getApplicationId()
@NonNull public java.lang.String getTestApplicationId()
@Nullable public java.lang.String getTestedApplicationId()
@Nullable public java.lang.String getIdOverride()
@Nullable public java.lang.String getVersionName()
public int getVersionCode()
@NonNull public java.lang.String getInstrumentationRunner()
@NonNull public java.util.Map<java.lang.String,java.lang.String> getInstrumentationRunnerArguments()
@NonNull public java.lang.Boolean getHandleProfiling()
@NonNull public java.lang.Boolean getFunctionalTest()
@Nullable public java.lang.String getTestLabel()
@Nullable public java.lang.String getPackageFromManifest()
@Nullable public java.lang.String getSplitFromManifest()
@Nullable public java.lang.String getVersionNameFromManifest()
public int getVersionCodeFromManifest()
@Nullable public java.lang.String getTestedApplicationIdFromManifest()
@Nullable public java.lang.String getInstrumentationRunnerFromManifest()
@Nullable public java.lang.Boolean getFunctionalTestFromManifest()
@Nullable public java.lang.Boolean getHandleProfilingFromManifest()
@Nullable public java.lang.String getTestLabelFromManifest()
@NonNull public com.android.sdklib.AndroidVersion getMinSdkVersion()
This uses both the value from the manifest (if present), and the override coming from the flavor(s) (if present).
public int getMinSdkVersionValue()
@NonNull public com.android.builder.model.ApiVersion getTargetSdkVersion()
This uses both the value from the manifest (if present), and the override coming from the flavor(s) (if present).
@Nullable public java.io.File getMainManifest()
@NonNull public java.util.List<com.android.builder.model.SourceProvider> getSortedSourceProviders()
@NonNull public java.util.List<java.io.File> getManifestOverlays()
@NonNull public java.util.Set<java.io.File> getResourceFolders()
@NonNull public java.util.List<com.android.ide.common.res2.ResourceSet> getResourceSets(boolean validateEnabled)
ResourceSet for the source folders only.
The list is ordered in ascending order of importance, meaning the first set is meant to be
overridden by the 2nd one and so on. This is meant to facilitate usage of the list in a
ResourceMerger.@NonNull public java.util.List<com.android.ide.common.res2.AssetSet> getAssetSets()
AssetSet based on the configuration, its dependencies,
as well as tested config if applicable (test of a library).
The list is ordered in ascending order of importance, meaning the first set is meant to be
overridden by the 2nd one and so on. This is meant to facilitate usage of the list in a
AssetMerger.@NonNull public java.util.List<com.android.ide.common.res2.AssetSet> getJniLibsSets()
AssetSet based on the configuration, its dependencies,
as well as tested config if applicable (test of a library).
The list is ordered in ascending order of importance, meaning the first set is meant to be
overridden by the 2nd one and so on. This is meant to facilitate usage of the list in a
AssetMerger.@NonNull public java.util.List<com.android.ide.common.res2.AssetSet> getShaderSets()
AssetSet based on the configuration, its dependencies,
as well as tested config if applicable (test of a library).
The list is ordered in ascending order of importance, meaning the first set is meant to be
overridden by the 2nd one and so on. This is meant to facilitate usage of the list in a
AssetMerger.public int getRenderscriptTarget()
@NonNull public java.util.List<java.io.File> getRenderscriptSourceList()
@NonNull public java.util.List<java.io.File> getAidlSourceList()
@NonNull public java.util.List<java.io.File> getJniSourceList()
public void addBuildConfigField(@NonNull
java.lang.String type,
@NonNull
java.lang.String name,
@NonNull
java.lang.String value)
type - the type of the fieldname - the name of the fieldvalue - the value of the fieldpublic void addResValue(@NonNull
java.lang.String type,
@NonNull
java.lang.String name,
@NonNull
java.lang.String value)
type - the type of the fieldname - the name of the fieldvalue - the value of the field@NonNull public java.util.List<java.lang.Object> getBuildConfigItems()
ClassField)
or comments (instance of String).@NonNull public java.util.Map<java.lang.String,com.android.builder.model.ClassField> getMergedBuildConfigFields()
@NonNull public java.util.Map<java.lang.String,com.android.builder.model.ClassField> getMergedResValues()
@NonNull public java.util.List<java.lang.Object> getResValues()
ClassField)
or comments (instance of String).@Nullable public com.android.builder.model.SigningConfig getSigningConfig()
public boolean isSigningReady()
@NonNull public java.util.Set<java.io.File> getProguardFiles(java.util.List<java.io.File> defaultProguardConfig)
@NonNull public java.util.Set<java.io.File> getTestProguardFiles()
@NonNull public java.util.List<java.lang.Object> getConsumerProguardFiles()
public boolean isTestCoverageEnabled()
@NonNull public java.util.Map<java.lang.String,java.lang.Object> getManifestPlaceholders()
public boolean isMultiDexEnabled()
public java.io.File getMultiDexKeepFile()
public java.io.File getMultiDexKeepProguard()
public boolean isLegacyMultiDexMode()
@NonNull public DexingType getDexingType()
public boolean getRenderscriptSupportModeEnabled()
public boolean getRenderscriptSupportModeBlasEnabled()
public boolean getRenderscriptNdkModeEnabled()
public boolean isBundled()
@NonNull public java.util.Collection<java.io.File> getJarJarRuleFiles()