From bbc03fb6efaa3af0cc2694afd3b7cc124edb3715 Mon Sep 17 00:00:00 2001 From: Petr Portnov Date: Wed, 2 Apr 2025 02:54:52 +0300 Subject: [PATCH] checkstyle: build from sources --- pkgs/by-name/ch/checkstyle/package.nix | 44 ++++++++++++++++++-------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/ch/checkstyle/package.nix b/pkgs/by-name/ch/checkstyle/package.nix index 50147c9caf1e..a9aebdb4fa34 100644 --- a/pkgs/by-name/ch/checkstyle/package.nix +++ b/pkgs/by-name/ch/checkstyle/package.nix @@ -1,30 +1,40 @@ { lib, - stdenvNoCC, - fetchurl, + fetchFromGitHub, makeBinaryWrapper, jre, + maven, }: -stdenvNoCC.mkDerivation rec { +maven.buildMavenPackage rec { version = "13.2.0"; pname = "checkstyle"; - src = fetchurl { - url = "https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${version}/checkstyle-${version}-all.jar"; - sha256 = "sha256-rAPNT/zbMXX1s4upQlZD6QnNFliNPlVBzbUjxcTL3PU="; + src = fetchFromGitHub { + owner = "checkstyle"; + repo = "checkstyle"; + tag = "checkstyle-${version}"; + hash = "sha256-f9jJK9zp7sm8VEn30qQA73+ynARJWY3BxbSMEppEDlk="; }; - nativeBuildInputs = [ makeBinaryWrapper ]; - buildInputs = [ jre ]; + mvnHash = "sha256-+l3ubVFWx1QVTSgwVv0yGVyh8RPnxyHBU/vKE4sBRoE="; - dontUnpack = true; + nativeBuildInputs = [ + maven + makeBinaryWrapper + ]; + + mvnParameters = lib.escapeShellArgs [ "-Passembly,no-validations" ]; installPhase = '' runHook preInstall - install -D $src $out/checkstyle/checkstyle-all.jar + + mkdir -p $out/bin $out/share/checkstyle + install -Dm644 target/checkstyle-${version}-all.jar $out/share/checkstyle/checkstyle-all.jar + makeWrapper ${jre}/bin/java $out/bin/checkstyle \ - --add-flags "-jar $out/checkstyle/checkstyle-all.jar" + --add-flags "-jar $out/share/checkstyle/checkstyle-all.jar" + runHook postInstall ''; @@ -38,9 +48,15 @@ stdenvNoCC.mkDerivation rec { ''; homepage = "https://checkstyle.org/"; changelog = "https://checkstyle.org/releasenotes.html#Release_${version}"; - sourceProvenance = with lib.sourceTypes; [ binaryBytecode ]; + sourceProvenance = with lib.sourceTypes; [ + fromSource + binaryBytecode + ]; license = lib.licenses.lgpl21; - maintainers = with lib.maintainers; [ pSub ]; - platforms = jre.meta.platforms; + maintainers = with lib.maintainers; [ + pSub + progrm_jarvis + ]; + inherit (jre.meta) platforms; }; }