Skip to content

Commit 40c41d5

Browse files
committed
build: use dune
1 parent abb14bf commit 40c41d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3500
-1433
lines changed

.circleci/config.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,27 @@ jobs:
1313
working_directory: ~/ocaml-tree-sitter
1414
steps:
1515
- checkout
16-
- run:
17-
name: set up node
18-
command: ./scripts/setup-node
1916
- run:
2017
name: fetch submodules
21-
command: git submodule update --init --recursive --depth 1
18+
command: git submodule update --init --recursive
2219
- run:
23-
name: configure
24-
command: ./configure
20+
name: set up rust, for tree-sitter
21+
command: sudo apt-get install -y rustup libclang-dev && rustup default stable && rustup update
2522
- run:
26-
name: install dependencies
27-
command: opam exec -- make setup
23+
name: set up node, for tree-sitter
24+
command: ./scripts/setup-node
2825
- run:
29-
name: check code formatting
30-
command: ./scripts/lint
26+
name: set up opam
27+
command: ./scripts/setup-opam
3128
- run:
3229
name: build
33-
command: opam exec -- make
30+
command: opam exec -- dune build --verbose
3431
- run:
3532
name: install
36-
command: opam exec -- make install
37-
- run:
38-
name: unit tests
39-
command: opam exec -- make unit
33+
command: opam exec -- dune build @install
4034
- run:
41-
name: end-to-end tests
42-
command: opam exec -- make e2e
35+
name: test
36+
command: opam exec -- dune runtest --verbose
4337

4438
workflows:
4539
version: 2

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/bin
22
tmp
3-
/downloads
3+
/tree-sitter-repo
44

55
# Dune build data
66
_build
@@ -24,6 +24,3 @@ _build
2424
# The default installation root of tree-sitter
2525
/tree-sitter
2626
/tree-sitter-*.*.*
27-
28-
# The file containing the tree-sitter version being used
29-
/tree-sitter-version

Dockerfile

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,38 @@
1010
# docker run -it ocaml-tree-sitter
1111
#
1212

13-
FROM ocaml/opam2:debian-stable
13+
FROM ocaml/opam:debian-ocaml-5.4
14+
15+
# Slow steps that mostly download and build external stuff.
16+
RUN sudo apt-get update
17+
18+
# libclang needed for rust bindgen
19+
RUN sudo apt-get install -y rustup libclang-dev
20+
RUN rustup default stable
21+
RUN rustup update
22+
1423

15-
COPY --chown=opam:opam scripts /home/opam/ocaml-tree-sitter/scripts
16-
COPY --chown=opam:opam Makefile /home/opam/ocaml-tree-sitter/Makefile
1724
WORKDIR /home/opam/ocaml-tree-sitter
1825

19-
# hadolint ignore=DL3004
20-
RUN sudo chown opam:opam .
26+
COPY --chown=opam:opam scripts scripts
2127

22-
# Slow steps that mostly download and build external stuff.
2328
RUN ./scripts/setup-node
29+
30+
COPY --chown=opam:opam dune-project dune-project
31+
COPY --chown=opam:opam tree-sitter-version tree-sitter-version
32+
2433
RUN ./scripts/setup-opam
25-
RUN ./scripts/install-tree-sitter-lib
26-
COPY --chown=opam:opam configure /home/opam/ocaml-tree-sitter/configure
27-
RUN opam exec -- ./configure
28-
COPY --chown=opam:opam tree-sitter.opam /home/opam/ocaml-tree-sitter/tree-sitter.opam
29-
RUN opam exec -- make setup
34+
35+
COPY --chown=opam:opam dune dune
3036

3137
# Copy the rest, which changes often.
32-
COPY --chown=opam:opam . /home/opam/ocaml-tree-sitter
38+
COPY --chown=opam:opam . .
3339

3440
# 'opam exec -- CMD' sets environment variables (PATH etc.) and runs
3541
# command CMD in this environment.
3642
# This is equivalent to 'eval $(opam env)' which normally goes into
3743
# ~/.bashrc or similar.
3844
#
39-
RUN opam exec -- make
40-
RUN opam exec -- make install
41-
RUN opam exec -- make test
45+
RUN opam exec -- dune build --verbose
46+
RUN opam exec -- dune build @install
47+
RUN opam exec -- dune runtest --verbose

Makefile

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

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,26 @@ license no matter what.
5353
`git commit`.
5454
4. Check out the [extra instructions for MacOS](doc/macos.md).
5555

56-
For building or rebuilding everything after big changes, use these scripts:
57-
```
58-
$ make distclean
59-
$ ./configure
60-
$ make setup
61-
$ ./scripts/rebuild-everything # needs root access to install libtree-sitter
56+
For building or rebuilding everything after big changes:
57+
```bash
58+
# Install OCaml dependencies (if not already installed)
59+
$ opam install --deps-only .
60+
61+
# Build and test (automatically sets up tree-sitter on first build)
62+
$ dune build
63+
$ dune runtest
6264
```
6365

6466
### tree-sitter version
6567

6668
The default tree-sitter version to use is in the
67-
`tree-sitter-version.default` file.
69+
`tree-sitter-version` file.
6870

6971
Under the default configuration used for local development purposes,
7072
the version being actually used is stored in the file
71-
`tree-sitter-version`. This can be changed by invoking
72-
`./scripts/switch-tree-sitter-version` before `make setup`.
73-
We made this available to facilitate the transition from tree-sitter 0.20.6 to
74-
0.22.6 in ocaml-tree-sitter-semgrep where the integration of some
75-
grammars needs to be updated. The latest version of these grammars are
73+
`tree-sitter-version`.We made this available to facilitate the transition from
74+
tree-sitter 0.20.6 to 0.22.6 in ocaml-tree-sitter-semgrep where the integration
75+
of some grammars needs to be updated. The latest version of these grammars are
7676
compatible with 0.22.6 but their OCaml integration in Semgrep needs work.
7777

7878
Documentation

configure

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

0 commit comments

Comments
 (0)