Class WrapperNeo

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.glavo.gradle.wrapper.neo.plugin.WrapperNeo
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@DisableCachingByDefault(because="Generates project wrapper files and may resolve checksums from the network.") public abstract class WrapperNeo extends org.gradle.api.DefaultTask
Generates the Gradle Wrapper Neo launchers, Java source, and standard Wrapper properties.

The generated files use the conventional project layout. Distribution and archive settings are exposed as Gradle properties so builds can configure the generated Wrapper.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The Gradle distribution variant used when the distribution URL is derived from a version.
    static enum 
    The base directory used for distribution and archive paths.

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
    WrapperNeo(org.gradle.api.file.ProjectLayout layout)
    Creates the task and configures its conventional output locations and Wrapper defaults.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Sets getDistributionSha256Sum() from the checksum task option.
    void
    Sets getDistributionType() from the --distribution-type task option.
    void
    Sets getDistributionUrl() from the --gradle-distribution-url task option.
    void
    Sets getGradleVersion() from the --gradle-version task option.
    void
    Sets getNetworkTimeout() from the --network-timeout task option.
    void
    Writes the launchers, source file, and Wrapper properties using the configured values.
    abstract org.gradle.api.provider.Property<WrapperNeo.PathBase>
    Returns the base directory for downloaded distribution archives.
    abstract org.gradle.api.provider.Property<String>
    Returns the path below getArchiveBase() used for downloaded archives.
    abstract org.gradle.api.provider.Property<WrapperNeo.PathBase>
    Returns the base directory for the installed Gradle distribution.
    abstract org.gradle.api.provider.Property<String>
    Returns the path below getDistributionBase() used for installed distributions.
    abstract org.gradle.api.provider.Property<String>
    Returns the optional SHA-256 checksum written to the generated Wrapper properties.
    abstract org.gradle.api.provider.Property<WrapperNeo.DistributionType>
    Returns the distribution variant.
    abstract org.gradle.api.provider.Property<String>
    Returns the optional complete distribution URL, which overrides the version and distribution type.
    abstract org.gradle.api.provider.Property<Boolean>
    Returns whether a missing checksum is downloaded from the distribution URL with a .sha256 suffix.
    abstract org.gradle.api.provider.Property<String>
    Returns the Gradle version selector used to derive the distribution URL.
    abstract org.gradle.api.file.RegularFileProperty
    Returns the legacy Wrapper JAR removed when getRemoveLegacyWrapperJar() is enabled.
    abstract org.gradle.api.provider.Property<Integer>
    Returns the connection and read timeout in milliseconds.
    abstract org.gradle.api.provider.Property<Boolean>
    Returns whether generation removes the legacy gradle-wrapper.jar.
    abstract org.gradle.api.provider.Property<Integer>
    Returns the number of additional distribution download attempts made by the generated Wrapper.
    abstract org.gradle.api.provider.Property<Integer>
    Returns the initial delay in milliseconds between distribution download attempts.

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • WrapperNeo

      @Inject public WrapperNeo(org.gradle.api.file.ProjectLayout layout)
      Creates the task and configures its conventional output locations and Wrapper defaults.
      Parameters:
      layout - the target project layout
  • Method Details

    • getGradleVersion

      @Input public abstract org.gradle.api.provider.Property<String> getGradleVersion()
      Returns the Gradle version selector used to derive the distribution URL.

      Complete versions, the dynamic labels supported by the standard Wrapper task, and Gradle 9 or later major/minor selectors are accepted. The value defaults to the current Gradle version.

      Returns:
      the configurable Gradle version selector
    • getDistributionType

      @Input public abstract org.gradle.api.provider.Property<WrapperNeo.DistributionType> getDistributionType()
      Returns the distribution variant. Defaults to WrapperNeo.DistributionType.BIN.
      Returns:
      the configurable distribution variant
    • getDistributionUrl

      @Optional @Input public abstract org.gradle.api.provider.Property<String> getDistributionUrl()
      Returns the optional complete distribution URL, which overrides the version and distribution type.
      Returns:
      the configurable distribution URL
    • getDistributionSha256Sum

      @Optional @Input public abstract org.gradle.api.provider.Property<String> getDistributionSha256Sum()
      Returns the optional SHA-256 checksum written to the generated Wrapper properties.
      Returns:
      the configurable distribution checksum
    • getDownloadDistributionSha256Sum

      @Input public abstract org.gradle.api.provider.Property<Boolean> getDownloadDistributionSha256Sum()
      Returns whether a missing checksum is downloaded from the distribution URL with a .sha256 suffix.
      Returns:
      the configurable checksum download flag
    • getDistributionBase

      @Input public abstract org.gradle.api.provider.Property<WrapperNeo.PathBase> getDistributionBase()
      Returns the base directory for the installed Gradle distribution.
      Returns:
      the configurable distribution base
    • getDistributionPath

      @Input public abstract org.gradle.api.provider.Property<String> getDistributionPath()
      Returns the path below getDistributionBase() used for installed distributions.
      Returns:
      the configurable distribution path
    • getArchiveBase

      @Input public abstract org.gradle.api.provider.Property<WrapperNeo.PathBase> getArchiveBase()
      Returns the base directory for downloaded distribution archives.
      Returns:
      the configurable archive base
    • getArchivePath

      @Input public abstract org.gradle.api.provider.Property<String> getArchivePath()
      Returns the path below getArchiveBase() used for downloaded archives.
      Returns:
      the configurable archive path
    • getNetworkTimeout

      @Input public abstract org.gradle.api.provider.Property<Integer> getNetworkTimeout()
      Returns the connection and read timeout in milliseconds. Defaults to 10000.
      Returns:
      the configurable network timeout
    • getRetries

      @Input public abstract org.gradle.api.provider.Property<Integer> getRetries()
      Returns the number of additional distribution download attempts made by the generated Wrapper.
      Returns:
      the configurable retry count
    • getRetryBackOffMs

      @Input public abstract org.gradle.api.provider.Property<Integer> getRetryBackOffMs()
      Returns the initial delay in milliseconds between distribution download attempts.
      Returns:
      the configurable retry backoff
    • getRemoveLegacyWrapperJar

      @Input public abstract org.gradle.api.provider.Property<Boolean> getRemoveLegacyWrapperJar()
      Returns whether generation removes the legacy gradle-wrapper.jar. Defaults to true.
      Returns:
      the configurable legacy JAR removal flag
    • getLegacyWrapperJar

      @Internal public abstract org.gradle.api.file.RegularFileProperty getLegacyWrapperJar()
      Returns the legacy Wrapper JAR removed when getRemoveLegacyWrapperJar() is enabled.
      Returns:
      the internal legacy Wrapper JAR location
    • configureGradleVersion

      public void configureGradleVersion(String value)
      Sets getGradleVersion() from the --gradle-version task option.
      Parameters:
      value - the Gradle version
    • configureDistributionType

      public void configureDistributionType(String value)
      Sets getDistributionType() from the --distribution-type task option.
      Parameters:
      value - bin or all
    • configureDistributionUrl

      public void configureDistributionUrl(String value)
      Sets getDistributionUrl() from the --gradle-distribution-url task option.
      Parameters:
      value - the complete distribution URL
    • configureDistributionSha256Sum

      public void configureDistributionSha256Sum(String value)
      Sets getDistributionSha256Sum() from the checksum task option.
      Parameters:
      value - the 64-character hexadecimal SHA-256 checksum
    • configureNetworkTimeout

      public void configureNetworkTimeout(String value)
      Sets getNetworkTimeout() from the --network-timeout task option.
      Parameters:
      value - the timeout in milliseconds
    • generate

      public void generate() throws IOException
      Writes the launchers, source file, and Wrapper properties using the configured values.
      Throws:
      IOException - if a generated file or checksum response cannot be read or written