2021-10-01 09:20:50 +00:00
|
|
|
{ lib, stdenv, fetchurl, jre, makeWrapper }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "google-java-format";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.22.0";
|
2021-10-01 09:20:50 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/google/google-java-format/releases/download/v${version}/google-java-format-${version}-all-deps.jar";
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-FrKh7pOGhsix2Iq/GeuD39DWI87p3m/G0JmAIU+BbT8=";
|
2021-10-01 09:20:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ jre ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/{bin,share/${pname}}
|
|
|
|
install -D ${src} $out/share/${pname}/google-java-format-${version}-all-deps.jar
|
|
|
|
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/${pname} \
|
|
|
|
--argv0 ${pname} \
|
|
|
|
--add-flags "--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" \
|
|
|
|
--add-flags "--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" \
|
|
|
|
--add-flags "--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" \
|
|
|
|
--add-flags "--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" \
|
|
|
|
--add-flags "--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" \
|
|
|
|
--add-flags "-jar $out/share/${pname}/google-java-format-${version}-all-deps.jar"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Java source formatter by Google";
|
|
|
|
longDescription = ''
|
|
|
|
A program that reformats Java source code to comply with Google Java Style.
|
|
|
|
'';
|
|
|
|
homepage = "https://github.com/google/google-java-format";
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2021-10-01 09:20:50 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.emptyflask ];
|
|
|
|
platforms = platforms.all;
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "google-java-format";
|
2021-10-01 09:20:50 +00:00
|
|
|
};
|
|
|
|
}
|