public GradleDistribution deserializeFromString(String distributionString){
  Preconditions.checkNotNull(distributionString);
  String localInstallationPrefix="GRADLE_DISTRIBUTION(LOCAL_INSTALLATION(";
  if (distributionString.startsWith(localInstallationPrefix) && distributionString.endsWith("))")) {
    String localInstallationDir=distributionString.substring(localInstallationPrefix.length(),distributionString.length() - 2);
    return GradleDistribution.forLocalInstallation(new File(localInstallationDir));
  }
  String remoteDistributionPrefix="GRADLE_DISTRIBUTION(REMOTE_DISTRIBUTION(";
  if (distributionString.startsWith(remoteDistributionPrefix) && distributionString.endsWith("))")) {
    String remoteDistributionUri=distributionString.substring(remoteDistributionPrefix.length(),distributionString.length() - 2);
    return GradleDistribution.forRemoteDistribution(createURI(remoteDistributionUri));
  }
  String versionPrefix="GRADLE_DISTRIBUTION(VERSION(";
  if (distributionString.startsWith(versionPrefix) && distributionString.endsWith("))")) {
    String version=distributionString.substring(versionPrefix.length(),distributionString.length() - 2);
    return GradleDistribution.forVersion(version);
  }
  String wrapperString="GRADLE_DISTRIBUTION(WRAPPER)";
  if (distributionString.equals(wrapperString)) {
    return GradleDistribution.fromBuild();
  }
  String message=String.format("Cannot deserialize Gradle distribution string '%s.'",distributionString);
  throw new RuntimeException(message);
}

public GradleDistribution deserializeFromString ( String distributionString ) { Preconditions . checkNotNull ( distributionString ) ; String localInstallationPrefix = "GRADLE_DISTRIBUTION(LOCAL_INSTALLATION(" ; if ( distributionString . startsWith ( localInstallationPrefix ) && distributionString . endsWith ( "))" ) ) { String localInstallationDir = distributionString . substring ( localInstallationPrefix . length ( ) , distributionString . length ( ) - 2 ) ; return GradleDistribution . forLocalInstallation ( new File ( localInstallationDir ) ) ; } String remoteDistributionPrefix = "GRADLE_DISTRIBUTION(REMOTE_DISTRIBUTION(" ; if ( distributionString . startsWith ( remoteDistributionPrefix ) && distributionString . endsWith ( "))" ) ) { String remoteDistributionUri = distributionString . substring ( remoteDistributionPrefix . length ( ) , distributionString . length ( ) - 2 ) ; return GradleDistribution . forRemoteDistribution ( createURI ( remoteDistributionUri ) ) ; } String versionPrefix = "GRADLE_DISTRIBUTION(VERSION(" ; if ( distributionString . startsWith ( versionPrefix ) && distributionString . endsWith ( "))" ) ) { String version = distributionString . substring ( versionPrefix . length ( ) , distributionString . length ( ) - 2 ) ; return GradleDistribution . forVersion ( version ) ; } String wrapperString = "GRADLE_DISTRIBUTION(WRAPPER)" ; if ( distributionString . equals ( wrapperString ) ) { return GradleDistribution . fromBuild ( ) ; } String message = String . format ( "Cannot deserialize Gradle distribution string '%s.'" , distributionString ) ; throw new RuntimeException ( message ) ; }
deserializes the gradle distribution from the the given string representation .
