Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scalafix: 0.10.0 -> 0.12.0 #301909

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 51 additions & 41 deletions pkgs/development/tools/scalafix/default.nix
Original file line number Diff line number Diff line change
@@ -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/
'';
outputHashMode = "recursive";
outputHash = "sha256-lDeg90L484MggtQ2a9OyHv4UcfLPjzG3OJZCaWW2AC8=";
};
in
stdenv.mkDerivation {
pname = baseName;
inherit version;

nativeBuildInputs = [ makeWrapper installShellFiles setJavaClassPath ];
buildInputs = [ deps ];
nativeBuildInputs = [makeWrapper installShellFiles setJavaClassPath];
buildInputs = [finalAttrs.deps];

dontUnpack = true;
dontUnpack = true;

installPhase = ''
makeWrapper ${jre}/bin/java $out/bin/${baseName} \
--add-flags "-cp $CLASSPATH scalafix.cli.Cli"
installPhase = ''
makeWrapper ${jre}/bin/java $out/bin/${finalAttrs.pname} \
--add-flags "-cp $CLASSPATH scalafix.cli.Cli"

installShellCompletion --cmd ${baseName} \
--bash <($out/bin/${baseName} --bash) \
--zsh <($out/bin/${baseName} --zsh)
'';
installShellCompletion --cmd ${finalAttrs.pname} \
--bash <($out/bin/${finalAttrs.pname} --bash) \
--zsh <($out/bin/${finalAttrs.pname} --zsh)
'';

installCheckPhase = ''
$out/bin/${baseName} --version | grep -q "${version}"
'';
passthru.tests = {
testVersion = testers.testVersion {
program = "${finalAttrs.pname}";
version = "${finalAttrs.version}";
};
};

meta = with lib; {
description = "Refactoring and linting tool for Scala";
mainProgram = "scalafix";
hakan-demirli marked this conversation as resolved.
Show resolved Hide resolved
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];
hakan-demirli marked this conversation as resolved.
Show resolved Hide resolved
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
}
)