From 773ee7e8804b2aec1e2e4b300fb620c57d6bf2c7 Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Mon, 30 Mar 2026 09:23:51 +0200 Subject: [PATCH] gradle: configure updateScript per major version Previously the regex for updating Gradle matched any major version, resulting in version bumps like #504857 where gradle_8 was updated to 9.4.1. After this change, the version regexp is tagged to a specific major version. That way gradle_8 is only updated to versions that start with '8'. At the same time version updates are enabled for gradle_9 if they start with '9'. Last but not least, `nix-update-script` is now called with `--use-github-releases` because without it the updater defaults to using GitHub's releases Atom feed, and just returns the most recent releases, causing the gradle_8 update to fail because no matching release version could be found. --- .../tools/build-managers/gradle/default.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/development/tools/build-managers/gradle/default.nix b/pkgs/development/tools/build-managers/gradle/default.nix index 1d6b9f25ddac..af1b7dcb6848 100644 --- a/pkgs/development/tools/build-managers/gradle/default.nix +++ b/pkgs/development/tools/build-managers/gradle/default.nix @@ -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" # Gradle’s .0 releases are tagged as `vX.Y.0`, but the actual # release version omits the `.0`, so we’ll 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";