-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (74 loc) · 2.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.DEFAULT_GOAL := all
TEST_E2E_DIR = ocaml-lsp-server/test/e2e
.PHONY: yarn-install
yarn-install:
cd $(TEST_E2E_DIR) && yarn --frozen-lockfile
-include Makefile.dev
.PHONY: all
all:
dune build @all
# we don't use --with-test because it pulls test dependencies transitively in
# practice this ends up pulling a lot of extra packages which invariably
# results in a conflict
.PHONY: install-test-deps
install-test-deps:
opam install 'menhir>20211230' cinaps 'ppx_expect>=v0.15.0' \
ocamlformat.$$(awk -F = '$$1 == "version" {print $$2}' .ocamlformat) ocamlformat-rpc
.PHONY: dev
dev: ## Setup a development environment
opam switch create --no-install . ocaml-base-compiler.4.14.0
opam install -y dune-release merlin ocamlformat utop ocaml-lsp-server
opam install --locked --deps-only --with-doc -y .
$(MAKE) install-test-deps
.PHONY: install
install: ## Install the packages on the system
dune build @install && dune install
.PHONY: lock
lock: ## Generate the lock files
opam lock -y .
.PHONY: test-ocaml
test-ocaml: ## Run the unit tests
dune build @lsp/test/runtest @lsp-fiber/runtest @jsonrpc-fiber/runtest @ocaml-lsp-server/runtest
.PHONY: promote
promote:
dune promote
.PHONY: check
check:
dune build @check
.PHONY: test-e2e
test-e2e:
dune build @install && dune exec -- ocaml-lsp-server/test/run_test_e2e.exe
.PHONY: promote-e2e
promote-e2e:
dune build @install && cd $(TEST_E2E_DIR) && dune exec -- yarn run promote
.PHONY: test
test: test-ocaml test-e2e
.PHONY: clean
clean: ## Clean build artifacts and other generated files
dune clean
.PHONY: fmt
fmt: ## Format the codebase with ocamlformat
dune build @fmt --auto-promote
cd $(TEST_E2E_DIR) && yarn fmt
.PHONY: watch
watch: ## Watch for the filesystem and rebuild on every change
dune build --watch
.PHONY: utop
utop: ## Run a REPL and link with the project's libraries
dune utop . -- -implicit-bindings
.PHONY: release
release: ## Release on Opam
dune-release distrib --skip-build --skip-lint --skip-tests --include-submodules
# See https://github.com/ocamllabs/dune-release/issues/206
DUNE_RELEASE_DELEGATE=github-dune-release-delegate dune-release publish distrib --verbose
dune-release opam pkg
dune-release opam submit
.PHONY: nix-tests
nix-tests:
(cd $(TEST_E2E_DIR) && yarn --frozen-lockfile)
make test
.PHONY: nix-fmt
nix-fmt:
$(MAKE) yarn-install
dune build @fmt --auto-promote
cd $(TEST_E2E_DIR) && yarn fmt