gradle: configure updateScript per major version (#504920)

This commit is contained in:
Arne Keller
2026-03-30 09:11:14 +00:00
committed by GitHub
@@ -119,7 +119,7 @@ let
# Put the update script in passthru. Should only be on a single attrpath
# so that nixpkgs-update doesn't create duplicate PRs.
enableUpdateScript ? false,
updateScriptMajorVersion ? null,
}@genArgs:
{
@@ -305,14 +305,15 @@ let
gradle-unwrapped = mkGradle genArgs;
};
passthru.updateScript =
if enableUpdateScript then
if updateScriptMajorVersion != null then
nix-update-script {
extraArgs = [
"--url=https://github.com/gradle/gradle"
"--use-github-releases"
# Gradles .0 releases are tagged as `vX.Y.0`, but the actual
# release version omits the `.0`, so well wanto to only capture
# the version up but not including the the trailing `.0`.
"--version-regex=^v(\\d+\\.\\d+(?:\\.[1-9]\\d?)?)(\\.0)?$"
"--version-regex=^v(${updateScriptMajorVersion}\\.\\d+(?:\\.[1-9]\\d?)?)(\\.0)?$"
];
}
else
@@ -367,13 +368,13 @@ rec {
version = "9.4.0";
hash = "sha256-YOpyM1bYEmPoAC/sD8+eKw7uDAhQx6PXqwpj8szGAfM=";
defaultJava = jdk21;
updateScriptMajorVersion = "9";
};
gradle_8 = mkGradle {
version = "8.14.4";
hash = "sha256-8XcSmKcPbbWina9iN4xOGKF/wzybprFDYuDN9AYQOA0=";
defaultJava = jdk21;
# Only enable this on *one* version to avoid duplicate PRs.
enableUpdateScript = true;
updateScriptMajorVersion = "8";
};
gradle_7 = mkGradle {
version = "7.6.6";