zulu: Fix passthru.tests

* Eliminate duplicate passthru definition by moving "tests.version"
* Only compare major version (because the ".0.0" can be truncated
* Special case major version 8 to "1.8" for the comparison
This commit is contained in:
Sean Gilligan
2025-07-02 17:08:10 -07:00
parent 9ded46560d
commit 93cc932ee6
+8 -5
View File
@@ -3,6 +3,7 @@
stdenv,
fetchurl,
setJavaClassPath,
testers,
enableJavaFX ? false,
dists,
# minimum dependencies
@@ -141,11 +142,6 @@ let
fi
'';
passthru.tests.version = testers.testVersion {
package = jdk;
command = "java -version";
version = ''openjdk version "${if lib.versions.major version == "23" then "23" else version}"'';
};
preFixup =
''
# Propagate the setJavaClassPath setup hook from the ${if isJdk8 then "JRE" else "JDK"} so that
@@ -188,6 +184,13 @@ let
})
// {
home = jdk;
tests.version = testers.testVersion {
package = jdk;
command = "java -version";
version = ''openjdk version \""${
if lib.versions.major version == "8" then "1.8" else lib.versions.major version
}"'';
};
}
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
bundle = "${jdk}/Library/Java/JavaVirtualMachines/zulu-${lib.versions.major version}.jdk";