use of com.google.devtools.build.lib.actions.MissingInputFileException in project bazel by bazelbuild.
the class ArtifactFunction method makeMissingInputFileExn.
private static MissingInputFileException makeMissingInputFileExn(Artifact artifact, boolean mandatory, Exception failure, EventHandler reporter) {
String extraMsg = (failure == null) ? "" : (":" + failure.getMessage());
MissingInputFileException ex = new MissingInputFileException(constructErrorMessage(artifact) + extraMsg, null);
if (mandatory) {
reporter.handle(Event.error(ex.getLocation(), ex.getMessage()));
}
return ex;
}
use of com.google.devtools.build.lib.actions.MissingInputFileException in project bazel by bazelbuild.
the class ArtifactFunctionTest method testIOException_EndToEnd.
/**
* Tests that ArtifactFunction rethrows transitive {@link IOException}s as
* {@link MissingInputFileException}s.
*/
@Test
public void testIOException_EndToEnd() throws Throwable {
final IOException exception = new IOException("beep");
setupRoot(new CustomInMemoryFs() {
@Override
public FileStatus stat(Path path, boolean followSymlinks) throws IOException {
if (path.getBaseName().equals("bad")) {
throw exception;
}
return super.stat(path, followSymlinks);
}
});
try {
evaluateArtifactValue(createSourceArtifact("bad"));
fail();
} catch (MissingInputFileException e) {
assertThat(e.getMessage()).contains(exception.getMessage());
}
}
use of com.google.devtools.build.lib.actions.MissingInputFileException in project bazel by bazelbuild.
the class ArtifactFunctionTest method testMissingMandatoryArtifact.
@Test
public void testMissingMandatoryArtifact() throws Throwable {
Artifact input = createSourceArtifact("input1");
try {
evaluateArtifactValue(input, /*mandatory=*/
true);
fail();
} catch (MissingInputFileException ex) {
// Expected.
}
}
Aggregations