Common functionality to be able to download a SDK and use it within Gradle
Type | Name and description |
---|---|
static java.lang.String |
INSTALLER_VERSION |
static boolean |
IS_WINDOWS |
Constructor and description |
---|
protected AbstractDistributionInstaller
(java.lang.String distributionName, java.lang.String distributionVersion, java.lang.String basePath, org.gradle.api.Project project) Creates setup for installing to a local cache. |
Type | Name and description |
---|---|
void |
addExecPattern(java.lang.String... relPaths) Add patterns for files to be marked executable, |
protected java.io.File |
getAndVerifyDistributionRoot(java.io.File distDir, java.lang.String distributionDescription) Validates that the unpacked distirbution is good. |
java.io.File |
getDistributionRoot() Returns the location which is the top or home folder for a distribution. |
protected ProgressLogger |
getLogger() Returns the logger currently in use. |
protected org.gradle.api.Project |
getProject() Returns the attached project |
protected java.util.List<java.io.File> |
listDirs(java.io.File distDir) Provides a list of directories below an unpacked distribution |
java.io.File |
locateDistributionInCustomLocation(java.lang.String version) Override this method to provide alternative means to look for distributions. |
void |
setChecksum(java.lang.String cs) Set a checksum that needs to be verified against downloaded archive |
void |
setDownloadRoot(java.io.File downloadRootDir) Sets a download root directory for the distribution. |
void |
setSdkManCandidateName(java.lang.String sdkCandidateName) Set candidate name for SdkMan if the latter should be searched for installed versions |
protected void |
unpack(java.io.File srcArchive, java.io.File destDir) Unpacks a downloaded archive. |
java.net.URI |
uriFromVersion(java.lang.String version) Creates a download URI from a given distribution version |
protected void |
verifyDownloadChecksum(java.lang.String sourceUrl, java.io.File localCompressedFile, java.lang.String expectedSum) Verifies the checksum (if provided) of a newly downloaded distribution archive. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Creates setup for installing to a local cache.
distributionName
- Descriptive name of the distributiondistributionVersion
- Version of the distribution to obtainbasePath
- Relative path below Gradle User Home to create cache for all version of this distribution type.project
- Gradle project that this downloader is attached to.Add patterns for files to be marked executable, Calling this method multiple times simply appends for patterns
relPaths
- One or more ANT-stype include patternsValidates that the unpacked distirbution is good. The default implementation simply checks that only one directory should exist.
distDir
.distDir
- Directory where distribution was unpacked to.distributionDescription
- A descriptive name of the distributionReturns the location which is the top or home folder for a distribution. This value is affected by setDownloadRoot(java.io.File) and the parameters passed in during construction time.
Returns the logger currently in use.
Returns the attached project
Provides a list of directories below an unpacked distribution
distDir
- Unpacked distribution directoryOverride this method to provide alternative means to look for distributions.
Set a checksum that needs to be verified against downloaded archive
cs
- SHA-256 Hex-encoded checksumSets a download root directory for the distribution. If not supplied the default is to use the Gradle User Home. This method is provided for convenience and is mostly only used for testing purposes. The fodler will be created at download time if it does not exist.
downloadRootDir
- Any writeable directory on the filesystem.Set candidate name for SdkMan if the latter should be searched for installed versions
sdkCandidateName
- SDK Candidate name. This is the same names that will be shown when
running sdk list candidates
on the command-line.Unpacks a downloaded archive. The default implementation supports
srcArchive
- The location of the download archivedestDir
- The directory where the archive needs to be unpacked intoCreates a download URI from a given distribution version
version
- Version of the distribution to downloadVerifies the checksum (if provided) of a newly downloaded distribution archive.
sourceUrl
- The URL/URI where it was downloaded fromlocalCompressedFile
- The location of the downloaded archiveexpectedSum
- The expected checksum. Can be null in which case no checks will be performed.Groovy Documentation