use of com.taobao.android.builder.tasks.library.AwbGenerator in project atlas by alibaba.
the class AtlasLibTaskManager method runTask.
@Override
public void runTask() {
//不做资源的合并
if (!atlasExtension.getBundleConfig().isMergeRes()) {
new ResMerger(project).mergeRes();
}
//对maven发布失败做异常翻译, 一目了然
new PublishHooker(project).hookPublish();
libraryExtension.getLibraryVariants().forEach(new Consumer<LibraryVariant>() {
@Override
public void accept(LibraryVariant libraryVariant) {
//if ("debug".equals(libraryVariant.getBaseName())) {
// new ModuleInfoWriter(project,libraryVariant).write();
//}
LibVariantContext libVariantContext = new LibVariantContext((LibraryVariantImpl) libraryVariant, project, atlasExtension, libraryExtension);
List<Zip> zipTasks = libVariantContext.getZipTasks();
if (zipTasks.isEmpty()) {
return;
}
for (Zip zipTask : zipTasks) {
new AndroidComponetCreator(atlasExtension, project).createAndroidComponent(zipTask);
//生成 awb 和 jar
new AwbGenerator(atlasExtension).generate(zipTask);
}
}
});
libraryExtension.getLibraryVariants().forEach(new Consumer<LibraryVariant>() {
@Override
public void accept(LibraryVariant libraryVariant) {
LibVariantContext libVariantContext = new LibVariantContext((LibraryVariantImpl) libraryVariant, project, atlasExtension, libraryExtension);
List<Zip> zipTasks = libVariantContext.getZipTasks();
if (zipTasks.isEmpty()) {
return;
}
for (Zip zipTask : zipTasks) {
TBuildType tBuildType = libVariantContext.getBuildType();
if (null != tBuildType) {
try {
new AwoPropHandler().process(tBuildType, atlasExtension.getBundleConfig());
} catch (Exception e) {
throw new GradleException("process awo exception", e);
}
}
//TODO DEBUG it
if (atlasExtension.getBundleConfig().isAwoBuildEnabled() && libraryVariant.getName().equals("debug")) {
libVariantContext.setBundleTask(zipTask);
try {
libVariantContext.setAwbBundle(createAwbBundle(libVariantContext, libraryVariant.getName()));
} catch (IOException e) {
throw new GradleException("set awb bundle error");
}
if (atlasExtension.getBundleConfig().isAwbBundle()) {
createAwoTask(libVariantContext, zipTask);
} else {
createDexTask(libVariantContext, zipTask);
}
}
}
}
});
}
Aggregations