Search in sources :

Example 6 with GradleVariantConfiguration

use of com.android.build.gradle.internal.core.GradleVariantConfiguration in project atlas by alibaba.

the class PreProcessManifestAction method execute.

@Override
public void execute(Task task) {
    AtlasExtension atlasExtension = appVariantContext.getAtlasExtension();
    ManifestProcessorTask manifestProcessorTask = baseVariantOutput.getProcessManifest();
    Set<String> notMergedArtifacts = Sets.newHashSet();
    if (null != atlasExtension.getManifestOptions() && null != atlasExtension.getManifestOptions().getNotMergedBundles()) {
        notMergedArtifacts = atlasExtension.getManifestOptions().getNotMergedBundles();
    }
    if (manifestProcessorTask instanceof MergeManifests) {
        MergeManifests mergeManifests = (MergeManifests) manifestProcessorTask;
        VariantScope variantScope = appVariantContext.getScope();
        GradleVariantConfiguration config = variantScope.getVariantConfiguration();
        AtlasDependencyTree dependencyTree = AtlasBuildContext.androidDependencyTrees.get(config.getFullName());
        List<ManifestProvider> bundleProviders = ManifestHelper.getBundleManifest(appVariantContext, dependencyTree, atlasExtension);
        List<ManifestProvider> mainDexProviders = ManifestHelper.getMainDexManifest(appVariantContext, dependencyTree, atlasExtension);
        List<ManifestProvider> allManifest = new ArrayList<>();
        modifyForIncremental(mergeManifests, allManifest);
        // allManifest.addAll(ManifestHelper.convert(mergeManifests.getProviders(), appVariantContext));
        allManifest.addAll(bundleProviders);
        allManifest.addAll(mainDexProviders);
        AtlasBuildContext.androidBuilderMap.get(appVariantContext.getProject()).manifestProviders = allManifest;
        mergeManifests.setAndroidBuilder(AtlasBuildContext.androidBuilderMap.get(appVariantContext.getProject()));
    // if (sLogger.isInfoEnabled()) {
    // for (ManifestProvider manifestProvider : allManifest) {
    // sLogger.warn("[manifestLibs] " + manifestProvider.getManifest().getAbsolutePath());
    // }
    // }
    // Without this step, each time getLibraries It's going to be recomputed from the mapping
    // mergeManifests.(allManifest);
    }
}
Also used : AtlasExtension(com.taobao.android.builder.extension.AtlasExtension) VariantScope(com.android.build.gradle.internal.scope.VariantScope) MergeManifests(com.android.build.gradle.tasks.MergeManifests) ArrayList(java.util.ArrayList) GradleVariantConfiguration(com.android.build.gradle.internal.core.GradleVariantConfiguration) ManifestProcessorTask(com.android.build.gradle.tasks.ManifestProcessorTask) AtlasDependencyTree(com.taobao.android.builder.dependency.AtlasDependencyTree) ManifestProvider(com.android.manifmerger.ManifestProvider)

Aggregations

GradleVariantConfiguration (com.android.build.gradle.internal.core.GradleVariantConfiguration)6 File (java.io.File)4 VariantScope (com.android.build.gradle.internal.scope.VariantScope)3 AtlasExtension (com.taobao.android.builder.extension.AtlasExtension)3 ManifestProcessorTask (com.android.build.gradle.tasks.ManifestProcessorTask)2 MergeManifests (com.android.build.gradle.tasks.MergeManifests)2 AtlasDependencyTree (com.taobao.android.builder.dependency.AtlasDependencyTree)2 IOException (java.io.IOException)2 StopExecutionException (org.gradle.api.tasks.StopExecutionException)2 ApkVariantOutput (com.android.build.gradle.api.ApkVariantOutput)1 BaseVariantOutput (com.android.build.gradle.api.BaseVariantOutput)1 PackagingOptions (com.android.build.gradle.internal.dsl.PackagingOptions)1 InstantRunBuildContext (com.android.build.gradle.internal.incremental.InstantRunBuildContext)1 BaseVariantOutputData (com.android.build.gradle.internal.variant.BaseVariantOutputData)1 DefaultManifestParser (com.android.builder.core.DefaultManifestParser)1 DefaultProductFlavor (com.android.builder.core.DefaultProductFlavor)1 AndroidLibrary (com.android.builder.model.AndroidLibrary)1 ProductFlavor (com.android.builder.model.ProductFlavor)1 ManifestProvider (com.android.manifmerger.ManifestProvider)1 ImmutableSet (com.google.common.collect.ImmutableSet)1