@Override
  public void exec() {
    Iterable<File> files = getScreenshotFiles();

    for (File file : files) {
      super.setErrorOutput(SafeStreams.systemErr());
      super.setStandardOutput(SafeStreams.systemOut());

      doExec(getArgs(file));
    }
  }
Example #2
0
 private BuildActionExecuter<ProviderOperationParameters> createExecuter(
     ProviderOperationParameters operationParameters) {
   LoggingServiceRegistry loggingServices;
   Parameters params = initParams(operationParameters);
   BuildActionExecuter<BuildActionParameters> executer;
   if (Boolean.TRUE.equals(operationParameters.isEmbedded())) {
     loggingServices = this.loggingServices;
     executer = embeddedExecutor;
   } else {
     if (Boolean.TRUE.equals(operationParameters.isColorOutput())) {
       PrintStream outStr = new PrintStream(operationParameters.getStandardOutput());
       DefaultColorMap colourMap = new DefaultColorMap();
       colourMap.setUseColor(true);
       Console console = new AnsiConsole(outStr, outStr, colourMap, true);
       loggingServices = this.loggingServices.newColoredLogging(console);
     } else {
       loggingServices = this.loggingServices.newToolingApiLogging();
     }
     loggingServices
         .get(OutputEventRenderer.class)
         .configure(operationParameters.getBuildLogLevel());
     ServiceRegistry clientServices =
         daemonClientFactory.createBuildClientServices(
             loggingServices.get(OutputEventListener.class),
             params.daemonParams,
             operationParameters.getStandardInput(SafeStreams.emptyInput()));
     executer = clientServices.get(DaemonClient.class);
   }
   Factory<LoggingManagerInternal> loggingManagerFactory =
       loggingServices.getFactory(LoggingManagerInternal.class);
   return new LoggingBridgingBuildActionExecuter(
       new DaemonBuildActionExecuter(executer, params.daemonParams), loggingManagerFactory);
 }