use of com.taobao.android.builder.dependency.AtlasDependencyTree in project atlas by alibaba.
the class AtlasDependencyManager method resolveDependencies.
/**
* 1 . detect if has awb dependency
* <p>
* yes : special process
* no : default process
* <p>
* 2. parse to AtlasDependencyTree
*/
public Set<AndroidDependency> resolveDependencies(@NonNull VariantDependencies variantDeps) {
this.apDependency = resolveApDependencies(variantDeps);
AtlasDependencyTree atlasDependencyTree = new AtlasDepTreeParser(project, extraModelInfo, awbs).parseDependencyTree(variantDeps);
sLogger.info("[dependencyTree" + variantDeps.getName() + "] {}", JSON.toJSONString(atlasDependencyTree.getDependencyJson(), true));
if (PluginTypeUtils.isAppProject(project)) {
AtlasBuildContext.androidDependencyTrees.put(variantDeps.getName(), atlasDependencyTree);
} else {
AtlasBuildContext.libDependencyTrees.put(variantDeps.getName(), atlasDependencyTree);
}
// return libsToExplode;
return new HashSet<>(0);
}
use of com.taobao.android.builder.dependency.AtlasDependencyTree in project atlas by alibaba.
the class AtlasDepTreeParser method parseDependencyTree.
public AtlasDependencyTree parseDependencyTree(@NonNull VariantDependencies variantDeps) {
//
String name = variantDeps.getName().toLowerCase();
if (!name.endsWith("debug") && !name.endsWith("release")) {
return new AtlasDependencyTree(new ArrayList<>());
}
if (!name.equals("debug") && name.endsWith("debug")) {
flavorName = variantDeps.getName().substring(0, name.length() - 5);
}
if (!name.equals("release") && name.endsWith("release")) {
flavorName = variantDeps.getName().substring(0, name.length() - 6);
}
Configuration compileClasspath = variantDeps.getCompileClasspath();
Configuration runtimeClasspath = variantDeps.getRuntimeClasspath();
Configuration apiClasspath = variantDeps.getApiElements();
Configuration configuration = variantDeps.getAnnotationProcessorConfiguration();
Configuration bundleClasspath = project.getConfigurations().maybeCreate(AtlasPlugin.BUNDLE_COMPILE);
ensureConfigured(compileClasspath, project);
ensureConfigured(runtimeClasspath, project);
ensureConfigured(bundleClasspath, project);
ensureConfigured(apiClasspath, project);
ensureConfigured(configuration, project);
Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts = Maps.newHashMap();
collectArtifacts(compileClasspath, artifacts);
collectArtifacts(runtimeClasspath, artifacts);
collectArtifacts(apiClasspath, artifacts);
collectArtifacts(bundleClasspath, artifacts);
collectArtifacts(configuration, artifacts);
unEnsureConfigured(compileClasspath);
unEnsureConfigured(runtimeClasspath);
unEnsureConfigured(bundleClasspath);
unEnsureConfigured(apiClasspath);
unEnsureConfigured(configuration);
// Rely on the group
DependencyGroup dependencyGroup = new DependencyGroup(compileClasspath, bundleClasspath, artifacts, awbs);
DependencyResolver dependencyResolver = new DependencyResolver(project, variantDeps, artifacts, dependencyGroup.bundleProvidedMap, dependencyGroup.bundleCompileMap);
mResolvedDependencies.addAll(dependencyResolver.resolve(dependencyGroup.compileDependencies, true));
for (DependencyResult dependencyResult : dependencyGroup.bundleDependencies) {
mResolvedDependencies.addAll(dependencyResolver.resolve(Arrays.asList(dependencyResult), false));
}
AtlasDependencyTree atlasDependencyTree = toAtlasDependencyTree();
check(atlasDependencyTree);
return atlasDependencyTree;
}
use of com.taobao.android.builder.dependency.AtlasDependencyTree in project atlas by alibaba.
the class AtlasDepTreeParser method toAtlasDependencyTree.
private AtlasDependencyTree toAtlasDependencyTree() {
AtlasDependencyTree atlasDependencyTree = new AtlasDependencyTree(mResolvedDependencies);
// Setting dependency
for (ResolvedDependencyInfo dependencyInfo : mResolvedDependencies) {
if (Type.AWB == DependencyConvertUtils.Type.getType(dependencyInfo.getType())) {
AwbBundle bundle = DependencyConvertUtils.toBundle(dependencyInfo, project);
// if (apDependencies != null) {
// Map<ModuleIdentifier, String> awbDependencies = apDependencies.getAwbDependencies(
// dependencyInfo.getGroup(), dependencyInfo.getName());
// bundle.setBaseAwbDependencies(awbDependencies);
// }
atlasDependencyTree.getAwbBundles().add(bundle);
collect(dependencyInfo, bundle);
} else {
collect(dependencyInfo, atlasDependencyTree.getMainBundle());
}
}
return atlasDependencyTree;
}
Aggregations