// TODO(ulfjack): Consider acquiring local resources here before trying to write the file.
@Override
  public List<SpawnResult> writeOutputToFile(
      AbstractAction action,
      ActionExecutionContext actionExecutionContext,
      DeterministicWriter deterministicWriter,
      boolean makeExecutable, boolean isRemotable)
      throws ExecException {
    Path outputPath =
        actionExecutionContext.getInputPath(Iterables.getOnlyElement(action.getOutputs()));
    // TODO(ulfjack): Consider acquiring local resources here before trying to write the file.
    try (AutoProfiler p =
        AutoProfiler.logged(
            "running write for action " + action.prettyPrint(),
            logger,
            /*minTimeForLoggingInMilliseconds=*/ 100)) {
      try {
        try (OutputStream out = new BufferedOutputStream(outputPath.getOutputStream())) {
          deterministicWriter.writeOutputFile(out);
        }
        if (makeExecutable) {
          outputPath.setExecutable(true);
        }
      } catch (IOException e) {
        throw new EnvironmentalExecException("IOException during file write", e);
      }
    }
    return ImmutableList.of();
  }
Path outputPath =
actionExecutionContext.getInputPath(Iterables.getOnlyElement(action.getOutputs()));
// TODO(ulfjack): Consider acquiring local resources here before trying to write the file.
try (AutoProfiler p =
AutoProfiler.logged(
@Override
public List<SpawnResult> writeOutputToFile(
AbstractAction action,
ActionExecutionContext actionExecutionContext,
DeterministicWriter deterministicWriter,
boolean makeExecutable, boolean isRemotable)
throws ExecException {
Path outputPath =
actionExecutionContext.getInputPath(Iterables.getOnlyElement(action.getOutputs()));
// TODO(ulfjack): Consider acquiring local resources here before trying to write the file.
try (AutoProfiler p =
AutoProfiler.logged(
"running write for action " + action.prettyPrint(),
logger,
/*minTimeForLoggingInMilliseconds=*/ 100)) {
try {
try (OutputStream out = new BufferedOutputStream(outputPath.getOutputStream())) {
deterministicWriter.writeOutputFile(out);
}
if (makeExecutable) {
@Override
public List<SpawnResult> writeOutputToFile(
AbstractAction action,
ActionExecutionContext actionExecutionContext,
DeterministicWriter deterministicWriter,
boolean makeExecutable, boolean isRemotable)
throws ExecException {
Path outputPath =
actionExecutionContext.getInputPath(Iterables.getOnlyElement(action.getOutputs()));
// TODO(ulfjack): Consider acquiring local resources here before trying to write the file.
try (AutoProfiler p =
AutoProfiler.logged(
"running write for action " + action.prettyPrint(),
logger,
/*minTimeForLoggingInMilliseconds=*/ 100)) {
try {
try (OutputStream out = new BufferedOutputStream(outputPath.getOutputStream())) {
deterministicWriter.writeOutputFile(out);
}
if (makeExecutable) {
outputPath.setExecutable(true);
}
} catch (IOException e) {
throw new EnvironmentalExecException("IOException during file write", e);
}
}
return ImmutableList.of();
}