tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
tree-sitter/update: rename fetchImpl to updateImpl
Profpatsch
3 years ago
8f2f2e34
3b0b6d1b
+9
-7
1 changed file
expand all
collapse all
unified
split
pkgs
development
tools
parsing
tree-sitter
update.nix
+9
-7
pkgs/development/tools/parsing/tree-sitter/update.nix
···
387
387
388
388
jsonFile = name: val: (formats.json { }).generate name val;
389
389
390
390
-
# implementation of the fetching of repo information from github
391
391
-
fetchImpl = passArgs "fetchImpl-with-args" {
390
390
+
# implementation of the updater
391
391
+
updateImpl = passArgs "updateImpl-with-args" {
392
392
binaries = {
393
393
curl = "${curl}/bin/curl";
394
394
nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git";
···
399
399
ignoredTreeSitterOrgRepos
400
400
;
401
401
}
402
402
-
(writers.writePython3 "fetchImpl" {
402
402
+
(writers.writePython3 "updateImpl" {
403
403
flakeIgnore = ["E501"];
404
404
} ./update_impl.py);
405
405
···
423
423
${xe}/bin/xe -F -j5 ${script} {}
424
424
'';
425
425
426
426
+
# The output directory in the current source tree.
427
427
+
# This will depend on your local environment, but that is intentional.
426
428
outputDir = "${toString ./.}/grammars";
427
429
428
430
update-all-grammars = writeShellScript "update-all-grammars.sh" ''
429
431
set -euo pipefail
430
432
echo "fetching list of grammars" 1>&2
431
431
-
treeSitterRepos=$(${fetchImpl} fetch-orga-latest-repos '{"orga": "tree-sitter"}')
433
433
+
treeSitterRepos=$(${updateImpl} fetch-orga-latest-repos '{"orga": "tree-sitter"}')
432
434
echo "checking the tree-sitter repo list against the grammars we know" 1>&2
433
433
-
printf '%s' "$treeSitterRepos" | ${fetchImpl} check-tree-sitter-repos '{}'
435
435
+
printf '%s' "$treeSitterRepos" | ${updateImpl} check-tree-sitter-repos '{}'
434
436
echo "writing files to ${outputDir}" 1>&2
435
437
mkdir -p "${outputDir}"
436
438
${forEachParallel
437
439
"repos-to-fetch"
438
440
(writeShellScript "fetch-repo" ''
439
439
-
${fetchImpl} fetch-repo "$1"
441
441
+
${updateImpl} fetch-repo "$1"
440
442
'')
441
443
(lib.mapAttrsToList
442
444
(nixRepoAttrName: attrs: attrs // {
···
446
448
})
447
449
allGrammars)
448
450
}
449
449
-
${fetchImpl} print-all-grammars-nix-file "$(< ${
451
451
+
${updateImpl} print-all-grammars-nix-file "$(< ${
450
452
jsonFile "all-grammars.json" {
451
453
allGrammars =
452
454
(lib.mapAttrsToList