in gradle-runner-agent/src/main/java/jetbrains/buildServer/gradle/agent/commandLineComposers/GradleToolingApiCommandLineComposer.java [264:280]
private Path moveLibrary(@NotNull Path libraryPath, @NotNull Path targetDir) {
Path targetPath;
try {
targetPath = targetDir.resolve(libraryPath.getFileName());
if (!Files.exists(targetPath)) {
if (Files.isRegularFile(libraryPath)) {
FileUtil.copy(libraryPath.toFile(), targetPath.toFile());
} else {
FileUtil.copyDir(libraryPath.toFile(), targetPath.toFile());
}
}
} catch (IOException e) {
throw new RuntimeException("Failed to move library " + libraryPath + " to " + targetDir, e);
}
return targetPath;
}