use of com.taobao.android.builder.dependency.model.AarBundle in project atlas by alibaba.
the class DependencyConvertUtils method collectChildren.
/**
* 收集子集合
*
* @param dependencyInfo
* @param dependencies
* @param jarDependencies
* @param soLibraries
*/
private static void collectChildren(ResolvedDependencyInfo dependencyInfo, List<LibraryDependency> dependencies, Collection<JarDependency> jarDependencies, List<SoLibrary> soLibraries) {
List<ResolvedDependencyInfo> children = dependencyInfo.getChildren();
for (ResolvedDependencyInfo child : children) {
switch(Type.getType(child.getType())) {
case AAR:
AarBundle aarBundle = toAarBundle(child, false);
dependencies.add(aarBundle);
collectChildren(child, dependencies, jarDependencies, soLibraries);
break;
case JAR:
JarDependency jarInfo = toJarDependency(child, false);
jarDependencies.add(jarInfo);
collectChildren(child, dependencies, jarDependencies, soLibraries);
break;
case SOLIB:
SoLibrary soLibrary = toSoLibrary(child);
soLibraries.add(soLibrary);
break;
default:
break;
}
}
}
use of com.taobao.android.builder.dependency.model.AarBundle in project atlas by alibaba.
the class DependencyConvertUtils method toAarBundle.
/**
* 将依赖类型转换为LibraryDependencyImpl
*
* @param resolvedDependencyInfo
* @return
*/
private static AarBundle toAarBundle(ResolvedDependencyInfo resolvedDependencyInfo, boolean containChild) {
assertType(Type.AAR, resolvedDependencyInfo);
List<LibraryDependency> dependencies = Lists.newArrayList();
Collection<JarDependency> jarDependencies = Lists.newArrayList();
List<SoLibrary> soLibraries = Lists.newArrayList();
if (containChild) {
collectChildren(resolvedDependencyInfo, dependencies, jarDependencies, soLibraries);
}
AarBundle aarBundle = new AarBundle(resolvedDependencyInfo.getResolvedArtifact().getFile(), resolvedDependencyInfo.getExplodedDir(), dependencies, jarDependencies, resolvedDependencyInfo.getGroup() + "-" + resolvedDependencyInfo.getName(), resolvedDependencyInfo.getVariantName(), resolvedDependencyInfo.getGradlePath(), null, convert(resolvedDependencyInfo.getResolvedArtifact()));
aarBundle.setSoLibraries(soLibraries);
return aarBundle;
}
use of com.taobao.android.builder.dependency.model.AarBundle 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.AarBundle 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();
}
use of com.taobao.android.builder.dependency.model.AarBundle in project atlas by alibaba.
the class AwoDependency method parseDependency.
public void parseDependency(AndroidDependencyTree libDependencyTree, AwbBundle awbBundle) {
List<SoLibrary> soLibraries = new ArrayList<SoLibrary>();
for (SoLibrary soLibrary : libDependencyTree.getSoLibraries()) {
if (isCompileDependency(soLibrary.getResolvedCoordinates())) {
soLibraries.add(soLibrary);
}
}
List aarBundles = new ArrayList<>();
for (AarBundle aarBundle : libDependencyTree.getAarBundles()) {
if (isCompileDependency(aarBundle.getResolvedCoordinates())) {
aarBundles.add(aarBundle);
}
}
List jarInfos = new ArrayList<JavaLibrary>();
for (JavaLibrary jarInfo : libDependencyTree.getJars()) {
if (isCompileDependency(jarInfo.getResolvedCoordinates())) {
jarInfos.add(jarInfo);
}
}
awbBundle.getSoLibraries().addAll(soLibraries);
awbBundle.getLibraryDependencies().addAll(aarBundles);
awbBundle.getJavaDependencies().addAll(jarInfos);
}
Aggregations