Search in sources :

Example 1 with ConfigurationDependencyGraphs

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());
}
Also used : ConfigurationDependencyGraphs(com.android.build.gradle.internal.dependency.ConfigurationDependencyGraphs) GraphItem(com.android.builder.model.level2.GraphItem) JvmLibrary(org.gradle.jvm.JvmLibrary) Library(com.android.builder.model.level2.Library)

Aggregations

ConfigurationDependencyGraphs (com.android.build.gradle.internal.dependency.ConfigurationDependencyGraphs)1 GraphItem (com.android.builder.model.level2.GraphItem)1 Library (com.android.builder.model.level2.Library)1 JvmLibrary (org.gradle.jvm.JvmLibrary)1