public interface BaseVariant
| Modifier and Type | Method and Description |
|---|---|
void |
addJavaSourceFoldersToModel(java.util.Collection<java.io.File> sourceFolders)
Adds new Java source folders to the model.
|
void |
addJavaSourceFoldersToModel(java.io.File... sourceFolders)
Adds new Java source folders to the model.
|
void |
buildConfigField(java.lang.String type,
java.lang.String name,
java.lang.String value)
Adds a variant-specific BuildConfig field.
|
AidlCompile |
getAidlCompile()
Returns the AIDL compilation task.
|
org.gradle.api.artifacts.Configuration |
getAnnotationProcessorConfiguration()
Returns the configuration object for the annotation processor.
|
java.lang.String |
getApplicationId()
Returns the applicationId of the variant.
|
org.gradle.api.Task |
getAssemble()
Returns the assemble task for all this variant's output
|
java.lang.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.
|
org.gradle.api.file.FileCollection |
getCompileClasspath(java.lang.Object key)
Returns the java compilation classpath.
|
org.gradle.api.artifacts.ArtifactCollection |
getCompileClasspathArtifacts(java.lang.Object key)
Returns the java compilation classpath as an ArtifactCollection
|
org.gradle.api.artifacts.Configuration |
getCompileConfiguration()
Returns the configuration object for the compilation
|
java.lang.String |
getDescription()
Returns a description for the build variant.
|
java.lang.String |
getDirName()
Returns a subfolder name for the variant.
|
java.util.Collection<ExternalNativeBuildTask> |
getExternalNativeBuildTasks()
Returns the tasks for building external native projects.
|
java.lang.String |
getFlavorName()
Returns the flavor name of the variant.
|
GenerateBuildConfig |
getGenerateBuildConfig()
Returns the BuildConfig generation task.
|
org.gradle.api.tasks.compile.JavaCompile |
getJavaCompile()
Deprecated.
prefer
getJavaCompiler() which always return the java compiler task
irrespective of which tool chain (javac or jack) used. |
JavaCompileOptions |
getJavaCompileOptions()
Returns a
JavaCompileOptions that represents the java compile settings for this build
variant. |
org.gradle.api.Task |
getJavaCompiler()
Returns the Java Compiler task which can be either javac or jack depending on the project
configuration.
|
java.io.File |
getMappingFile()
Returns the obfuscation mapping file.
|
MergeSourceSetFolders |
getMergeAssets()
Returns the asset 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. |
MergeResources |
getMergeResources()
Returns the resource merging task.
|
java.lang.String |
getName()
Returns the name of the variant.
|
NdkCompile |
getNdkCompile()
Returns the NDK Compilation task.
|
org.gradle.api.Task |
getObfuscation()
Returns the obfuscation task.
|
org.gradle.api.DomainObjectCollection<BaseVariantOutput> |
getOutputs()
Returns the variant outputs.
|
boolean |
getOutputsAreSigned() |
org.gradle.api.Task |
getPreBuild()
Returns the pre-build anchor task
|
org.gradle.api.tasks.AbstractCopyTask |
getProcessJavaResources()
Returns the Java resource processing task.
|
java.util.List<com.android.builder.model.ProductFlavor> |
getProductFlavors()
Returns the list of
DefaultProductFlavor for this build
variant. |
RenderscriptCompile |
getRenderscriptCompile()
Returns the Renderscript compilation task.
|
org.gradle.api.artifacts.Configuration |
getRuntimeConfiguration()
Returns the configuration object for the runtime
|
java.util.List<org.gradle.api.file.ConfigurableFileTree> |
getSourceFolders(SourceKind folderType)
Returns a list of FileCollection representing the source folders.
|
java.util.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 |
missingDimensionStrategy(java.lang.String dimension,
java.util.List<java.lang.String> requestedValues)
Set up a new matching request for a given flavor dimension and value.
|
void |
missingDimensionStrategy(java.lang.String dimension,
java.lang.String... requestedValues)
Set up a new matching request for a given flavor dimension and value.
|
void |
missingDimensionStrategy(java.lang.String dimension,
java.lang.String requestedValue)
Set up a new matching request for a given flavor dimension and value.
|
void |
register(org.gradle.api.Task task)
Registers a task to be executed before any main output tasks like the assemble or bundle
tasks are invoked.
|
void |
registerExternalAptJavaOutput(org.gradle.api.file.ConfigurableFileTree folder)
Register the output of an external annotation processor.
|
java.lang.Object |
registerGeneratedBytecode(org.gradle.api.file.FileCollection fileCollection)
Deprecated.
|
void |
registerGeneratedResFolders(org.gradle.api.file.FileCollection folders)
Adds to the variant new generated resource folders.
|
void |
registerJavaGeneratingTask(org.gradle.api.Task task,
java.util.Collection<java.io.File> sourceFolders)
Adds to the variant a task that generates Java source code.
|
void |
registerJavaGeneratingTask(org.gradle.api.Task task,
java.io.File... sourceFolders)
Adds to the variant a task that generates Java source code.
|
void |
registerPostJavacGeneratedBytecode(org.gradle.api.file.FileCollection fileCollection)
Adds to the variant new generated Java byte-code.
|
java.lang.Object |
registerPreJavacGeneratedBytecode(org.gradle.api.file.FileCollection fileCollection)
Adds to the variant new generated Java byte-code.
|
void |
registerResGeneratingTask(org.gradle.api.Task task,
java.util.Collection<java.io.File> resFolders)
Deprecated.
|
void |
registerResGeneratingTask(org.gradle.api.Task task,
java.io.File... resFolders)
Deprecated.
|
void |
resValue(java.lang.String type,
java.lang.String name,
java.lang.String value)
Adds a variant-specific res value.
|
void |
setOutputsAreSigned(boolean isSigned)
If true, variant outputs will be considered signed.
|
@NonNull java.lang.String getName()
@NonNull java.lang.String getDescription()
@NonNull java.lang.String getDirName()
@NonNull java.lang.String getBaseName()
@NonNull java.lang.String getFlavorName()
@NonNull org.gradle.api.DomainObjectCollection<BaseVariantOutput> getOutputs()
@NonNull com.android.builder.model.BuildType getBuildType()
DefaultBuildType for this build variant.@NonNull com.android.builder.model.ProductFlavor getMergedFlavor()
DefaultProductFlavor that represents the merging
of the default config and the flavors of this build variant.@NonNull JavaCompileOptions getJavaCompileOptions()
JavaCompileOptions that represents the java compile settings for this build
variant.@NonNull java.util.List<com.android.builder.model.ProductFlavor> getProductFlavors()
DefaultProductFlavor for this build
variant.
This is always non-null but could be empty.
@NonNull java.util.List<com.android.builder.model.SourceProvider> getSourceSets()
@NonNull
java.util.List<org.gradle.api.file.ConfigurableFileTree> getSourceFolders(@NonNull
SourceKind folderType)
folderType - the type of folder to return.@NonNull org.gradle.api.artifacts.Configuration getCompileConfiguration()
@NonNull org.gradle.api.artifacts.Configuration getAnnotationProcessorConfiguration()
@NonNull org.gradle.api.artifacts.Configuration getRuntimeConfiguration()
@NonNull java.lang.String getApplicationId()
@NonNull org.gradle.api.Task getPreBuild()
@NonNull org.gradle.api.Task getCheckManifest()
@NonNull AidlCompile getAidlCompile()
@NonNull RenderscriptCompile getRenderscriptCompile()
@Nullable MergeResources getMergeResources()
@Nullable MergeSourceSetFolders getMergeAssets()
@Nullable GenerateBuildConfig getGenerateBuildConfig()
@Nullable
@Deprecated
org.gradle.api.tasks.compile.JavaCompile getJavaCompile()
throws java.lang.IllegalStateException
getJavaCompiler() which always return the java compiler task
irrespective of which tool chain (javac or jack) used.java.lang.IllegalStateException@NonNull org.gradle.api.Task getJavaCompiler()
@NonNull
org.gradle.api.file.FileCollection getCompileClasspath(@Nullable
java.lang.Object key)
The provided key allows controlling how much of the classpath is returned.
null, the full classpath is returned
key - the keyregisterGeneratedBytecode(FileCollection)@NonNull
org.gradle.api.artifacts.ArtifactCollection getCompileClasspathArtifacts(@Nullable
java.lang.Object key)
The provided key allows controlling how much of the classpath is returned.
null, the full classpath is returned
key - the keyregisterGeneratedBytecode(FileCollection)@NonNull NdkCompile getNdkCompile()
java.util.Collection<ExternalNativeBuildTask> getExternalNativeBuildTasks()
@Nullable org.gradle.api.Task getObfuscation()
@Nullable java.io.File getMappingFile()
@NonNull org.gradle.api.tasks.AbstractCopyTask getProcessJavaResources()
@Nullable org.gradle.api.Task getAssemble()
void addJavaSourceFoldersToModel(@NonNull
java.io.File... sourceFolders)
sourceFolders - the source folders where the generated source code is.void addJavaSourceFoldersToModel(@NonNull
java.util.Collection<java.io.File> sourceFolders)
sourceFolders - the source folders where the generated source code is.void registerJavaGeneratingTask(@NonNull
org.gradle.api.Task task,
@NonNull
java.io.File... sourceFolders)
task - the tasksourceFolders - the source folders where the generated source code is.void registerJavaGeneratingTask(@NonNull
org.gradle.api.Task task,
@NonNull
java.util.Collection<java.io.File> sourceFolders)
task - the tasksourceFolders - the source folders where the generated source code is.void registerExternalAptJavaOutput(@NonNull
org.gradle.api.file.ConfigurableFileTree folder)
The output is passed to the javac task, but the source generation hooks does not depend on this.
In order to properly wire up tasks, the FileTree object must include dependency information about the task that generates the content of this folders.
folder - a ConfigurableFileTree that contains a single folder and the task dependency
informationvoid registerGeneratedResFolders(@NonNull
org.gradle.api.file.FileCollection folders)
In order to properly wire up tasks, the FileCollection object must include dependency information about the task that generates the content of this folders.
folders - a FileCollection that contains the folders and the task dependency information@Deprecated
void registerResGeneratingTask(@NonNull
org.gradle.api.Task task,
@NonNull
java.io.File... resFolders)
registerGeneratedResFolders(FileCollection)task - the taskresFolders - the folders where the generated resources are.@Deprecated
void registerResGeneratingTask(@NonNull
org.gradle.api.Task task,
@NonNull
java.util.Collection<java.io.File> resFolders)
registerGeneratedResFolders(FileCollection)task - the taskresFolders - the folders where the generated resources are.java.lang.Object registerPreJavacGeneratedBytecode(@NonNull
org.gradle.api.file.FileCollection fileCollection)
This bytecode is passed to the javac classpath. This is typically used by compilers for languages that generate bytecode ahead of javac.
The file collection can contain either a folder of class files or jars.
In order to properly wire up tasks, the FileCollection object must include dependency
information about the task that generates the content of these folders. This is generally
setup using ConfigurableFileCollection.builtBy(Object...)
The generated byte-code will also be added to the transform pipeline as a QualifiedContent.Scope.PROJECT stream.
The method returns a key that can be used to query for the compilation classpath. This
allows each successive call to registerPreJavacGeneratedBytecode(FileCollection) to
be associated with a classpath containing everything before the added
bytecode.
fileCollection - a FileCollection that contains the files and the task dependency
informationregisterGeneratedBytecode(FileCollection)@Deprecated
java.lang.Object registerGeneratedBytecode(@NonNull
org.gradle.api.file.FileCollection fileCollection)
registerPreJavacGeneratedBytecode(FileCollection)void registerPostJavacGeneratedBytecode(@NonNull
org.gradle.api.file.FileCollection fileCollection)
This bytecode is meant to be post javac, which means javac does not have it on its
classpath. It's is only added to the java compilation task's classpath and will be added to
the transform pipeline as a QualifiedContent.Scope.PROJECT stream.
The file collection can contain either a folder of class files or jars.
In order to properly wire up tasks, the FileCollection object must include dependency
information about the task that generates the content of these folders. This is generally
setup using ConfigurableFileCollection.builtBy(Object...)
fileCollection - a FileCollection that contains the files and the task dependency
informationvoid buildConfigField(@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 fieldvoid resValue(@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 fieldvoid missingDimensionStrategy(@NonNull
java.lang.String dimension,
@NonNull
java.lang.String requestedValue)
To learn more, read Select default flavors for missing dimensions.
dimension - the flavor dimensionrequestedValue - the flavor namevoid missingDimensionStrategy(@NonNull
java.lang.String dimension,
@NonNull
java.lang.String... requestedValues)
To learn more, read Select default flavors for missing dimensions.
dimension - the flavor dimensionrequestedValues - the flavor name and fallbacksvoid missingDimensionStrategy(@NonNull
java.lang.String dimension,
@NonNull
java.util.List<java.lang.String> requestedValues)
To learn more, read Select default flavors for missing dimensions.
dimension - the flavor dimensionrequestedValues - the flavor name and fallbacksvoid setOutputsAreSigned(boolean isSigned)
boolean getOutputsAreSigned()
setOutputsAreSigned(boolean)@Incubating void register(org.gradle.api.Task task)
The task will need to set up its dependencies on the build outputs (whether it is an intermediate output or the final one) independently of this call.