Skip to content

Commit db2a0ea

Browse files
gradle-completion: modernize, add update script (NixOS#354145)
2 parents 84c3711 + a49f4cf commit db2a0ea

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed
Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,52 @@
1-
{ lib, stdenv, fetchFromGitHub }:
2-
3-
stdenv.mkDerivation rec {
1+
{
2+
lib,
3+
stdenvNoCC,
4+
fetchFromGitHub,
5+
installShellFiles,
6+
gitUpdater,
7+
}:
8+
9+
stdenvNoCC.mkDerivation (finalAttrs: {
410
pname = "gradle-completion";
511
version = "1.4.1";
612

713
src = fetchFromGitHub {
814
owner = "gradle";
915
repo = "gradle-completion";
10-
rev = "v${version}";
16+
rev = "v${finalAttrs.version}";
1117
sha256 = "15b0692i3h8h7b95465b2aw9qf5qjmjag5n62347l8yl7zbhv3l2";
1218
};
1319

20+
nativeBuildInputs = [
21+
installShellFiles
22+
];
23+
1424
strictDeps = true;
1525

1626
# we just move two files into $out,
1727
# this shouldn't bother Hydra.
1828
preferLocalBuild = true;
1929

2030
dontBuild = true;
31+
2132
installPhase = ''
2233
runHook preInstall
2334
24-
mkdir -p $out
25-
install -Dm0644 ./_gradle $out/share/zsh/site-functions/_gradle
26-
install -Dm0644 ./gradle-completion.bash $out/share/bash-completion/completions/gradle
35+
installShellCompletion --name gradle \
36+
--bash gradle-completion.bash \
37+
--zsh _gradle
2738
2839
runHook postInstall
2940
'';
3041

31-
meta = with lib; {
42+
passthru.updateScript = gitUpdater {
43+
rev-prefix = "v";
44+
};
45+
46+
meta = {
3247
description = "Gradle tab completion for bash and zsh";
3348
homepage = "https://github.com/gradle/gradle-completion";
34-
license = licenses.mit;
35-
maintainers = [ ] ++ teams.java.members;
49+
license = lib.licenses.mit;
50+
maintainers = [ ] ++ lib.teams.java.members;
3651
};
37-
}
52+
})

0 commit comments

Comments
 (0)