Merge pull request #301909 from hakan-demirli/scalafix-12.0

scalafix: 0.10.0 -> 0.12.0
This commit is contained in:
Aleksana 2024-04-18 16:19:37 +08:00 committed by GitHub
commit a792d25470
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 53 additions and 43 deletions

View File

@ -1,47 +1,57 @@
{ lib, stdenv, jre, coursier, makeWrapper, installShellFiles, setJavaClassPath }:
{
lib,
stdenv,
jre,
coursier,
makeWrapper,
installShellFiles,
setJavaClassPath,
testers,
}:
stdenv.mkDerivation (
finalAttrs: {
pname = "scalafix";
version = "0.12.0";
deps = stdenv.mkDerivation {
name = "${finalAttrs.pname}-deps-${finalAttrs.version}";
buildCommand = ''
export COURSIER_CACHE=$(pwd)
${coursier}/bin/cs fetch ch.epfl.scala:scalafix-cli_2.13.13:${finalAttrs.version} > deps
mkdir -p $out/share/java
cp $(< deps) $out/share/java/
'';
outputHashMode = "recursive";
outputHash = "sha256-HMTnr3awTIAgLSl4eF36U1kv162ajJxC5MreSk2TfUE=";
};
let
baseName = "scalafix";
version = "0.10.0";
deps = stdenv.mkDerivation {
name = "${baseName}-deps-${version}";
buildCommand = ''
export COURSIER_CACHE=$(pwd)
${coursier}/bin/cs fetch ch.epfl.scala:scalafix-cli_2.13.8:${version} > deps
mkdir -p $out/share/java
cp $(< deps) $out/share/java/
nativeBuildInputs = [makeWrapper installShellFiles setJavaClassPath];
buildInputs = [finalAttrs.deps];
dontUnpack = true;
installPhase = ''
makeWrapper ${jre}/bin/java $out/bin/${finalAttrs.pname} \
--add-flags "-cp $CLASSPATH scalafix.cli.Cli"
installShellCompletion --cmd ${finalAttrs.pname} \
--bash <($out/bin/${finalAttrs.pname} --bash) \
--zsh <($out/bin/${finalAttrs.pname} --zsh)
'';
outputHashMode = "recursive";
outputHash = "sha256-lDeg90L484MggtQ2a9OyHv4UcfLPjzG3OJZCaWW2AC8=";
};
in
stdenv.mkDerivation {
pname = baseName;
inherit version;
nativeBuildInputs = [ makeWrapper installShellFiles setJavaClassPath ];
buildInputs = [ deps ];
passthru.tests = {
testVersion = testers.testVersion {
program = "${finalAttrs.pname}";
version = "${finalAttrs.version}";
};
};
dontUnpack = true;
installPhase = ''
makeWrapper ${jre}/bin/java $out/bin/${baseName} \
--add-flags "-cp $CLASSPATH scalafix.cli.Cli"
installShellCompletion --cmd ${baseName} \
--bash <($out/bin/${baseName} --bash) \
--zsh <($out/bin/${baseName} --zsh)
'';
installCheckPhase = ''
$out/bin/${baseName} --version | grep -q "${version}"
'';
meta = with lib; {
description = "Refactoring and linting tool for Scala";
mainProgram = "scalafix";
homepage = "https://scalacenter.github.io/scalafix/";
license = licenses.bsd3;
maintainers = [ maintainers.tomahna ];
};
}
meta = with lib; {
description = "Refactoring and linting tool for Scala";
mainProgram = "scalafix";
homepage = "https://scalacenter.github.io/scalafix/";
license = licenses.bsd3;
maintainers = [maintainers.tomahna];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
}
)