From 27baadb387b4d41c23114ba93adf12d0ab290d4e Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 13 Dec 2024 16:36:44 +0530 Subject: [PATCH] gradle: add support for the new file-events library format --- .../tools/build-managers/gradle/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/build-managers/gradle/default.nix b/pkgs/development/tools/build-managers/gradle/default.nix index a9657122a7e2b..0cc99fbd2a367 100644 --- a/pkgs/development/tools/build-managers/gradle/default.nix +++ b/pkgs/development/tools/build-managers/gradle/default.nix @@ -115,6 +115,7 @@ rec { fixupPhase = let arch = if stdenv.hostPlatform.is64bit then "amd64" else "i386"; + newFileEvents = toString (lib.versionAtLeast version "8.12"); in '' . ${./patching.sh} @@ -134,10 +135,17 @@ rec { # The file-events library _seems_ to follow the native-platform version, but # we won’t assume that. - fileEventsVersion="$(extractVersion file-events $out/lib/gradle/lib/file-events-*.jar)" - autoPatchelfInJar \ - $out/lib/gradle/lib/file-events-linux-${arch}-''${fileEventsVersion}.jar \ - "${lib.getLib stdenv.cc.cc}/lib64:${lib.makeLibraryPath [ stdenv.cc.cc ]}" + if [ -n "${newFileEvents}" ]; then + fileEventsVersion="$(extractVersion gradle-fileevents $out/lib/gradle/lib/gradle-fileevents-*.jar)" + autoPatchelfInJar \ + $out/lib/gradle/lib/gradle-fileevents-''${fileEventsVersion}.jar \ + "${lib.getLib stdenv.cc.cc}/lib64:${lib.makeLibraryPath [ stdenv.cc.cc ]}" + else + fileEventsVersion="$(extractVersion file-events $out/lib/gradle/lib/file-events-*.jar)" + autoPatchelfInJar \ + $out/lib/gradle/lib/file-events-linux-${arch}-''${fileEventsVersion}.jar \ + "${lib.getLib stdenv.cc.cc}/lib64:${lib.makeLibraryPath [ stdenv.cc.cc ]}" + fi # The scanner doesn't pick up the runtime dependency in the jar. # Manually add a reference where it will be found.