use of com.android.build.gradle.internal.dependency.ConfigurationDependencyGraphs in project atlas by alibaba.
the class AtlasDependencyGraph method clone.
public static DependencyGraphs clone(@NonNull DependencyGraphs dependencyGraphs, int modelLevel, boolean modelWithFullDependency) {
if (modelLevel < AndroidProject.MODEL_LEVEL_4_NEW_DEP_MODEL) {
return EMPTY_DEPENDENCY_GRAPH;
}
Preconditions.checkState(dependencyGraphs instanceof ConfigurationDependencyGraphs);
ConfigurationDependencyGraphs cdg = (ConfigurationDependencyGraphs) dependencyGraphs;
// these items are already ready for serializable, all we need to clone is
// the DependencyGraphs instance.
List<Library> libs = cdg.getLibraries();
synchronized (sGlobalLibrary) {
for (Library library : libs) {
sGlobalLibrary.put(library.getArtifactAddress(), library);
}
}
final List<GraphItem> nodes = cdg.getCompileDependencies();
if (modelWithFullDependency) {
return new FullDependencyGraphsImpl(nodes, nodes, ImmutableList.of(), ImmutableList.of());
}
// just need to register the libraries in the global libraries.
return new SimpleDependencyGraphsImpl(nodes, cdg.getProvidedLibraries());
}
Aggregations