Search in sources :

Example 1 with LibraryArtifact

use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact in project bazel by bazelbuild.

the class AndroidStudioInfoAspect method makeAndroidIdeInfo.

private static AndroidIdeInfo makeAndroidIdeInfo(AndroidIdeInfoProvider androidIdeInfoProvider, DependenciesResult dependenciesResult, NestedSetBuilder<Artifact> ideResolveArtifacts) {
    AndroidIdeInfo.Builder builder = AndroidIdeInfo.newBuilder();
    if (androidIdeInfoProvider.getSignedApk() != null) {
        builder.setApk(makeArtifactLocation(androidIdeInfoProvider.getSignedApk()));
    }
    Artifact manifest = androidIdeInfoProvider.getManifest();
    if (manifest != null) {
        builder.setManifest(makeArtifactLocation(manifest));
        addResolveArtifact(ideResolveArtifacts, manifest);
    }
    for (Artifact artifact : androidIdeInfoProvider.getApksUnderTest()) {
        builder.addDependencyApk(makeArtifactLocation(artifact));
    }
    for (SourceDirectory resourceDir : androidIdeInfoProvider.getResourceDirs()) {
        ArtifactLocation artifactLocation = makeArtifactLocation(resourceDir);
        builder.addResources(artifactLocation);
    }
    if (androidIdeInfoProvider.getJavaPackage() != null) {
        builder.setJavaPackage(androidIdeInfoProvider.getJavaPackage());
    }
    String idlImportRoot = androidIdeInfoProvider.getIdlImportRoot();
    if (idlImportRoot != null) {
        builder.setIdlImportRoot(idlImportRoot);
    }
    boolean hasIdlSources = !androidIdeInfoProvider.getIdlSrcs().isEmpty();
    builder.setHasIdlSources(hasIdlSources);
    if (hasIdlSources) {
        LibraryArtifact idlLibraryArtifact = makeLibraryArtifact(ideResolveArtifacts, androidIdeInfoProvider.getIdlClassJar(), null, androidIdeInfoProvider.getIdlSourceJar());
        if (idlLibraryArtifact != null) {
            builder.setIdlJar(idlLibraryArtifact);
        }
    }
    builder.setGenerateResourceClass(androidIdeInfoProvider.definesAndroidResources());
    if (dependenciesResult.resources != null) {
        builder.setLegacyResources(dependenciesResult.resources.toString());
    }
    OutputJar resourceJar = androidIdeInfoProvider.getResourceJar();
    if (resourceJar != null) {
        LibraryArtifact resourceLibraryArtifact = makeLibraryArtifact(ideResolveArtifacts, resourceJar.getClassJar(), resourceJar.getIJar(), resourceJar.getSrcJar());
        if (resourceLibraryArtifact != null) {
            builder.setResourceJar(resourceLibraryArtifact);
        }
    }
    return builder.build();
}
Also used : OutputJar(com.google.devtools.build.lib.rules.java.JavaRuleOutputJarsProvider.OutputJar) ArtifactLocation(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation) SourceDirectory(com.google.devtools.build.lib.rules.android.AndroidIdeInfoProvider.SourceDirectory) AndroidIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.AndroidIdeInfo) LibraryArtifact(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact) Artifact(com.google.devtools.build.lib.actions.Artifact) LibraryArtifact(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact)

Aggregations

Artifact (com.google.devtools.build.lib.actions.Artifact)1 SourceDirectory (com.google.devtools.build.lib.rules.android.AndroidIdeInfoProvider.SourceDirectory)1 OutputJar (com.google.devtools.build.lib.rules.java.JavaRuleOutputJarsProvider.OutputJar)1 AndroidIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.AndroidIdeInfo)1 ArtifactLocation (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation)1 LibraryArtifact (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact)1