Search in sources :

Example 11 with AndroidDependencyTree

use of com.taobao.android.builder.dependency.AndroidDependencyTree in project atlas by alibaba.

the class MergeAssetAwbsConfigAction method execute.

@Override
public void execute(MtlParallelTask parallelTask) {
    super.execute(parallelTask);
    AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(parallelTask.getVariantName());
    if (null == androidDependencyTree) {
        return;
    }
    List<DefaultTask> tasks = new ArrayList<DefaultTask>();
    for (final AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
        MergeAwbAssetConfigAction mergeAwbAssetConfigAction = new MergeAwbAssetConfigAction(appVariantContext, baseVariantOutputData, awbBundle);
        MergeSourceSetFolders mergeTask = TaskCreater.create(appVariantContext.getProject(), mergeAwbAssetConfigAction.getName(), mergeAwbAssetConfigAction.getType());
        mergeAwbAssetConfigAction.execute(mergeTask);
        tasks.add(mergeTask);
    }
    parallelTask.parallelTask = tasks;
    parallelTask.uniqueTaskName = getName();
}
Also used : ArrayList(java.util.ArrayList) DefaultTask(org.gradle.api.DefaultTask) AndroidDependencyTree(com.taobao.android.builder.dependency.AndroidDependencyTree) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle) MergeAwbAssetConfigAction(com.taobao.android.builder.tasks.bundle.MergeAwbAssetConfigAction) MergeSourceSetFolders(com.android.build.gradle.tasks.MergeSourceSetFolders)

Example 12 with AndroidDependencyTree

use of com.taobao.android.builder.dependency.AndroidDependencyTree in project atlas by alibaba.

the class MergeResAwbsConfigAction method execute.

@Override
public void execute(MtlParallelTask parallelTask) {
    super.execute(parallelTask);
    AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(parallelTask.getVariantName());
    if (null == androidDependencyTree) {
        return;
    }
    List<DefaultTask> tasks = new ArrayList<DefaultTask>();
    for (final AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
        MergeAwbResourceConfigAction mergeAwbResourceConfigAction = new MergeAwbResourceConfigAction(appVariantContext, baseVariantOutputData, awbBundle);
        final MergeResources mergeTask = TaskCreater.create(appVariantContext.getProject(), mergeAwbResourceConfigAction.getName(), mergeAwbResourceConfigAction.getType());
        mergeAwbResourceConfigAction.execute(mergeTask);
        tasks.add(mergeTask);
        mergeTask.doLast(new Action<Task>() {

            @Override
            public void execute(Task task) {
                File publicRes = new File(awbBundle.getResFolder(), "values/public.xml");
                if (publicRes.exists()) {
                    try {
                        FileUtils.copyFile(publicRes, new File(mergeTask.getOutputDir(), "values/public.xml"));
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
    }
    parallelTask.parallelTask = tasks;
    parallelTask.uniqueTaskName = getName();
    parallelTask.concurrent = true;
}
Also used : MergeResources(com.android.build.gradle.tasks.MergeResources) MtlParallelTask(com.taobao.android.builder.tasks.app.MtlParallelTask) Task(org.gradle.api.Task) DefaultTask(org.gradle.api.DefaultTask) MergeAwbResourceConfigAction(com.taobao.android.builder.tasks.bundle.MergeAwbResourceConfigAction) ArrayList(java.util.ArrayList) DefaultTask(org.gradle.api.DefaultTask) AndroidDependencyTree(com.taobao.android.builder.dependency.AndroidDependencyTree) IOException(java.io.IOException) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle) File(java.io.File)

Example 13 with AndroidDependencyTree

use of com.taobao.android.builder.dependency.AndroidDependencyTree in project atlas by alibaba.

the class BundleInfoUtils method getBundleInfoList.

@NotNull
public static List<BundleInfo> getBundleInfoList(AppVariantContext appVariantContext) {
    AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(appVariantContext.getScope().getVariantConfiguration().getFullName());
    List<BundleInfo> bundleInfoList = new ArrayList<BundleInfo>();
    for (AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
        bundleInfoList.add(awbBundle.bundleInfo);
    }
    return bundleInfoList;
}
Also used : BundleInfo(com.taobao.android.builder.tools.bundleinfo.model.BundleInfo) ArrayList(java.util.ArrayList) AndroidDependencyTree(com.taobao.android.builder.dependency.AndroidDependencyTree) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with AndroidDependencyTree

use of com.taobao.android.builder.dependency.AndroidDependencyTree in project atlas by alibaba.

the class ApkInjectInfoCreator method creteInjectParam.

public InjectParam creteInjectParam(AppVariantContext appVariantContext) throws IOException, DocumentException {
    InjectParam injectParam = new InjectParam();
    injectParam.removePreverify = !appVariantContext.getAtlasExtension().getTBuildConfig().getDoPreverify();
    injectParam.version = appVariantContext.getVariantConfiguration().getVersionName();
    AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(appVariantContext.getScope().getVariantConfiguration().getFullName());
    List<BasicBundleInfo> basicBundleInfos = new ArrayList<BasicBundleInfo>();
    for (AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
        BundleInfo muppBundleInfo = awbBundle.bundleInfo;
        BasicBundleInfo basicBundleInfo = new BasicBundleInfo();
        basicBundleInfo.setApplicationName(muppBundleInfo.getApplicationName());
        basicBundleInfo.setVersion(muppBundleInfo.getVersion());
        basicBundleInfo.setPkgName(muppBundleInfo.getPkgName());
        if (!muppBundleInfo.getIsInternal()) {
            basicBundleInfo.setIsInternal(false);
        }
        if (!muppBundleInfo.getActivities().isEmpty()) {
            basicBundleInfo.setActivities(muppBundleInfo.getActivities());
        }
        if (!muppBundleInfo.getContentProviders().isEmpty()) {
            basicBundleInfo.setContentProviders(muppBundleInfo.getContentProviders());
        }
        if (!muppBundleInfo.getDependency().isEmpty()) {
            basicBundleInfo.setDependency(muppBundleInfo.getDependency());
        }
        if (!muppBundleInfo.getReceivers().isEmpty()) {
            basicBundleInfo.setReceivers(muppBundleInfo.getReceivers());
        }
        if (!muppBundleInfo.getServices().isEmpty()) {
            basicBundleInfo.setServices(muppBundleInfo.getServices());
        }
        basicBundleInfos.add(basicBundleInfo);
    }
    injectParam.bundleInfo = JSON.toJSONString(basicBundleInfos);
    //FIXME MOVE TO MTL-PLUGIN
    //List<String> autoStartBundles = new ArrayList<String>(appVariantContext.getAtlasExtension().getTBuildConfig().getAutoStartBundles());
    //
    //UpdateConfig updateConfig = appVariantContext.getAtlasExtension().getUpdateConfig();
    //if (updateConfig.enabled) {
    //    injectParam.group = updateConfig.getProductName();
    //    injectParam.outApp = updateConfig.isOutApp();
    //    autoStartBundles.add(0, updateConfig.getSdkPkgName());
    //}
    //
    injectParam.autoStartBundles = StringUtils.join(appVariantContext.getAtlasExtension().getTBuildConfig().getAutoStartBundles(), ",");
    injectParam.preLaunch = appVariantContext.getAtlasExtension().getTBuildConfig().getPreLaunch();
    return injectParam;
}
Also used : BundleInfo(com.taobao.android.builder.tools.bundleinfo.model.BundleInfo) BasicBundleInfo(com.taobao.android.builder.tools.bundleinfo.model.BasicBundleInfo) BasicBundleInfo(com.taobao.android.builder.tools.bundleinfo.model.BasicBundleInfo) ArrayList(java.util.ArrayList) AndroidDependencyTree(com.taobao.android.builder.dependency.AndroidDependencyTree) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle)

Example 15 with AndroidDependencyTree

use of com.taobao.android.builder.dependency.AndroidDependencyTree in project atlas by alibaba.

the class PrepareMainDexJarsTask method doFullTaskAction.

@TaskAction
public void doFullTaskAction() {
    AndroidDependencyTree libDependencyTree = AtlasBuildContext.libDependencyTrees.get(this.getVariantName());
    if (null == libDependencyTree) {
        throw new GradleException("The libDependencyTree is null!");
    }
    List<File> jarList = new AwoDependency(libVariantContext).getDependencyJar(libDependencyTree);
    libVariantContext.setJarDexList(jarList);
}
Also used : AwoDependency(com.taobao.android.builder.tasks.awo.utils.AwoDependency) GradleException(org.gradle.api.GradleException) AndroidDependencyTree(com.taobao.android.builder.dependency.AndroidDependencyTree) File(java.io.File) MtlBaseTaskAction(com.taobao.android.builder.tasks.manager.MtlBaseTaskAction) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

AndroidDependencyTree (com.taobao.android.builder.dependency.AndroidDependencyTree)24 AwbBundle (com.taobao.android.builder.dependency.model.AwbBundle)19 ArrayList (java.util.ArrayList)14 File (java.io.File)12 MtlBaseTaskAction (com.taobao.android.builder.tasks.manager.MtlBaseTaskAction)9 TaskAction (org.gradle.api.tasks.TaskAction)9 GradleException (org.gradle.api.GradleException)8 ExecutorServicesHelper (com.taobao.android.builder.tools.concurrent.ExecutorServicesHelper)5 DefaultTask (org.gradle.api.DefaultTask)5 BundleInfo (com.taobao.android.builder.tools.bundleinfo.model.BundleInfo)4 IOException (java.io.IOException)4 HashSet (java.util.HashSet)4 StopExecutionException (org.gradle.api.tasks.StopExecutionException)3 DataBindingBuilder (android.databinding.tool.DataBindingBuilder)2 AppVariantOutputContext (com.android.build.gradle.internal.api.AppVariantOutputContext)2 AwbTransform (com.android.build.gradle.internal.api.AwbTransform)2 VariantScope (com.android.build.gradle.internal.scope.VariantScope)2 BaseVariantOutputData (com.android.build.gradle.internal.variant.BaseVariantOutputData)2 AndroidLibrary (com.android.builder.model.AndroidLibrary)2 AwoDependency (com.taobao.android.builder.tasks.awo.utils.AwoDependency)2