mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 19:33:03 +00:00
3b6bc4b69c
these are the easily identifiable cases and will not be comprehensive
47 lines
1.6 KiB
Nix
47 lines
1.6 KiB
Nix
{ lib, stdenv, fetchurl, jre, makeWrapper }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "google-java-format";
|
|
version = "1.15.0";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/google/google-java-format/releases/download/v${version}/google-java-format-${version}-all-deps.jar";
|
|
sha256 = "sha256-o1a7AjaynFejq2ePF6ewJ6rWA7CWDBg6GPH+Mi5POOo=";
|
|
};
|
|
|
|
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";
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
|
license = licenses.asl20;
|
|
maintainers = [ maintainers.emptyflask ];
|
|
platforms = platforms.all;
|
|
};
|
|
}
|