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
30 changes: 12 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,32 @@ version: 2.1
jobs:
build:
docker:
- image: returntocorp/ocaml:ubuntu
- image: ocaml/opam:debian-ocaml-5.4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the preferred image here?


working_directory: ~/ocaml-tree-sitter
steps:
- checkout
- run:
name: set up node
command: ./scripts/setup-node
- run:
name: fetch submodules
command: git submodule update --init --recursive --depth 1
command: git submodule update --init --recursive
- run:
name: configure
command: ./configure
name: set up rust, for tree-sitter
command: sudo apt-get install -y rustup libclang-dev && rustup default stable && rustup update
- run:
name: install dependencies
command: opam exec -- make setup
name: set up node, for tree-sitter
command: ./scripts/setup-node
- run:
name: check code formatting
command: ./scripts/lint
name: set up opam
command: ./scripts/setup-opam
- run:
name: build
command: opam exec -- make
command: opam exec -- dune build --verbose
- run:
name: install
command: opam exec -- make install
- run:
name: unit tests
command: opam exec -- make unit
command: opam exec -- dune build @install
- run:
name: end-to-end tests
command: opam exec -- make e2e
name: test
command: opam exec -- dune runtest --verbose

workflows:
version: 2
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/bin
tmp
/downloads
/tree-sitter-repo

# Dune build data
_build
Expand All @@ -24,6 +24,3 @@ _build
# The default installation root of tree-sitter
/tree-sitter
/tree-sitter-*.*.*

# The file containing the tree-sitter version being used
/tree-sitter-version
36 changes: 21 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,38 @@
# docker run -it ocaml-tree-sitter
#

FROM ocaml/opam2:debian-stable
FROM ocaml/opam:debian-ocaml-5.4

# Slow steps that mostly download and build external stuff.
RUN sudo apt-get update

# libclang needed for rust bindgen
RUN sudo apt-get install -y rustup libclang-dev
RUN rustup default stable
RUN rustup update


COPY --chown=opam:opam scripts /home/opam/ocaml-tree-sitter/scripts
COPY --chown=opam:opam Makefile /home/opam/ocaml-tree-sitter/Makefile
WORKDIR /home/opam/ocaml-tree-sitter

# hadolint ignore=DL3004
RUN sudo chown opam:opam .
COPY --chown=opam:opam scripts scripts

# Slow steps that mostly download and build external stuff.
RUN ./scripts/setup-node

COPY --chown=opam:opam dune-project dune-project
COPY --chown=opam:opam tree-sitter-version tree-sitter-version

RUN ./scripts/setup-opam
RUN ./scripts/install-tree-sitter-lib
COPY --chown=opam:opam configure /home/opam/ocaml-tree-sitter/configure
RUN opam exec -- ./configure
COPY --chown=opam:opam tree-sitter.opam /home/opam/ocaml-tree-sitter/tree-sitter.opam
RUN opam exec -- make setup

COPY --chown=opam:opam dune dune

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

# 'opam exec -- CMD' sets environment variables (PATH etc.) and runs
# command CMD in this environment.
# This is equivalent to 'eval $(opam env)' which normally goes into
# ~/.bashrc or similar.
#
RUN opam exec -- make
RUN opam exec -- make install
RUN opam exec -- make test
RUN opam exec -- dune build --verbose
RUN opam exec -- dune build @install
RUN opam exec -- dune runtest --verbose
66 changes: 0 additions & 66 deletions Makefile

This file was deleted.

24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,26 @@ license no matter what.
`git commit`.
4. Check out the [extra instructions for MacOS](doc/macos.md).

For building or rebuilding everything after big changes, use these scripts:
```
$ make distclean
$ ./configure
$ make setup
$ ./scripts/rebuild-everything # needs root access to install libtree-sitter
For building or rebuilding everything after big changes:
```bash
# Install OCaml dependencies (if not already installed)
$ opam install --deps-only .

# Build and test (automatically sets up tree-sitter on first build)
$ dune build
$ dune runtest
```

### tree-sitter version

The default tree-sitter version to use is in the
`tree-sitter-version.default` file.
`tree-sitter-version` file.

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

Documentation
Expand Down
126 changes: 0 additions & 126 deletions configure

This file was deleted.

Loading