2022-04-27 09:35:20 +00:00
|
|
|
{ lib, stdenv, jre, coursier, makeWrapper, installShellFiles, setJavaClassPath }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
baseName = "scalafix";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "0.10.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
deps = stdenv.mkDerivation {
|
|
|
|
name = "${baseName}-deps-${version}";
|
|
|
|
buildCommand = ''
|
|
|
|
export COURSIER_CACHE=$(pwd)
|
2022-04-27 09:35:20 +00:00
|
|
|
${coursier}/bin/cs fetch ch.epfl.scala:scalafix-cli_2.13.8:${version} > deps
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/share/java
|
|
|
|
cp $(< deps) $out/share/java/
|
|
|
|
'';
|
|
|
|
outputHashMode = "recursive";
|
2022-04-27 09:35:20 +00:00
|
|
|
outputHash = "sha256-lDeg90L484MggtQ2a9OyHv4UcfLPjzG3OJZCaWW2AC8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2021-08-05 21:33:18 +00:00
|
|
|
pname = baseName;
|
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles setJavaClassPath ];
|
|
|
|
buildInputs = [ deps ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
dontUnpack = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/${baseName} \
|
|
|
|
--add-flags "-cp $CLASSPATH scalafix.cli.Cli"
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
installShellCompletion --cmd ${baseName} \
|
|
|
|
--bash <($out/bin/${baseName} --bash) \
|
|
|
|
--zsh <($out/bin/${baseName} --zsh)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
installCheckPhase = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
$out/bin/${baseName} --version | grep -q "${version}"
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Refactoring and linting tool for Scala";
|
|
|
|
homepage = "https://scalacenter.github.io/scalafix/";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = [ maintainers.tomahna ];
|
|
|
|
};
|
|
|
|
}
|