Search in sources :

Example 11 with RemoteOutputArtifact

use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.

the class RemoteOutputsCacheTest method testEndingDot.

@Test
public void testEndingDot() {
    RemoteOutputArtifact artifact = mock(RemoteOutputArtifact.class);
    when(artifact.getKey()).thenReturn("k8-opt/foo/bar/foo.");
    assertThat(RemoteOutputsCache.getCacheKey(artifact)).isEqualTo("foo_bddfde49.");
}
Also used : RemoteOutputArtifact(com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact) Test(org.junit.Test)

Example 12 with RemoteOutputArtifact

use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.

the class RemoteOutputsCacheTest method testDoubleExtension.

@Test
public void testDoubleExtension() {
    RemoteOutputArtifact artifact = mock(RemoteOutputArtifact.class);
    when(artifact.getKey()).thenReturn("k8-opt/foo/bar/proto.pb.go");
    assertThat(RemoteOutputsCache.getCacheKey(artifact)).isEqualTo("proto_f767ed9d.pb.go");
}
Also used : RemoteOutputArtifact(com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact) Test(org.junit.Test)

Example 13 with RemoteOutputArtifact

use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.

the class RemoteOutputsCacheTest method testDoubleDot.

@Test
public void testDoubleDot() {
    RemoteOutputArtifact artifact = mock(RemoteOutputArtifact.class);
    when(artifact.getKey()).thenReturn("k8-opt/foo/bar/foo..bar");
    assertThat(RemoteOutputsCache.getCacheKey(artifact)).isEqualTo("foo_f2dbf6ee..bar");
}
Also used : RemoteOutputArtifact(com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact) Test(org.junit.Test)

Example 14 with RemoteOutputArtifact

use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.

the class UnpackedAars method getClassJar.

/**
 * Returns the merged jar derived from an AAR, in the unpacked AAR directory.
 */
@Nullable
public File getClassJar(ArtifactLocationDecoder decoder, AarLibrary library) {
    if (library.libraryArtifact == null) {
        return null;
    }
    BlazeArtifact jar = decoder.resolveOutput(library.libraryArtifact.jarForIntellijLibrary());
    if (aarCache.isEmpty()) {
        logger.warn("Cache state is empty");
        return getFallbackFile(jar);
    }
    BlazeArtifact aar = decoder.resolveOutput(library.aarArtifact);
    File aarDir = getAarDir(decoder, library);
    // check if it was actually cached
    if (aarDir == null) {
        // cannot find any fallback file.
        if (jar instanceof RemoteOutputArtifact) {
            logger.warn(String.format("Fail to look up %s from cache state for library [aarArtifact = %s, jar = %s]", aarDir, aar, jar));
            logger.debug("Cache state contains the following keys: " + aarCache.getCachedKeys());
        }
        return getFallbackFile(jar);
    }
    return UnpackedAarUtils.getJarFile(aarDir);
}
Also used : RemoteOutputArtifact(com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact) BlazeArtifact(com.google.idea.blaze.base.command.buildresult.BlazeArtifact) File(java.io.File) Nullable(javax.annotation.Nullable)

Aggregations

RemoteOutputArtifact (com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact)14 Test (org.junit.Test)8 File (java.io.File)4 ImmutableMap (com.google.common.collect.ImmutableMap)2 ImmutableMap.toImmutableMap (com.google.common.collect.ImmutableMap.toImmutableMap)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 BlazeArtifact (com.google.idea.blaze.base.command.buildresult.BlazeArtifact)2 Map (java.util.Map)2 ExecutionException (java.util.concurrent.ExecutionException)2 Joiner (com.google.common.base.Joiner)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Futures (com.google.common.util.concurrent.Futures)1 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)1 Common (com.google.devtools.intellij.aspect.Common)1 JavaSourcePackage (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.JavaSourcePackage)1 PackageManifest (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.PackageManifest)1 FutureUtil (com.google.idea.blaze.base.async.FutureUtil)1