2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, jdk, jre, coursier, makeWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
baseName = "scalafix";
|
|
|
|
version = "0.9.0";
|
|
|
|
deps = stdenv.mkDerivation {
|
|
|
|
name = "${baseName}-deps-${version}";
|
|
|
|
buildCommand = ''
|
|
|
|
export COURSIER_CACHE=$(pwd)
|
|
|
|
${coursier}/bin/coursier fetch ch.epfl.scala:scalafix-cli_2.12.7:${version} > deps
|
|
|
|
mkdir -p $out/share/java
|
|
|
|
cp $(< deps) $out/share/java/
|
|
|
|
'';
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHash = "19j260prx7k010nxyvc1m9jj1ncxr73m2cym7if39360v5dc05c0";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "${baseName}-${version}";
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ jdk deps ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
phases = [ "installPhase" "checkPhase" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/${baseName} \
|
|
|
|
--add-flags "-cp $CLASSPATH scalafix.cli.Cli"
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
$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 ];
|
|
|
|
};
|
|
|
|
}
|