1 { lib, stdenv, fetchurl, jre, makeWrapper }:
3 stdenv.mkDerivation rec {
4 pname = "google-java-format";
8 url = "https://github.com/google/google-java-format/releases/download/v${version}/google-java-format-${version}-all-deps.jar";
9 sha256 = "sha256-gS+AX1gRJGDt8BvyAqjmHQ/R81wNT6vVQiBkB3bsV6E=";
14 nativeBuildInputs = [ makeWrapper ];
15 buildInputs = [ jre ];
20 mkdir -p $out/{bin,share/${pname}}
21 install -D ${src} $out/share/${pname}/google-java-format-${version}-all-deps.jar
23 makeWrapper ${jre}/bin/java $out/bin/${pname} \
25 --add-flags "--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" \
26 --add-flags "--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" \
27 --add-flags "--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" \
28 --add-flags "--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" \
29 --add-flags "--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" \
30 --add-flags "-jar $out/share/${pname}/google-java-format-${version}-all-deps.jar"
36 description = "Java source formatter by Google";
38 A program that reformats Java source code to comply with Google Java Style.
40 homepage = "https://github.com/google/google-java-format";
41 sourceProvenance = with sourceTypes; [ binaryBytecode ];
42 license = licenses.asl20;
43 maintainers = [ maintainers.emptyflask ];
44 platforms = platforms.all;
45 mainProgram = "google-java-format";