Search in sources :

Example 6 with ManifestProvider

use of com.android.manifmerger.ManifestProvider 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

ManifestProvider (com.android.manifmerger.ManifestProvider)6 ArrayList (java.util.ArrayList)5 AndroidLibrary (com.android.builder.model.AndroidLibrary)3 File (java.io.File)3 GradleVariantConfiguration (com.android.build.gradle.internal.core.GradleVariantConfiguration)1 BuildOutput (com.android.build.gradle.internal.scope.BuildOutput)1 VariantScope (com.android.build.gradle.internal.scope.VariantScope)1 ManifestProcessorTask (com.android.build.gradle.tasks.ManifestProcessorTask)1 MergeManifests (com.android.build.gradle.tasks.MergeManifests)1 AtlasDependencyTree (com.taobao.android.builder.dependency.AtlasDependencyTree)1 AwbBundle (com.taobao.android.builder.dependency.model.AwbBundle)1 AtlasExtension (com.taobao.android.builder.extension.AtlasExtension)1 MtlBaseTaskAction (com.taobao.android.builder.tasks.manager.MtlBaseTaskAction)1 ManifestInfo (com.taobao.android.builder.tools.manifest.ManifestInfo)1 GradleException (org.gradle.api.GradleException)1 ResolvedArtifactResult (org.gradle.api.artifacts.result.ResolvedArtifactResult)1 TaskAction (org.gradle.api.tasks.TaskAction)1