Base class for all Android plugins
Modifiers | Name | Description |
---|---|---|
static class |
BasePlugin.PostCompilationData |
Class to hold data to setup the many optional post-compilation steps. |
Modifiers | Name | Description |
---|---|---|
static String |
DEFAULT_PROGUARD_CONFIG_FILE |
|
static String |
DIR_BUNDLES |
|
static String |
FILE_JACOCO_AGENT |
|
static Pattern |
GRADLE_ACCEPTABLE_VERSIONS |
|
static String |
GRADLE_TEST_VERSION |
|
static String |
INSTALL_GROUP |
|
static File |
TEST_SDK_DIR |
|
protected org.gradle.api.Task |
assembleTest |
|
protected org.gradle.api.Task |
connectedCheck |
|
protected org.gradle.api.Task |
deviceCheck |
|
protected org.gradle.internal.reflect.Instantiator |
instantiator |
|
protected org.gradle.api.tasks.Copy |
jacocoAgentTask |
|
protected JacocoPlugin |
jacocoPlugin |
|
protected org.gradle.api.Task |
lintAll |
|
org.gradle.api.Task |
lintCompile |
|
protected org.gradle.api.Task |
lintVital |
|
protected PrepareSdkTask |
mainPreBuild |
|
protected DefaultAndroidSourceSet |
mainSourceSet |
|
protected org.gradle.api.Project |
project |
|
protected SdkHandler |
sdkHandler |
|
protected DefaultAndroidSourceSet |
testSourceSet |
|
protected org.gradle.api.Task |
uninstallAll |
Type | Name and description |
---|---|
Map<LibraryDependencyImpl, PrepareLibraryTask> |
prepareTaskMap |
Map<SigningConfig, ValidateSigningTask> |
validateSigningTaskMap |
Constructor and description |
---|
protected BasePlugin
(org.gradle.internal.reflect.Instantiator instantiator, org.gradle.tooling.provider.model.ToolingModelBuilderRegistry registry) |
Type | Name and description |
---|---|
def |
addDependency(org.gradle.api.artifacts.result.ResolvedComponentResult moduleVersion, VariantDependencies configDependencies, Collection<LibraryDependency> bundles, Map<File, JarDependency> jars, Map<org.gradle.api.artifacts.ModuleVersionIdentifier, List<LibraryDependencyImpl>> modules, Map<org.gradle.api.artifacts.ModuleVersionIdentifier, List<org.gradle.api.artifacts.ResolvedArtifact>> artifacts, com.google.common.collect.Multimap<LibraryDependency, VariantDependencies> reverseMap) |
protected void |
apply(org.gradle.api.Project project) |
MergeResources |
basicCreateMergeResourcesTask(BaseVariantData<? extends BaseVariantOutputData> variantData, String taskNamePrefix, String outputLocation, boolean includeDependencies, boolean process9Patch) |
void |
checkTasksAlreadyCreated() |
protected void |
configureProject() |
void |
createAidlTask(BaseVariantData<? extends BaseVariantOutputData> variantData, File parcelableDir) |
void |
createAnchorTasks(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createAndroidTasks(boolean force) |
org.gradle.api.Task |
createAssembleTask(BaseVariantOutputData variantOutputData) |
org.gradle.api.Task |
createAssembleTask(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createBuildConfigTask(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createCheckManifestTask(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createCheckTasks(boolean hasFlavors, boolean isLibraryTest) |
void |
createCompileTask(BaseVariantData<? extends BaseVariantOutputData> variantData, BaseVariantData<? extends BaseVariantOutputData> testedVariantData) |
void |
createGenerateMicroApkDataTask(BaseVariantData<? extends BaseVariantOutputData> variantData, org.gradle.api.artifacts.Configuration config) |
void |
createGenerateResValuesTask(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createJackTask(BaseVariantData<? extends BaseVariantOutputData> variantData, BaseVariantData<? extends BaseVariantOutputData> testedVariantData) |
BasePlugin.PostCompilationData |
createJacocoTask(GradleVariantConfiguration config, BaseVariantData variantData, BasePlugin.PostCompilationData pcData) |
void |
createLintCompileTask() |
void |
createLintTasks() |
void |
createMergeAppManifestsTask(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createMergeAssetsTask(BaseVariantData<? extends BaseVariantOutputData> variantData, String outputLocation, boolean includeDependencies) |
void |
createMergeLibManifestsTask(BaseVariantData<? extends BaseVariantOutputData> variantData, String manifestOutDir) |
void |
createMergeResourcesTask(BaseVariantData<? extends BaseVariantOutputData> variantData, boolean process9Patch) |
void |
createNdkTasks(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createPackagingTask(ApkVariantData variantData, org.gradle.api.Task assembleTask, boolean publishApk) Creates the final packaging task, and optionally the zipalign task (if the variant is signed) |
void |
createPostCompilationTasks(ApkVariantData variantData) Creates the post-compilation tasks for the given Variant. |
void |
createProcessJavaResTask(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createProcessResTask(BaseVariantData<? extends BaseVariantOutputData> variantData, boolean generateResourcePackage) |
void |
createProcessResTask(BaseVariantData<? extends BaseVariantOutputData> variantData, String symbolLocation, boolean generateResourcePackage) |
protected void |
createProcessTestManifestTask(BaseVariantData<? extends BaseVariantOutputData> variantData, String manifestOurDir) |
void |
createProguardTasks(BaseVariantData<? extends BaseVariantOutputData> variantData, BaseVariantData<? extends BaseVariantOutputData> testedVariantData, BasePlugin.PostCompilationData pcData) Creates the proguarding task for the given Variant. |
void |
createRenderscriptTask(BaseVariantData<? extends BaseVariantOutputData> variantData) |
void |
createSplitAbiTasks(ApplicationVariantData variantData) |
void |
createSplitResourcesTasks(BaseVariantData<? extends BaseVariantOutputData> variantData) Creates the split resources packages task if necessary. |
void |
createTestApkTasks(TestVariantData variantData) Creates the tasks to build the test apk. |
ZipAlign |
createZipAlignTask(String name, File inputFile, File outputFile) creates a zip align. |
void |
displayDeprecationWarning(String message) |
static void |
displayDeprecationWarning(org.gradle.api.logging.Logger logger, org.gradle.api.Project project, String message) |
static void |
displayWarning(com.android.utils.ILogger logger, org.gradle.api.Project project, String message) |
static void |
displayWarning(org.gradle.api.logging.Logger logger, org.gradle.api.Project project, String message) |
protected void |
doApply() |
protected void |
ensureConfigured(org.gradle.api.artifacts.Configuration config) |
void |
ensureTargetSetup() |
static BasePlugin |
findBasePlugin(org.gradle.api.Project project) Returns a plugin that is an instance of BasePlugin. |
AndroidBuilder |
getAndroidBuilder() |
List<File> |
getBootClasspath() |
List<String> |
getBootClasspathAsStrings() |
ProductFlavorData<ProductFlavor> |
getDefaultConfigData() |
BaseExtension |
getExtension() |
protected Class<? extends BaseExtension> |
getExtensionClass() |
Collection<com.android.builder.model.AndroidArtifact> |
getExtraAndroidArtifacts(String variantName) |
Collection<com.android.builder.model.ArtifactMetaData> |
getExtraArtifacts() |
Collection<com.android.builder.model.SourceProviderContainer> |
getExtraBuildTypeSourceProviders(String buildTypeName) |
Collection<com.android.builder.model.SourceProviderContainer> |
getExtraFlavorSourceProviders(String flavorName) |
Collection<com.android.builder.model.JavaArtifact> |
getExtraJavaArtifacts(String variantName) |
Collection<com.android.builder.model.SourceProviderContainer> |
getExtraVariantSourceProviders(String variantName) |
org.gradle.internal.reflect.Instantiator |
getInstantiator() |
org.gradle.api.tasks.Copy |
getJacocoAgentTask() |
Set<File> |
getJniFolders(ApkVariantData variantData) Calculate the list of folders that can contain jni artifacts for this variant. |
static Object[] |
getLocalJarFileList(DependencyContainer dependencyContainer) |
com.android.utils.ILogger |
getLogger() |
protected List<ManifestDependencyImpl> |
getManifestDependencies(List<LibraryDependency> libraries) |
File |
getNdkFolder() |
protected static File |
getOptionalDir(File dir) |
org.gradle.api.Project |
getProject() |
File |
getSdkFolder() |
SdkInfo |
getSdkInfo() |
protected static List<SymbolFileProviderImpl> |
getTextSymbolDependencies(List<LibraryDependency> libraries) |
Collection<String> |
getUnresolvedDependencies() |
List<BaseVariantData<? extends BaseVariantOutputData>> |
getVariantDataList() |
protected VariantFactory |
getVariantFactory() |
VariantManager |
getVariantManager() |
protected PrepareLibraryTask |
handleLibrary(org.gradle.api.Project project, LibraryDependencyImpl library) Handles the library and returns a task to "prepare" the library (ie unarchive it). |
boolean |
isDebugLog() |
boolean |
isVerbose() |
static String |
normalize(com.android.utils.ILogger logger, org.gradle.api.artifacts.ModuleVersionIdentifier id, String path) Normalize a path to remove all illegal characters for all supported operating systems. |
static void |
optionalDependsOn(org.gradle.api.Task main, org.gradle.api.Task... dependencies) |
static void |
optionalDependsOn(org.gradle.api.Task main, List<Object> dependencies) |
void |
registerArtifactType(String name, boolean isTest, int artifactType) |
void |
registerBuildTypeSourceProvider(String name, BuildType buildType, com.android.builder.model.SourceProvider sourceProvider) |
void |
registerJavaArtifact(String name, BaseVariant variant, String assembleTaskName, String javaCompileTaskName, org.gradle.api.artifacts.Configuration configuration, File classesFolder, com.android.builder.model.SourceProvider sourceProvider) |
void |
registerMultiFlavorSourceProvider(String name, String flavorName, com.android.builder.model.SourceProvider sourceProvider) |
void |
registerProductFlavorSourceProvider(String name, ProductFlavor productFlavor, com.android.builder.model.SourceProvider sourceProvider) |
void |
resolveDependencies(VariantDependencies variantDeps) |
void |
setAssembleTest(org.gradle.api.Task assembleTest) |
Creates the final packaging task, and optionally the zipalign task (if the variant is signed)
assembleTask
- an optional assembleTask to be used. If null a new one is created. The
assembleTask is always set in the Variant.publishApk
- if true the generated APK gets published.Creates the post-compilation tasks for the given Variant. These tasks create the dex file from the .class files, plus optional intermediary steps like proguard and jacoco
variantData
- the variant data.Creates the proguarding task for the given Variant.
variantData
- the variant data.testedVariantData
- optional. variant data representing the tested variant, null if the
variant is not a test variantCreates the split resources packages task if necessary. AAPT will produce split packages for all --split provided parameters. These split packages should be signed and moved unchanged to the APK build output directory.
variantData
- the variant configuration.Creates the tasks to build the test apk.
variantData
- the test variantcreates a zip align. This does not use convention mapping, and is meant to let other plugin create zip align tasks.
name
- the name of the taskinputFile
- the input fileoutputFile
- the output fileReturns a plugin that is an instance of BasePlugin. Returns null if a BasePlugin cannot be found.
Calculate the list of folders that can contain jni artifacts for this variant.
variantData
- the variantHandles the library and returns a task to "prepare" the library (ie unarchive it). The task will be reused for all projects using the same library.
project
- the projectlibrary
- the library.Normalize a path to remove all illegal characters for all supported operating systems. {
id
- the module coordinates that generated this pathpath
- the proposed path nameGradle API 1.0.0