nixpkgs/pkgs/development/compilers/openjdk/jre.nix
Yueh-Shun Li 6a4cf944ef jre_minimal.tests: convert to an attribute set
Provide package tests as an attribute set instead of a list, making it
easier to build individual test cases.
2024-07-29 07:39:40 +08:00

40 lines
859 B
Nix

{ stdenv
, jdk
, lib
, callPackage
, modules ? [ "java.base" ]
}:
let
jre = stdenv.mkDerivation {
pname = "${jdk.pname}-minimal-jre";
version = jdk.version;
buildInputs = [ jdk ];
dontUnpack = true;
# Strip more heavily than the default '-S', since if you're
# using this derivation you probably care about this.
stripDebugFlags = [ "--strip-unneeded" ];
buildPhase = ''
runHook preBuild
jlink --module-path ${jdk}/lib/openjdk/jmods --add-modules ${lib.concatStringsSep "," modules} --output $out
runHook postBuild
'';
dontInstall = true;
passthru = {
home = "${jre}";
tests = {
jre_minimal-hello = callPackage ./tests/test_jre_minimal.nix {};
jre_minimal-hello-logging = callPackage ./tests/test_jre_minimal_with_logging.nix {};
};
};
};
in jre