use of org.gradle.wrapper.WrapperConfiguration in project intellij-community by JetBrains.
the class GradleInstallationManager method getGradleHome.
@Nullable
private File getGradleHome(@NotNull DistributionType distributionType, @NotNull String linkedProjectPath, @Nullable String gradleHome) {
File candidate = null;
switch(distributionType) {
case LOCAL:
case WRAPPED:
if (gradleHome != null) {
candidate = new File(gradleHome);
}
break;
case DEFAULT_WRAPPED:
WrapperConfiguration wrapperConfiguration = GradleUtil.getWrapperConfiguration(linkedProjectPath);
candidate = getWrappedGradleHome(linkedProjectPath, wrapperConfiguration);
break;
case BUNDLED:
WrapperConfiguration bundledWrapperSettings = new WrapperConfiguration();
DistributionLocator distributionLocator = new DistributionLocator();
bundledWrapperSettings.setDistribution(distributionLocator.getDistributionFor(GradleVersion.current()));
candidate = getWrappedGradleHome(linkedProjectPath, bundledWrapperSettings);
break;
}
File result = null;
if (candidate != null) {
result = isGradleSdkHome(candidate) ? candidate : null;
}
if (result != null) {
return result;
}
return getAutodetectedGradleHome();
}
Aggregations