Module: Dependabot::Gradle::FileUpdater::Wrapper::GradleVersionCapabilities

Extended by:
T::Sig
Defined in:
lib/dependabot/gradle/file_updater/wrapper/gradle_version_capabilities.rb

Overview

Declarative table of ‘wrapper` task command-line options and the minimum Gradle version that supports each one. The wrapper task is executed by the Gradle version currently resolved by the project (not the target version), so passing an option that the executing Gradle does not understand would abort the run. We use this table to only emit options that are safe for the executing version.

Sources (gradle/gradle ‘Wrapper.java`):

--network-timeout       @since 7.6
--validate-url          @since 8.2  (incubating)
--retries               @since 9.5.0 (incubating)
--retry-back-off-ms     @since 9.5.0 (incubating)

Constant Summary collapse

NETWORK_TIMEOUT =
"network-timeout"
VALIDATE_URL =
"validate-url"
RETRIES =
"retries"
RETRY_BACK_OFF_MS =
"retry-back-off-ms"
MINIMUM_VERSIONS =
T.let(
  {
    NETWORK_TIMEOUT => "7.6",
    VALIDATE_URL => "8.2",
    RETRIES => "9.5.0",
    RETRY_BACK_OFF_MS => "9.5.0"
  }.freeze,
  T::Hash[String, String]
)

Class Method Summary collapse

Class Method Details

.supports?(option, gradle_version) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
50
51
52
53
54
# File 'lib/dependabot/gradle/file_updater/wrapper/gradle_version_capabilities.rb', line 47

def self.supports?(option, gradle_version)
  minimum = MINIMUM_VERSIONS[option]
  return true if minimum.nil? # ungated option

  return false if gradle_version.nil?

  gradle_version >= Dependabot::Gradle::Version.new(minimum)
end