Comparable<Task>
, org.gradle.api.internal.DynamicObjectAware
, org.gradle.api.internal.TaskInternal
, ExtensionAware
, Task
, org.gradle.util.Configurable<Task>
public class Wrapper extends DefaultTask
Generates scripts (for *nix and windows) which allow you to build your project with Gradle, without having to install Gradle.
When a user executes a wrapper script the first time, the script downloads and installs the appropriate Gradle distribution and runs the build against this downloaded distribution. Any installed Gradle distribution is ignored when using the wrapper scripts.
The scripts generated by this task are intended to be committed to your version control system. This task also
generates a small gradle-wrapper.jar
bootstrap JAR file and properties file which should also be committed to
your VCS. The scripts delegates to this JAR.
Modifier and Type | Class | Description |
---|---|---|
static class |
Wrapper.DistributionType |
Specifies the Gradle distribution type.
|
static class |
Wrapper.PathBase |
Specifies how the wrapper path should be interpreted.
|
Task.Namer
Modifier and Type | Field | Description |
---|---|---|
static String |
DEFAULT_DISTRIBUTION_PARENT_NAME |
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
Constructor | Description |
---|---|
Wrapper() |
Modifier and Type | Method | Description |
---|---|---|
Wrapper.PathBase |
getArchiveBase() |
The archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the
gradle user home dir.
|
String |
getArchivePath() |
Returns the path where the gradle distributions archive should be saved (i.e.
|
List<Wrapper.DistributionType> |
getAvailableDistributionTypes() |
The list of available gradle distribution types.
|
File |
getBatchScript() |
Returns the file to write the wrapper batch script to.
|
Wrapper.PathBase |
getDistributionBase() |
The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in
the gradle user home dir.
|
String |
getDistributionPath() |
Returns the path where the gradle distributions needed by the wrapper are unzipped.
|
String |
getDistributionSha256Sum() |
The SHA-256 hash sum of the gradle distribution.
|
Wrapper.DistributionType |
getDistributionType() |
Returns the type of the Gradle distribution to be used by the wrapper.
|
String |
getDistributionUrl() |
The URL to download the gradle distribution from.
|
protected org.gradle.api.internal.file.FileLookup |
getFileLookup() |
|
String |
getGradleVersion() |
Returns the gradle version for the wrapper.
|
File |
getJarFile() |
Returns the file to write the wrapper jar file to.
|
File |
getPropertiesFile() |
Returns the file to write the wrapper properties to.
|
File |
getScriptFile() |
Returns the file to write the wrapper script to.
|
void |
setArchiveBase(Wrapper.PathBase archiveBase) |
The archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the
gradle user home dir.
|
void |
setArchivePath(String archivePath) |
Set's the path where the gradle distributions archive should be saved (i.e.
|
void |
setDistributionBase(Wrapper.PathBase distributionBase) |
The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in
the gradle user home dir.
|
void |
setDistributionPath(String distributionPath) |
Sets the path where the gradle distributions needed by the wrapper are unzipped.
|
void |
setDistributionSha256Sum(String distributionSha256Sum) |
The SHA-256 hash sum of the gradle distribution.
|
void |
setDistributionType(Wrapper.DistributionType distributionType) |
The type of the Gradle distribution to be used by the wrapper.
|
void |
setDistributionUrl(String url) |
The URL to download the gradle distribution from.
|
void |
setGradleVersion(String gradleVersion) |
The version of the gradle distribution required by the wrapper.
|
void |
setJarFile(File jarFile) |
The file to write the wrapper jar file to.
|
void |
setJarFile(Object jarFile) |
The file to write the wrapper jar file to.
|
void |
setScriptFile(File scriptFile) |
The file to write the wrapper script to.
|
void |
setScriptFile(Object scriptFile) |
The file to write the wrapper script to.
|
newInputDirectory, newInputFile, newOutputDirectory, newOutputFile
appendParallelSafeAction, compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTaskIdentity, getTemporaryDir, getTemporaryDirFactory, getTimeout, hasProperty, hasTaskActions, injectIntoNewInstance, isEnabled, isHasCustomActions, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, replaceLogger, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, toString
public static final String DEFAULT_DISTRIBUTION_PARENT_NAME
@Inject protected org.gradle.api.internal.file.FileLookup getFileLookup()
@OutputFile public File getScriptFile()
public void setScriptFile(File scriptFile)
public void setScriptFile(Object scriptFile)
@OutputFile public File getBatchScript()
@OutputFile public File getJarFile()
public void setJarFile(File jarFile)
public void setJarFile(Object jarFile)
@OutputFile public File getPropertiesFile()
@Input public String getDistributionPath()
setDistributionPath(String)
public void setDistributionPath(String distributionPath)
setDistributionPath(String)
@Input public String getGradleVersion()
setGradleVersion(String)
public void setGradleVersion(String gradleVersion)
@Input public Wrapper.DistributionType getDistributionType()
setDistributionType(DistributionType)
public void setDistributionType(Wrapper.DistributionType distributionType)
Wrapper.DistributionType.BIN
,
which is the binary-only Gradle distribution without documentation.Wrapper.DistributionType
public List<Wrapper.DistributionType> getAvailableDistributionTypes()
@Input public String getDistributionUrl()
If not set, the download URL is the default for the specified getGradleVersion()
.
If getGradleVersion()
is not set, will return null.
The wrapper downloads a certain distribution only once and caches it. If your distribution base is the project, you might submit the distribution to your version control system. That way no download is necessary at all. This might be in particular interesting, if you provide a custom gradle snapshot to the wrapper, because you don't need to provide a download server then.
public void setDistributionUrl(String url)
If not set, the download URL is the default for the specified getGradleVersion()
.
If getGradleVersion()
is not set, will return null.
The wrapper downloads a certain distribution and caches it. If your distribution base is the project, you might submit the distribution to your version control system. That way no download is necessary at all. This might be in particular interesting, if you provide a custom gradle snapshot to the wrapper, because you don't need to provide a download server then.
@Incubating @Nullable @Optional @Input public String getDistributionSha256Sum()
If not set, the hash sum of the gradle distribution is not verified.
The wrapper allows for verification of the downloaded Gradle distribution via SHA-256 hash sum comparison. This increases security against targeted attacks by preventing a man-in-the-middle attacker from tampering with the downloaded Gradle distribution.
@Incubating public void setDistributionSha256Sum(@Nullable String distributionSha256Sum)
If not set, the hash sum of the gradle distribution is not verified.
The wrapper allows for verification of the downloaded Gradle distribution via SHA-256 hash sum comparison. This increases security against targeted attacks by preventing a man-in-the-middle attacker from tampering with the downloaded Gradle distribution.
@Input public Wrapper.PathBase getDistributionBase()
public void setDistributionBase(Wrapper.PathBase distributionBase)
@Input public String getArchivePath()
public void setArchivePath(String archivePath)
getArchiveBase()
.@Input public Wrapper.PathBase getArchiveBase()
public void setArchiveBase(Wrapper.PathBase archiveBase)