use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.
the class RemoteOutputsCacheTest method testExtensionOnly.
@Test
public void testExtensionOnly() {
RemoteOutputArtifact artifact = mock(RemoteOutputArtifact.class);
when(artifact.getKey()).thenReturn("k8-opt/foo/bar/.bazelrc");
assertThat(RemoteOutputsCache.getCacheKey(artifact)).isEqualTo("_764d6d66.bazelrc");
}
use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.
the class RemoteOutputsCacheTest method testWindowsStylePath.
@Test
public void testWindowsStylePath() {
RemoteOutputArtifact artifact = mock(RemoteOutputArtifact.class);
when(artifact.getKey()).thenReturn("k8-opt\\foo\\bar\\foo.bar");
assertThat(RemoteOutputsCache.getCacheKey(artifact)).isEqualTo("foo_2a410243.bar");
}
use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.
the class RemoteOutputsCacheTest method testNoExtension.
@Test
public void testNoExtension() {
RemoteOutputArtifact artifact = mock(RemoteOutputArtifact.class);
when(artifact.getKey()).thenReturn("k8-opt/include/vector");
assertThat(RemoteOutputsCache.getCacheKey(artifact)).isEqualTo("vector_4d304806");
}
use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.
the class RemoteOutputsCacheTest method testNormalExtension.
@Test
public void testNormalExtension() {
RemoteOutputArtifact artifact = mock(RemoteOutputArtifact.class);
when(artifact.getKey()).thenReturn("k8-opt/foo/bar/SourceFile.java");
assertThat(RemoteOutputsCache.getCacheKey(artifact)).isEqualTo("SourceFile_827b9898.java");
}
use of com.google.idea.blaze.base.command.buildresult.RemoteOutputArtifact in project intellij by bazelbuild.
the class BlazePyResolverUtils method resolveGenfilesPath.
/**
* Resolves a genfiles-relative path to a locally-accessible file.
*/
private static Optional<File> resolveGenfilesPath(Project project, String relativePath) {
BlazeProjectData projectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
if (projectData == null) {
return Optional.empty();
}
// first look for remote output artifacts
// TODO(brendandouglas): add a common solution handling both remote and local outputs
RemoteOutputArtifacts remotes = RemoteOutputArtifacts.fromProjectData(projectData);
RemoteOutputArtifact artifact = remotes.resolveGenfilesPath(relativePath);
if (artifact == null) {
artifact = remotes.resolveGenfilesPath(relativePath + ".py");
}
if (artifact != null) {
return Optional.ofNullable(OutputArtifactResolver.resolve(project, artifact));
}
return Optional.of(new File(projectData.getBlazeInfo().getGenfilesDirectory(), relativePath));
}
Aggregations