Unverified Commit 773ee7e8 authored by Benedikt Ritter's avatar Benedikt Ritter
Browse files

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.
parent 218caa0c
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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";