in gradle-runner-agent/src/main/java/jetbrains/buildServer/gradle/runtime/service/DistributionFactoryExtension.java [93:114]
public ClassPath getToolingImplementationClasspath(ProgressLoggerFactory progressLoggerFactory,
InternalBuildProgressListener progressListener,
ConnectionParameters connectionParameters,
BuildCancellationToken cancellationToken) {
if (!gradleHomeDir.exists()) {
throw new IllegalArgumentException(String.format("The specified %s does not exist.", locationDisplayName));
}
if (!gradleHomeDir.isDirectory()) {
throw new IllegalArgumentException(String.format("The specified %s is not a directory.", locationDisplayName));
}
File libDir = new File(gradleHomeDir, "lib");
if (!libDir.isDirectory()) {
throw new IllegalArgumentException(
String.format("The specified %s does not appear to contain a Gradle distribution.", locationDisplayName));
}
File[] files = libDir.listFiles(file -> hasExtension(file, ".jar"));
// Make sure file order is always consistent
if (files != null) {
Arrays.sort(files);
}
return DefaultClassPath.of(files);
}