Skip to content
Open
Show file tree
Hide file tree
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
27 changes: 25 additions & 2 deletions dune
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
(dirs :standard)

(rule
(action
(with-stdout-to
tree-sitter-sources.tgz
(run
curl
-L
https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v%{read-lines:tree-sitter-version}.tar.gz))))

(rule
(mode
(promote (until-clean)))
(deps tree-sitter-version)
(target
(dir tree-sitter-repo))
(deps
(:source-archive tree-sitter-sources.tgz)
(:patches
(source_tree patch)))
(action
(run %{project_root}/scripts/download-tree-sitter %{target})))
(progn
(run mkdir -p %{target})
(run tar xf %{source-archive} -C %{target} --strip-components=1)
(bash
; Apply each patch for this version. nullglob needed so we don't fail when
; a version has no patches (otherwise the for loop has one iteration over
; the literal pattern, when the glob fails to expand)
"shopt -s nullglob;
for patch in patch/tree-sitter-%{read-lines:tree-sitter-version}/*.patch; do
patch_path=$(realpath $patch);
patch -N -b -i $patch_path -d %{target};
done"))))

(rule
(deps tree-sitter-repo)
Expand Down
87 changes: 0 additions & 87 deletions scripts/download-tree-sitter

This file was deleted.

3 changes: 2 additions & 1 deletion src/bindings/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

(rule
(targets c_flags.sexp c_library_flags.sexp)
(deps (:tree-sitter-prefix %{project_root}/tree-sitter-out))
(deps
(:tree-sitter-prefix %{project_root}/tree-sitter-out))
(action
(setenv
PKG_CONFIG_PATH
Expand Down