in gradle-runner-agent/src/main/java/jetbrains/buildServer/gradle/agent/GradleToolingConnectorFactory.java [14:35]
public static GradleConnector instantiate(@NotNull File workingDirectory,
@NotNull Boolean useWrapper,
@Nullable File gradleHome,
@Nullable File gradleWrapperProperties,
@NotNull Map<String, String> configParams) throws RunBuildException {
GradleConnector connector = GradleConnector.newConnector();
connector.forProjectDirectory(workingDirectory);
if (useWrapper) {
if (gradleWrapperProperties == null) {
throw new RunBuildException("gradle-wrapper.properties must be present in the project when Gradle Wrapper build mode selected");
}
DistributionFactoryExtension.setWrappedDistribution(connector, gradleWrapperProperties.getAbsolutePath());
} else {
if (gradleHome == null) {
throw new RunBuildException("gradleHome must be present in the project when build mode with Gradle Home selected");
}
connector.useInstallation(gradleHome);
}
return connector;
}