use of com.taobao.android.builder.tasks.app.merge.bundle.MergeAwbResource in project atlas by alibaba.
the class MergeResAwbsConfigAction method execute.
@Override
public void execute(MtlParallelTask parallelTask) {
super.execute(parallelTask);
AtlasDependencyTree atlasDependencyTree = AtlasBuildContext.androidDependencyTrees.get(parallelTask.getVariantName());
if (null == atlasDependencyTree) {
return;
}
List<DefaultTask> tasks = new ArrayList<DefaultTask>();
for (final AwbBundle awbBundle : atlasDependencyTree.getAwbBundles()) {
if (awbBundle.isMBundle) {
continue;
}
MergeAwbResource.MergeAwbResourceConfigAction mergeAwbResourceConfigAction = new MergeAwbResource.MergeAwbResourceConfigAction(appVariantContext, baseVariantOutput, awbBundle);
final MergeAwbResource mergeTask = TaskCreater.create(appVariantContext.getProject(), mergeAwbResourceConfigAction.getName(), mergeAwbResourceConfigAction.getType());
// mergeTask.getOutputs().cacheIf(new Spec<Task>() {
// @Override
// public boolean isSatisfiedBy(Task element) {
// return false;
// }
// });
mergeTask.setBlameLogFolder(appVariantContext.getAwbBlameLogFolder(awbBundle));
mergeAwbResourceConfigAction.execute(mergeTask);
tasks.add(mergeTask);
mergeTask.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
File publicRes = new File(awbBundle.getAndroidLibrary().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;
}
Aggregations