private Stream getCommonAgentLibsClasspathEntries()

in gradle-runner-agent/src/main/java/jetbrains/buildServer/gradle/agent/commandLineComposers/GradleToolingApiCommandLineComposer.java [233:261]


  private Stream<Path> getCommonAgentLibsClasspathEntries(@NotNull GradleCommandLineComposerParameters parameters) {
    boolean relocateLibs = parameters.getRunnerContext().isVirtualContext() &&
                           getBooleanOrDefault(parameters.getConfigParameters(), GRADLE_RUNNER_PLACE_LIBS_FOR_TOOLING_IN_TEMP_DIR, true);

    Path libsTempDir = parameters.getBuildTempDir().resolve("agentLibs");
    try {
      if (relocateLibs) Files.createDirectories(libsTempDir);
    } catch (IOException e) {
      throw new RuntimeException("Failed to create temp directory for common agent libs at " + libsTempDir, e);
    }

    return Stream
      .of(
        ServiceMessage.class,
        com.google.gson.Gson.class,
        LoggerFactory.class,
        StaticLoggerBinder.class,
        AbstractLoggerAdapter.class,
        LoggerContextAccessor.class,
        ClasspathUtil.class,
        ComparisonFailureUtil.class,
        FileUtil.class,
        com.intellij.openapi.util.io.FileUtil.class,
        com.intellij.openapi.diagnostic.Logger.class,
        JDOMException.class
      )
      .map(this::getClasspathEntry)
      .map(originalPath -> relocateLibs ? moveLibrary(originalPath, libsTempDir) : originalPath);
  }