Search in sources :

Example 1 with DataBindingExportBuildInfoTask

use of com.android.build.gradle.internal.tasks.databinding.DataBindingExportBuildInfoTask in project atlas by alibaba.

the class DataBindingExportBuildInfoAwbsConfigAction method execute.

@Override
public void execute(MtlParallelTask parallelTask) {
    super.execute(parallelTask);
    AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(parallelTask.getVariantName());
    if (null == androidDependencyTree) {
        return;
    }
    DataBindingBuilder dataBindingBuilder = new DataBindingBuilder();
    dataBindingBuilder.setPrintMachineReadableOutput(false);
    dataBindingBuilder.setDebugLogEnabled(appVariantContext.getProject().getLogger().isDebugEnabled());
    List<DefaultTask> tasks = new ArrayList<DefaultTask>();
    for (final AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
        AwbDataBindingExportBuildInfoConfigAction exportBuildInfoConfigAction = new AwbDataBindingExportBuildInfoConfigAction(appVariantContext, awbBundle, dataBindingBuilder.getPrintMachineReadableOutput(), dataBindingBuilder);
        DataBindingExportBuildInfoTask exportBuildInfoTask = TaskCreater.create(appVariantContext.getProject(), exportBuildInfoConfigAction.getName(), exportBuildInfoConfigAction.getType());
        exportBuildInfoConfigAction.execute(exportBuildInfoTask);
        tasks.add(exportBuildInfoTask);
    }
    parallelTask.parallelTask = tasks;
    parallelTask.uniqueTaskName = getName();
    parallelTask.concurrent = true;
}
Also used : ArrayList(java.util.ArrayList) DefaultTask(org.gradle.api.DefaultTask) AndroidDependencyTree(com.taobao.android.builder.dependency.AndroidDependencyTree) DataBindingExportBuildInfoTask(com.android.build.gradle.internal.tasks.databinding.DataBindingExportBuildInfoTask) DataBindingBuilder(android.databinding.tool.DataBindingBuilder) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle)

Example 2 with DataBindingExportBuildInfoTask

use of com.android.build.gradle.internal.tasks.databinding.DataBindingExportBuildInfoTask in project atlas by alibaba.

the class AwbDataBindingExportBuildInfoTask method run.

@TaskAction
public void run() throws ExecutionException, InterruptedException {
    AtlasDependencyTree atlasDependencyTree = AtlasBuildContext.androidDependencyTrees.get(getVariantName());
    if (null == atlasDependencyTree) {
        return;
    }
    DataBindingBuilder dataBindingBuilder = new DataBindingBuilder();
    dataBindingBuilder.setPrintMachineReadableOutput(false);
    dataBindingBuilder.setDebugLogEnabled(appVariantContext.getProject().getLogger().isDebugEnabled());
    List<Runnable> tasks = new ArrayList<Runnable>();
    for (final AwbBundle awbBundle : atlasDependencyTree.getAwbBundles()) {
        if (!appVariantContext.getAtlasExtension().getTBuildConfig().getDataBindingBundles().contains(awbBundle.getPackageName()) || awbBundle.isMBundle) {
            continue;
        }
        tasks.add(new Runnable() {

            @Override
            public void run() {
                AwbDataBindingExportBuildInfoConfigAction exportBuildInfoConfigAction = new AwbDataBindingExportBuildInfoConfigAction(appVariantContext, awbBundle, dataBindingBuilder.getPrintMachineReadableOutput(), dataBindingBuilder);
                DataBindingExportBuildInfoTask exportBuildInfoTask = TaskCreater.create(appVariantContext.getProject(), exportBuildInfoConfigAction.getName(), exportBuildInfoConfigAction.getType());
                exportBuildInfoConfigAction.execute(exportBuildInfoTask);
                exportBuildInfoTask.execute();
            }
        });
    }
    ExecutorServicesHelper executorServicesHelper = new ExecutorServicesHelper("dataBindingExportBuildInfo", getLogger(), 0);
    executorServicesHelper.execute(tasks);
}
Also used : ExecutorServicesHelper(com.taobao.android.builder.tools.concurrent.ExecutorServicesHelper) ArrayList(java.util.ArrayList) DataBindingExportBuildInfoTask(com.android.build.gradle.internal.tasks.databinding.DataBindingExportBuildInfoTask) DataBindingBuilder(android.databinding.tool.DataBindingBuilder) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle) AtlasDependencyTree(com.taobao.android.builder.dependency.AtlasDependencyTree) MtlBaseTaskAction(com.taobao.android.builder.tasks.manager.MtlBaseTaskAction) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

DataBindingBuilder (android.databinding.tool.DataBindingBuilder)2 DataBindingExportBuildInfoTask (com.android.build.gradle.internal.tasks.databinding.DataBindingExportBuildInfoTask)2 AwbBundle (com.taobao.android.builder.dependency.model.AwbBundle)2 ArrayList (java.util.ArrayList)2 AndroidDependencyTree (com.taobao.android.builder.dependency.AndroidDependencyTree)1 AtlasDependencyTree (com.taobao.android.builder.dependency.AtlasDependencyTree)1 MtlBaseTaskAction (com.taobao.android.builder.tasks.manager.MtlBaseTaskAction)1 ExecutorServicesHelper (com.taobao.android.builder.tools.concurrent.ExecutorServicesHelper)1 DefaultTask (org.gradle.api.DefaultTask)1 TaskAction (org.gradle.api.tasks.TaskAction)1