use of com.taobao.android.builder.dependency.parser.helper.DependencyResolver 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;
}
Aggregations