Merge pull request #278534 from TomaSajt/jdepend

jdepend: make deterministic and clean up
This commit is contained in:
Weijia Wang 2024-01-11 20:34:27 +01:00 committed by GitHub
commit 52dd8f87a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,35 +1,58 @@
{ lib, stdenv, fetchFromGitHub, ant, jdk, runtimeShell }:
{ lib
, stdenv
, fetchFromGitHub
, ant
, jdk
, makeWrapper
, canonicalize-jars-hook
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "jdepend";
version = "2.10";
src = fetchFromGitHub {
owner = "clarkware";
repo = "jdepend";
rev = version;
sha256 = "1lxf3j9vflky7a2py3i59q7cwd1zvjv2b88l3za39vc90s04dz6k";
rev = finalAttrs.version;
hash = "sha256-0/xGgAaJ7TTUHxShJbbcPzTODk4lDn+FOn5St5McrtM=";
};
nativeBuildInputs = [ ant jdk ];
buildPhase = "ant jar";
nativeBuildInputs = [
ant
jdk
makeWrapper
canonicalize-jars-hook
];
buildPhase = ''
runHook preBuild
ant jar
runHook postBuild
'';
installPhase = ''
mkdir -p $out/bin $out/share
install dist/${pname}-${version}.jar $out/share
runHook preInstall
cat > "$out/bin/jdepend" <<EOF
#!${runtimeShell}
exec ${jdk.jre}/bin/java -classpath "$out/share/*" "\$@"
EOF
chmod a+x $out/bin/jdepend
install -Dm644 dist/jdepend-*.jar -t $out/share/jdepend
makeWrapper ${jdk.jre}/bin/java $out/bin/jdepend \
--add-flags "-classpath $out/share/jdepend/jdepend-*.jar"
for type in "swingui" "textui" "xmlui"; do
makeWrapper $out/bin/jdepend $out/bin/jdepend-$type \
--add-flags "jdepend.$type.JDepend"
done
runHook postInstall
'';
meta = with lib; {
changelog = "https://github.com/clarkware/jdepend/blob/${finalAttrs.src.rev}/CHANGELOG.md";
description = "Traverses Java class file directories and generates design quality metrics for each Java package";
homepage = "http://www.clarkware.com/software/JDepend.html";
license = licenses.bsd3;
platforms = platforms.linux;
maintainers = with maintainers; [ pSub ];
platforms = platforms.linux;
};
}
})