Skip to content

Commit d827ca8

Browse files
committed
build: download tree sitter sources in dune
Moves the download step to dune rules, allowing us to eliminate an extra script. This also means dune is aware of the archive, so can handle caching it directly (understanding a version change invalidates it) without the need for a script to handle this logic.
1 parent 3d41420 commit d827ca8

File tree

2 files changed

+14
-69
lines changed

2 files changed

+14
-69
lines changed

dune

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
(dirs :standard)
22

3+
(rule
4+
(action
5+
(with-stdout-to
6+
tree-sitter-sources.tgz
7+
(run
8+
curl
9+
-L
10+
https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v%{read-lines:tree-sitter-version}.tar.gz))))
11+
312
(rule
413
(mode
514
(promote (until-clean)))
6-
(deps tree-sitter-version)
715
(target
816
(dir tree-sitter-repo))
17+
(deps
18+
(:source-archive tree-sitter-sources.tgz))
919
(action
10-
(run %{project_root}/scripts/download-tree-sitter %{target})))
20+
(progn
21+
(run mkdir -p %{target})
22+
(run tar xf %{source-archive} -C %{target} --strip-components=1))))
1123

1224
(rule
1325
(deps tree-sitter-repo)

scripts/download-tree-sitter

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)