-
-
Notifications
You must be signed in to change notification settings - Fork 192
/
Makefile
94 lines (72 loc) · 2.07 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
export PJ_ROOT=$(PWD)
FILTER ?= .*
export NVIM_RUNNER_VERSION := v0.10.0
export NVIM_TEST_VERSION ?= v0.10.0
ifeq ($(shell uname -s),Darwin)
UNAME ?= MACOS
else
UNAME ?= LINUX
endif
.DEFAULT_GOAL := build
nvim-test:
git clone https://github.com/lewis6991/nvim-test
nvim-test/bin/nvim-test --init
.PHONY: test
test: nvim-test
NVIM_TEST_VERSION=$(NVIM_TEST_VERSION) \
nvim-test/bin/nvim-test test \
--lpath=$(PWD)/lua/?.lua \
--verbose \
--filter="$(FILTER)"
-@stty sane
.PHONY: test-all
test-all:
$(MAKE) test NVIM_TEST_VERSION=v0.9.5
$(MAKE) test NVIM_TEST_VERSION=v0.10.0
$(MAKE) test NVIM_TEST_VERSION=nightly
export XDG_DATA_HOME ?= $(HOME)/.data
.PHONY: gen_help
gen_help: nvim-test
$(XDG_DATA_HOME)/nvim-test/nvim-runner-$(NVIM_RUNNER_VERSION)/bin/nvim -l ./gen_help.lua
@echo Updated help
STYLUA_PLATFORM_MACOS := macos-aarch64
STYLUA_PLATFORM_LINUX := linux-x86_64
STYLUA_PLATFORM := $(STYLUA_PLATFORM_$(UNAME))
STYLUA_VERSION := v0.18.2
STYLUA_ZIP := stylua-$(STYLUA_PLATFORM).zip
STYLUA_URL_BASE := https://github.com/JohnnyMorganz/StyLua/releases/download
STYLUA_URL := $(STYLUA_URL_BASE)/$(STYLUA_VERSION)/$(STYLUA_ZIP)
.INTERMEDIATE: $(STYLUA_ZIP)
$(STYLUA_ZIP):
wget $(STYLUA_URL)
stylua: $(STYLUA_ZIP)
unzip $<
.PHONY: stylua-check
stylua-check: stylua
./stylua --check lua/**/*.lua
.PHONY: stylua-run
stylua-run: stylua
./stylua \
lua/**/*.lua \
lua/*.lua \
test/*.lua
.PHONY: build
build: gen_help stylua-run
.PHONY: doc-check
doc-check: gen_help
git diff --exit-code -- doc
LUALS_VERSION := 3.7.4
LUALS_TARBALL := lua-language-server-$(LUALS_VERSION)-$(shell uname -s)-$(shell uname -m).tar.gz
LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(LUALS_TARBALL)
luals:
wget $(LUALS_URL)
mkdir luals
tar -xf $(LUALS_TARBALL) -C luals
rm -rf $(LUALS_TARBALL)
.PHONY: luals-check
luals-check: luals nvim-test
VIMRUNTIME=$(XDG_DATA_HOME)/nvim-test/nvim-test-$(NVIM_TEST_VERSION)/share/nvim/runtime \
luals/bin/lua-language-server \
--logpath=. \
--configpath=../.luarc.json \
--check=lua