generated from nvim-treesitter/module-template
-
Notifications
You must be signed in to change notification settings - Fork 248
Expand file tree
/
Copy pathMakefile
More file actions
136 lines (102 loc) · 3.28 KB
/
Makefile
File metadata and controls
136 lines (102 loc) · 3.28 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
NVIM_VERSION ?= nightly
LUALS_VERSION := 3.15.0
DEPDIR ?= .test-deps
CURL ?= curl -sL --create-dirs
ifeq ($(shell uname -s),Darwin)
NVIM_ARCH ?= macos-arm64
LUALS_ARCH ?= darwin-arm64
STYLUA_ARCH ?= macos-aarch64
RUST_ARCH ?= aarch64-apple-darwin
else
NVIM_ARCH ?= linux-x86_64
LUALS_ARCH ?= linux-x64
STYLUA_ARCH ?= linux-x86_64
RUST_ARCH ?= x86_64-unknown-linux-gnu
endif
.DEFAULT_GOAL := all
# download test dependencies
NVIM := $(DEPDIR)/nvim-$(NVIM_ARCH)
NVIM_TARBALL := $(NVIM).tar.gz
NVIM_URL := https://github.com/neovim/neovim/releases/download/$(NVIM_VERSION)/$(notdir $(NVIM_TARBALL))
NVIM_BIN := $(NVIM)/nvim-$(NVIM_ARCH)/bin/nvim
NVIM_RUNTIME=$(NVIM)/nvim-$(NVIM_ARCH)/share/nvim/runtime
.PHONY: nvim
nvim: $(NVIM)
$(NVIM):
$(CURL) $(NVIM_URL) -o $(NVIM_TARBALL)
mkdir $@
tar -xf $(NVIM_TARBALL) -C $@
rm -rf $(NVIM_TARBALL)
LUALS := $(DEPDIR)/lua-language-server-$(LUALS_VERSION)-$(LUALS_ARCH)
LUALS_TARBALL := $(LUALS).tar.gz
LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(notdir $(LUALS_TARBALL))
.PHONY: luals
luals: $(LUALS)
$(LUALS):
$(CURL) $(LUALS_URL) -o $(LUALS_TARBALL)
mkdir $@
tar -xf $(LUALS_TARBALL) -C $@
rm -rf $(LUALS_TARBALL)
STYLUA := $(DEPDIR)/stylua-$(STYLUA_ARCH)
STYLUA_TARBALL := $(STYLUA).zip
STYLUA_URL := https://github.com/JohnnyMorganz/StyLua/releases/latest/download/$(notdir $(STYLUA_TARBALL))
.PHONY: stylua
stylua: $(STYLUA)
$(STYLUA):
$(CURL) $(STYLUA_URL) -o $(STYLUA_TARBALL)
unzip $(STYLUA_TARBALL) -d $(STYLUA)
rm -rf $(STYLUA_TARBALL)
TSQUERYLS := $(DEPDIR)/ts_query_ls-$(RUST_ARCH)
TSQUERYLS_TARBALL := $(TSQUERYLS).tar.gz
TSQUERYLS_URL := https://github.com/ribru17/ts_query_ls/releases/latest/download/$(notdir $(TSQUERYLS_TARBALL))
.PHONY: tsqueryls
tsqueryls: $(TSQUERYLS)
$(TSQUERYLS):
$(CURL) $(TSQUERYLS_URL) -o $(TSQUERYLS_TARBALL)
mkdir $@
tar -xf $(TSQUERYLS_TARBALL) -C $@
rm -rf $(TSQUERYLS_TARBALL)
NVIM_TS := $(DEPDIR)/nvim-treesitter
.PHONY: nvim_ts
nvim_ts: $(NVIM_TS)
$(NVIM_TS):
git clone --filter=blob:none --single-branch https://github.com/nvim-treesitter/nvim-treesitter -b main $(NVIM_TS)
PLENARY := $(DEPDIR)/plenary.nvim
.PHONY: plenary
plenary: $(PLENARY)
$(PLENARY):
git clone --filter=blob:none https://github.com/nvim-lua/plenary.nvim $(PLENARY)
# actual test targets
.PHONY: lua
lua: formatlua checklua
.PHONY: formatlua
formatlua: $(STYLUA)
$(STYLUA)/stylua .
.PHONY: checklua
checklua: $(LUALS) $(NVIM)
VIMRUNTIME=$(NVIM_RUNTIME) $(LUALS)/bin/lua-language-server \
--configpath=../.luarc.json \
--check=./
.PHONY: query
query: formatquery lintquery checkquery
.PHONY: lintquery
lintquery: $(TSQUERYLS)
$(TSQUERYLS)/ts_query_ls lint queries
.PHONY: formatquery
formatquery: $(TSQUERYLS)
$(TSQUERYLS)/ts_query_ls format queries
.PHONY: checkquery
checkquery: $(TSQUERYLS)
$(TSQUERYLS)/ts_query_ls check queries
.PHONY: docs
docs: $(NVIM) $(NVIM_TS)
NVIM_TS=$(NVIM_TS) $(NVIM_BIN) -l scripts/update-builtin-textobjects.lua
.PHONY: tests
tests: $(NVIM) $(PLENARY) $(NVIM_TS)
NVIM_TS=$(NVIM_TS) PLENARY=$(PLENARY) $(NVIM_BIN) --headless --clean -u scripts/minimal_init.lua \
-c "PlenaryBustedDirectory tests { minimal_init = './scripts/minimal_init.lua' }"
.PHONY: all
all: lua query docs tests
.PHONY: clean
clean:
rm -rf $(DEPDIR)