Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle: add support for the new file events library #364871

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions pkgs/development/tools/build-managers/gradle/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ jdk11, jdk17, jdk21 }:
{ jdk17, jdk21 }:

rec {
gen =
Expand Down Expand Up @@ -104,7 +104,9 @@ rec {

dontFixup = !stdenv.hostPlatform.isLinux;

fixupPhase = let arch = if stdenv.hostPlatform.is64bit then "amd64" else "i386";
fixupPhase = let
arch = if stdenv.hostPlatform.is64bit then "amd64" else "i386";
newFileEvents = toString (lib.versionAtLeast version "8.12");
in ''
. ${./patching.sh}

Expand All @@ -117,10 +119,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.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8182,7 +8182,7 @@ with pkgs;

gnumake = callPackage ../development/tools/build-managers/gnumake { };
gradle-packages = import ../development/tools/build-managers/gradle {
inherit jdk11 jdk17 jdk21;
inherit jdk17 jdk21;
};
gradleGen = gradle-packages.gen;
wrapGradle = callPackage gradle-packages.wrapGradle { };
Expand Down
Loading