scalafmt: 0.6.8 -> 1.3.0
This commit is contained in:
parent
b459c8475c
commit
614a6d43a7
@ -1,29 +1,36 @@
|
||||
{ stdenv, fetchurl, unzip, jre }:
|
||||
{ stdenv, jdk, jre, coursier, makeWrapper }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "0.6.8";
|
||||
let
|
||||
baseName = "scalafmt";
|
||||
version = "1.3.0";
|
||||
deps = stdenv.mkDerivation {
|
||||
name = "${baseName}-${version}-deps";
|
||||
buildCommand = ''
|
||||
export COURSIER_CACHE=$(pwd)
|
||||
mkdir -p $out/share/java
|
||||
cp $(${coursier}/bin/coursier fetch com.geirsson:scalafmt-cli_2.12:${version}) $out/share/java/
|
||||
'';
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHash = "0q1vw6drpdrfifbm3266igpml0phdk6pl0gd3b5amysigx83m251";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "${baseName}-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/scalameta/scalafmt/releases/download/v${version}/${baseName}.tar.gz";
|
||||
sha256 = "1iaanrxk5lhxx1zj9gbxzgqbnyy1azfrab984mga7di5z1hs02s2";
|
||||
};
|
||||
buildInputs = [ jdk makeWrapper deps ];
|
||||
|
||||
unpackPhase = "tar xvzf $src";
|
||||
doCheck = true;
|
||||
|
||||
phases = [ "installPhase" "checkPhase" ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
mkdir -p "$out/lib"
|
||||
makeWrapper ${jre}/bin/java $out/bin/${baseName} \
|
||||
--add-flags "-cp $CLASSPATH org.scalafmt.cli.Cli"
|
||||
'';
|
||||
|
||||
cp cli/target/scala-2.11/scalafmt.jar "$out/lib/${name}.jar"
|
||||
|
||||
cat > "$out/bin/${baseName}" << EOF
|
||||
#!${stdenv.shell}
|
||||
exec ${jre}/bin/java -jar "$out/lib/${name}.jar" "\$@"
|
||||
EOF
|
||||
|
||||
chmod a+x "$out/bin/${baseName}"
|
||||
checkPhase = ''
|
||||
$out/bin/${baseName} --version | grep -q "${version}"
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
|
Loading…
Reference in New Issue
Block a user