use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class DependencyConvertUtils method toAwbBundle.
public static AwbBundle toAwbBundle(ResolvedDependencyInfo resolvedDependencyInfo) {
assertType(Type.AWB, resolvedDependencyInfo);
List<LibraryDependency> dependencies = Lists.newArrayList();
Collection<JarDependency> jarDependencies = Lists.newArrayList();
List<SoLibrary> soLibraries = Lists.newArrayList();
collectChildren(resolvedDependencyInfo, dependencies, jarDependencies, soLibraries);
AwbBundle awbBundle = new AwbBundle(resolvedDependencyInfo.getResolvedArtifact().getFile(), resolvedDependencyInfo.getExplodedDir(), dependencies, jarDependencies, resolvedDependencyInfo.getGroup() + "-" + resolvedDependencyInfo.getName(), resolvedDependencyInfo.getVariantName(), resolvedDependencyInfo.getGradlePath(), null, convert(resolvedDependencyInfo.getResolvedArtifact()));
awbBundle.setSoLibraries(soLibraries);
return awbBundle;
}
use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class DependencyTree method toAndroidDependency.
/**
* 转换为Android的依赖
*
* @return
*/
public AndroidDependencyTree toAndroidDependency() {
AndroidDependencyTree androidDependencyTree = new AndroidDependencyTree(mResolvedDependencies);
for (ResolvedDependencyInfo dependencyInfo : mResolvedDependencies) {
switch(DependencyConvertUtils.Type.getType(dependencyInfo.getType())) {
case AAR:
AarBundle aarBundle = DependencyConvertUtils.toAarBundle(dependencyInfo);
androidDependencyTree.getAarBundles().add(aarBundle);
for (AndroidLibrary libraryDependency : aarBundle.getLibraryDependencies()) {
if (libraryDependency instanceof AarBundle) {
androidDependencyTree.getAarBundles().add((AarBundle) libraryDependency);
}
}
androidDependencyTree.getJars().addAll(aarBundle.getJavaDependencies());
androidDependencyTree.getSoLibraries().addAll(aarBundle.getSoLibraries());
break;
case AWB:
AwbBundle awbBundle = DependencyConvertUtils.toAwbBundle(dependencyInfo);
androidDependencyTree.getAwbBundles().add(awbBundle);
break;
case JAR:
JavaLibrary jarInfo = DependencyConvertUtils.toJarDependency(dependencyInfo);
androidDependencyTree.getJars().add(jarInfo);
androidDependencyTree.getJars().addAll(jarInfo.getDependencies());
break;
case SOLIB:
SoLibrary soLibrary = DependencyConvertUtils.toSoLibrary(dependencyInfo);
androidDependencyTree.getSoLibraries().add(soLibrary);
break;
case APK:
ApkLibrary apkLibrary = DependencyConvertUtils.toApkLibrary(dependencyInfo);
androidDependencyTree.getApkLibraries().add(apkLibrary);
break;
case AP:
ApLibrary apLibrary = DependencyConvertUtils.toApLibrary(dependencyInfo);
androidDependencyTree.getApLibraries().add(apLibrary);
break;
default:
break;
}
}
return androidDependencyTree;
}
use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class JavacAwbsTask method run.
@TaskAction
void run() throws ExecutionException, InterruptedException {
AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(getVariantName());
if (null == androidDependencyTree) {
return;
}
ExecutorServicesHelper executorServicesHelper = new ExecutorServicesHelper(taskName, getLogger(), 0);
List<Runnable> runnables = new ArrayList<>();
for (final AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
runnables.add(new Runnable() {
@Override
public void run() {
try {
AwbJavaCompileConfigAction awbJavaCompileConfigAction = new AwbJavaCompileConfigAction(awbBundle, appVariantOutputContext);
JavaCompile awbJavaCompile = TaskCreater.create(getProject(), awbJavaCompileConfigAction.getName(), awbJavaCompileConfigAction.getType());
awbJavaCompileConfigAction.execute(awbJavaCompile);
awbJavaCompile.execute();
AwbTransform awbTransform = appVariantOutputContext.getAwbTransformMap().get(awbBundle.getName());
awbTransform.setInputDir(awbJavaCompile.getDestinationDir());
} catch (Throwable e) {
e.printStackTrace();
throw new GradleException("javac " + awbBundle.getName() + " failed");
}
}
});
}
executorServicesHelper.execute(runnables);
}
use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class MergeResV4Dir method taskAction.
@TaskAction
public void taskAction() throws IOException {
File resDir = variantScope.getFinalResourcesDir();
moveFiles(resDir);
AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(getVariantName());
if (null != androidDependencyTree) {
for (final AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
File awbResDir = variantContext.getMergeResources(awbBundle);
moveFiles(awbResDir);
}
}
}
use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class PrepareAwbTask method run.
@TaskAction
void run() throws ExecutionException, InterruptedException, IOException, DocumentException {
AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(getVariantName());
if (null == androidDependencyTree) {
return;
}
ExecutorServicesHelper executorServicesHelper = new ExecutorServicesHelper(taskName, getLogger(), 0);
List<Runnable> runnables = new ArrayList<>();
Set<SoLibrary> soLibraries = androidDependencyTree.getALLSoLibDependencies();
for (final SoLibrary soLibrary : soLibraries) {
runnables.add(new Runnable() {
@Override
public void run() {
prepare(soLibrary.getSoLibFile(), soLibrary.getFolder(), false);
}
});
}
executorServicesHelper.execute(runnables);
runnables.clear();
List<AwbBundle> awbBundles = androidDependencyTree.getAwbBundles();
for (final AwbBundle awbBundle : awbBundles) {
runnables.add(new Runnable() {
@Override
public void run() {
prepare(awbBundle.getBundle(), awbBundle.getFolder(), true);
}
});
}
executorServicesHelper.execute(runnables);
runnables.clear();
Set<AarBundle> aarBundles = androidDependencyTree.getALLAarDependencies();
for (final AarBundle aarBundle : aarBundles) {
runnables.add(new Runnable() {
@Override
public void run() {
prepare(aarBundle.getBundle(), aarBundle.getFolder(), true);
}
});
}
executorServicesHelper.execute(runnables);
runnables.clear();
}
Aggregations