A Build variant and all its public data. This is the base class for items common to apps, test apps, and libraries
Type | Name and description |
---|---|
void |
addJavaSourceFoldersToModel(File... sourceFolders) Adds new Java source folders to the model. |
void |
addJavaSourceFoldersToModel(Collection<File> sourceFolders) Adds new Java source folders to the model. |
void |
buildConfigField(String type, String name, String value) Adds a variant-specific BuildConfig field. |
AidlCompile |
getAidlCompile() Returns the AIDL compilation task. |
String |
getApplicationId() Returns the applicationId of the variant. |
org.gradle.api.Task |
getAssemble() Returns the assemble task for all this variant's output |
String |
getBaseName() Returns the base name for the output of the variant. |
com.android.builder.model.BuildType |
getBuildType() Returns the DefaultBuildType for this build variant. |
org.gradle.api.Task |
getCheckManifest() Returns the check manifest task. |
String |
getDescription() Returns a description for the build variant. |
String |
getDirName() Returns a subfolder name for the variant. |
String |
getFlavorName() Returns the flavor name of the variant. |
GenerateBuildConfig |
getGenerateBuildConfig() Returns the BuildConfig generation task. |
org.gradle.api.tasks.compile.JavaCompile |
getJavaCompile() Returns the Java Compilation task. |
File |
getMappingFile() Returns the obfuscation mapping file. |
MergeAssets |
getMergeAssets() Returns the asset merging task. |
MergeResources |
getMergeResources() Returns the resource merging task. |
com.android.builder.model.ProductFlavor |
getMergedFlavor() Returns a DefaultProductFlavor that represents the merging of the default config and the flavors of this build variant. |
String |
getName() Returns the name of the variant. |
NdkCompile |
getNdkCompile() Returns the NDK Compilation task. |
org.gradle.api.Task |
getObfuscation() Returns the obfuscation task. |
List<BaseVariantOutput> |
getOutputs() Returns the variant outputs. |
boolean |
getOutputsAreSigned() @see #setOutputsAreSigned(boolean) |
org.gradle.api.Task |
getPreBuild() Returns the pre-build anchor task |
org.gradle.api.tasks.Copy |
getProcessJavaResources() Returns the Java resource processing task. |
List<GroupableProductFlavor> |
getProductFlavors() Returns the list of DefaultProductFlavor for this build variant. |
RenderscriptCompile |
getRenderscriptCompile() Returns the Renderscript compilation task. |
List<com.android.builder.model.SourceProvider> |
getSourceSets() Returns a list of sorted SourceProvider in order of ascending order, meaning, the earlier items are meant to be overridden by later items. |
void |
registerJavaGeneratingTask(org.gradle.api.Task task, File... sourceFolders) Adds to the variant a task that generates Java source code. |
void |
registerJavaGeneratingTask(org.gradle.api.Task task, Collection<File> sourceFolders) Adds to the variant a task that generates Java source code. |
void |
resValue(String type, String name, String value) Adds a variant-specific res value. |
void |
setOutputsAreSigned(boolean isSigned) If true, variant outputs will be considered signed. |
Adds new Java source folders to the model. These source folders will not be used for the default build system, but will be passed along the default Java source folders to whoever queries the model.
sourceFolders
- the source folders where the generated source code is.Adds new Java source folders to the model. These source folders will not be used for the default build system, but will be passed along the default Java source folders to whoever queries the model.
sourceFolders
- the source folders where the generated source code is.Adds a variant-specific BuildConfig field.
type
- the type of the fieldname
- the name of the fieldvalue
- the value of the fieldReturns the AIDL compilation task.
Returns the applicationId of the variant.
Returns the assemble task for all this variant's output
Returns the base name for the output of the variant. Guaranteed to be unique.
Returns the DefaultBuildType for this build variant.
Returns the check manifest task.
Returns a description for the build variant.
Returns a subfolder name for the variant. Guaranteed to be unique. This is usually a mix of build type and flavor(s) (if applicable). For instance this could be: "debug" "debug/myflavor" "release/Flavor1Flavor2"
Returns the flavor name of the variant. This is a concatenation of all the applied flavors
Returns the BuildConfig generation task.
Returns the Java Compilation task.
Returns the obfuscation mapping file. This can be null if obfuscation is not enabled.
Returns the asset merging task.
Returns the resource merging task.
Returns a DefaultProductFlavor that represents the merging of the default config and the flavors of this build variant.
Returns the name of the variant. Guaranteed to be unique.
Returns the NDK Compilation task.
Returns the obfuscation task. This can be null if obfuscation is not enabled.
Returns the variant outputs. There should always be at least one output.
Returns the pre-build anchor task
Returns the Java resource processing task.
Returns the list of DefaultProductFlavor for this build variant. This is always non-null but could be empty.
Returns the Renderscript compilation task.
Returns a list of sorted SourceProvider in order of ascending order, meaning, the earlier items are meant to be overridden by later items.
Adds to the variant a task that generates Java source code. This will make the generate[Variant]Sources task depend on this task and add the new source folders as compilation inputs. The new source folders are also added to the model.
task
- the tasksourceFolders
- the source folders where the generated source code is.Adds to the variant a task that generates Java source code. This will make the generate[Variant]Sources task depend on this task and add the new source folders as compilation inputs. The new source folders are also added to the model.
task
- the tasksourceFolders
- the source folders where the generated source code is.Adds a variant-specific res value.
type
- the type of the fieldname
- the name of the fieldvalue
- the value of the fieldIf true, variant outputs will be considered signed. Only set if you manually set the outputs to point to signed files built by other tasks.