public ClassPath getToolingImplementationClasspath(
     ProgressLoggerFactory progressLoggerFactory, File userHomeDir) {
   if (installedDistribution == null) {
     File installDir;
     try {
       File realUserHomeDir =
           userHomeDir != null
               ? userHomeDir
               : myUserHomeDir != null ? myUserHomeDir : GradleUserHomeLookup.gradleUserHome();
       Install install =
           new Install(
               new ProgressReportingDownload(progressLoggerFactory),
               new PathAssembler(realUserHomeDir));
       installDir = install.createDist(wrapperConfiguration);
     } catch (FileNotFoundException e) {
       throw new IllegalArgumentException(
           String.format("The specified %s does not exist.", getDisplayName()), e);
     } catch (Exception e) {
       throw new GradleConnectionException(
           String.format(
               "Could not install Gradle distribution from '%s'.",
               wrapperConfiguration.getDistribution()),
           e);
     }
     installedDistribution =
         new InstalledDistribution(installDir, getDisplayName(), getDisplayName());
   }
   return installedDistribution.getToolingImplementationClasspath(
       progressLoggerFactory, userHomeDir);
 }
 public Set<File> getToolingImplementationClasspath() {
   if (installedDistribution == null) {
     File installDir;
     try {
       Install install =
           new Install(
               false,
               false,
               new ProgressReportingDownload(progressLoggerFactory),
               new PathAssembler(userHomeDir));
       installDir =
           install.createDist(
               gradleDistribution,
               PathAssembler.GRADLE_USER_HOME_STRING,
               org.gradle.api.tasks.wrapper.Wrapper.DEFAULT_DISTRIBUTION_PARENT_NAME,
               PathAssembler.GRADLE_USER_HOME_STRING,
               org.gradle.api.tasks.wrapper.Wrapper.DEFAULT_DISTRIBUTION_PARENT_NAME);
     } catch (FileNotFoundException e) {
       throw new IllegalArgumentException(
           String.format("The specified %s does not exist.", getDisplayName()), e);
     } catch (Exception e) {
       throw new GradleConnectionException(
           String.format("Could not install Gradle distribution from '%s'.", gradleDistribution),
           e);
     }
     installedDistribution =
         new InstalledDistribution(installDir, getDisplayName(), getDisplayName());
   }
   return installedDistribution.getToolingImplementationClasspath();
 }