1{
2 lib,
3 stdenvNoCC,
4 fetchurl,
5 makeBinaryWrapper,
6 jre,
7}:
8
9stdenvNoCC.mkDerivation rec {
10 version = "10.25.1";
11 pname = "checkstyle";
12
13 src = fetchurl {
14 url = "https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${version}/checkstyle-${version}-all.jar";
15 sha256 = "sha256-dRihSzEcq/IEBwrvrXoYfx13PHhdzPt7ldv0EuU1RiE=";
16 };
17
18 nativeBuildInputs = [ makeBinaryWrapper ];
19 buildInputs = [ jre ];
20
21 dontUnpack = true;
22
23 installPhase = ''
24 runHook preInstall
25 install -D $src $out/checkstyle/checkstyle-all.jar
26 makeWrapper ${jre}/bin/java $out/bin/checkstyle \
27 --add-flags "-jar $out/checkstyle/checkstyle-all.jar"
28 runHook postInstall
29 '';
30
31 meta = {
32 description = "Checks Java source against a coding standard";
33 mainProgram = "checkstyle";
34 longDescription = ''
35 checkstyle is a development tool to help programmers write Java code that
36 adheres to a coding standard. By default it supports the Sun Code
37 Conventions, but is highly configurable.
38 '';
39 homepage = "https://checkstyle.org/";
40 changelog = "https://checkstyle.org/releasenotes.html#Release_${version}";
41 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
42 license = lib.licenses.lgpl21;
43 maintainers = with lib.maintainers; [ pSub ];
44 platforms = jre.meta.platforms;
45 };
46}