From a81011bcc19db1982c28ae207fbc48ec68bcdea8 Mon Sep 17 00:00:00 2001 From: Olli Helenius Date: Sun, 24 Nov 2024 13:14:18 +0200 Subject: [PATCH] gradle: add udev to the JNA library path Running `gradle build --scan` results in this warning: Did not find udev library in operating system. Some features may not work. The udev library is looked up using JNA, which searches `jna.library.path` in addition to the standard locations. Adding `udev` to the lookup path in the wrapper ensures that Gradle can find the library. Fixes: #358166. --- pkgs/development/tools/build-managers/gradle/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/tools/build-managers/gradle/default.nix b/pkgs/development/tools/build-managers/gradle/default.nix index 5f34894e8dc37..80724fff7b789 100644 --- a/pkgs/development/tools/build-managers/gradle/default.nix +++ b/pkgs/development/tools/build-managers/gradle/default.nix @@ -37,6 +37,7 @@ rec { , unzip , ncurses5 , ncurses6 + , udev , testers , runCommand , writeText @@ -91,6 +92,7 @@ rec { }; varDefs = concatStringsSep "\n" (map (x: " --set ${x} \\") ([ "JAVA_HOME ${java}" ] ++ toolchain.varDefs)); + jnaLibraryPath = lib.makeLibraryPath [ udev ]; in '' mkdir -pv $out/lib/gradle/ cp -rv lib/ $out/lib/gradle/ @@ -99,6 +101,7 @@ rec { test -f $gradle_launcher_jar makeWrapper ${java}/bin/java $out/bin/gradle \ ${varDefs} + --add-flags "-Djna.library.path=${jnaLibraryPath}" \ --add-flags "-classpath $gradle_launcher_jar org.gradle.launcher.GradleMain${toolchain.property}" ''; @@ -129,6 +132,7 @@ rec { # Gradle will refuse to start without _both_ 5 and 6 versions of ncurses. echo ${ncurses5} >> $out/nix-support/manual-runtime-dependencies echo ${ncurses6} >> $out/nix-support/manual-runtime-dependencies + echo ${udev} >> $out/nix-support/manual-runtime-dependencies ''; passthru.tests = {