Search in sources :

Example 1 with ApkFiles

use of com.android.build.gradle.internal.api.ApkFiles in project atlas by alibaba.

the class ApkFileListUtils method recordApkFileInfos.

/**
 * Records resource information for apk files
 */
public static ApkFiles recordApkFileInfos(AppVariantContext appVariantContext) {
    ApkFiles apkFiles = new ApkFiles();
    List<File> mainBundleResFolders = new ArrayList<File>();
    mainBundleResFolders.add(appVariantContext.getScope().getVariantData().mergeResourcesTask.getOutputDir());
    prepareApkFileList(appVariantContext.getScope().getVariantData().mergeAssetsTask.getOutputDir(), "assets", apkFiles);
    for (File resFolder : mainBundleResFolders) {
        prepareApkFileList(resFolder, "res", apkFiles);
    }
    // Record the resource information for each bundle
    AtlasDependencyTree dependencyTree = AtlasBuildContext.androidDependencyTrees.get(appVariantContext.getScope().getVariantConfiguration().getFullName());
    if (null == dependencyTree) {
        throw new StopExecutionException("DependencyTree cannot be null!");
    }
    List<AwbBundle> libs = dependencyTree.getAwbBundles();
    for (AwbBundle awbLib : libs) {
        File mergeAssertFolder = appVariantContext.getMergeAssets(awbLib);
        File mergeResFolder = appVariantContext.getMergeResources(awbLib);
        String awbName = awbLib.getName();
        prepareApkFileList(mergeAssertFolder, "assets", awbName, apkFiles);
        prepareApkFileList(mergeResFolder, "res", awbName, apkFiles);
    }
    return apkFiles;
}
Also used : ApkFiles(com.android.build.gradle.internal.api.ApkFiles) StopExecutionException(org.gradle.api.tasks.StopExecutionException) ArrayList(java.util.ArrayList) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle) CompiledFile(android.aapt.pb.internal.ResourcesInternal.CompiledFile) File(java.io.File) AtlasDependencyTree(com.taobao.android.builder.dependency.AtlasDependencyTree)

Aggregations

CompiledFile (android.aapt.pb.internal.ResourcesInternal.CompiledFile)1 ApkFiles (com.android.build.gradle.internal.api.ApkFiles)1 AtlasDependencyTree (com.taobao.android.builder.dependency.AtlasDependencyTree)1 AwbBundle (com.taobao.android.builder.dependency.model.AwbBundle)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 StopExecutionException (org.gradle.api.tasks.StopExecutionException)1