Search in sources :

Example 1 with JavaLibraryImpl

use of com.android.build.gradle.internal.ide.level2.JavaLibraryImpl in project atlas by alibaba.

the class AtlasDependencyGraph method instantiateLibrary.

@NonNull
private static Library instantiateLibrary(@NonNull AtlasDependencyGraph.HashableResolvedArtifactResult artifact) {
    Library library;
    ComponentIdentifier id = artifact.getId().getComponentIdentifier();
    String address = AtlasDependencyGraph.computeAddress(artifact);
    if (!(id instanceof ProjectComponentIdentifier) || artifact.isWrappedModule()) {
        if (artifact.getDependencyType() == DependencyType.ANDROID || artifact.getDependencyType() == DependencyType.AWB) {
            File explodedFolder = artifact.getFile();
            library = new com.android.build.gradle.internal.ide.level2.AndroidLibraryImpl(address, artifact.bundleResult != null ? artifact.bundleResult.getFile() : // fallback so that the value is non-null
            explodedFolder, explodedFolder, findLocalJarsAsStrings(explodedFolder));
        } else {
            library = new JavaLibraryImpl(address, artifact.getFile());
        }
    } else {
        library = new ModuleLibraryImpl(address, ((ProjectComponentIdentifier) id).getProjectPath(), getVariant(artifact));
    }
    synchronized (sGlobalLibrary) {
        sGlobalLibrary.put(library.getArtifactAddress(), library);
    }
    return library;
}
Also used : JavaLibraryImpl(com.android.build.gradle.internal.ide.level2.JavaLibraryImpl) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) JvmLibrary(org.gradle.jvm.JvmLibrary) Library(com.android.builder.model.level2.Library) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) File(java.io.File) com.android.build.gradle.internal.ide.level2(com.android.build.gradle.internal.ide.level2) NonNull(com.android.annotations.NonNull)

Aggregations

NonNull (com.android.annotations.NonNull)1 com.android.build.gradle.internal.ide.level2 (com.android.build.gradle.internal.ide.level2)1 JavaLibraryImpl (com.android.build.gradle.internal.ide.level2.JavaLibraryImpl)1 Library (com.android.builder.model.level2.Library)1 File (java.io.File)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)1 JvmLibrary (org.gradle.jvm.JvmLibrary)1