private void setupDocker()

in src/main/java/com/google/devtools/build/remote/client/RemoteClient.java [370:399]


  private void setupDocker(Command command, Digest inputRootDigest, Path root) throws IOException {
    System.out.printf("Setting up Action in directory %s...\n", root.toAbsolutePath());

    try {
      cache.downloadDirectory(root, inputRootDigest);
    } catch (IOException e) {
      throw new IOException("Failed to download action inputs.", e);
    }

    // Setup directory structure for outputs.
    for (String output : command.getOutputFilesList()) {
      Path file = root.resolve(output);
      if (java.nio.file.Files.exists(file)) {
        throw new FileSystemAlreadyExistsException("Output file already exists: " + file);
      }
      Files.createParentDirs(file.toFile());
    }
    for (String output : command.getOutputDirectoriesList()) {
      Path dir = root.resolve(output);
      if (java.nio.file.Files.exists(dir)) {
        throw new FileSystemAlreadyExistsException("Output directory already exists: " + dir);
      }
      java.nio.file.Files.createDirectories(dir);
    }
    DockerUtil util = new DockerUtil();
    String dockerCommand = util.getDockerCommand(command, root.toString());
    System.out.println("\nSuccessfully setup Action in directory " + root.toString() + ".");
    System.out.println("\nTo run the Action locally, run:");
    System.out.println("  " + dockerCommand);
  }