-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
71 lines (57 loc) · 1.57 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
export RSYNC_ROOT=$(PWD)
TEST_DIR := $(RSYNC_ROOT)/tests/rsync/
MINIMAL_PATH := $(RSYNC_ROOT)/scripts/minimal.vim
MINIMAL_INIT_PATH := $(RSYNC_ROOT)/tests/minimal_init.lua
UNAME_S := $(shell uname -s)
.PHONY: build
build:
cargo build --release
@rm -rf $(PWD)/lua/librsync_nvim.so $(PWD)/lua/deps/
ifeq ($(UNAME_S),Linux)
cp $(PWD)/target/release/librsync_nvim.so $(PWD)/lua/rsync_nvim.so
endif
ifeq ($(UNAME_S),Darwin)
cp $(PWD)/target/release/librsync_nvim.dylib $(PWD)/lua/rsync_nvim.so
endif
@mkdir -p $(PWD)/lua/deps/
cp $(PWD)/target/release/deps/*.rlib $(PWD)/lua/deps/
.PHONY: lint
lint: stylua luacheck cargocheck
.PHONY: luacheck
luacheck:
luacheck lua/rsync
.PHONY: stylua
stylua:
stylua --color always --check lua/ tests/
.PHONY: cargocheck
cargocheck:
cargo fmt --check
cargo clippy
.PHONY: plenary
plenary:
if [ -d plenary.nvim ]; then cd plenary.nvim && git pull; \
else git clone https://github.com/nvim-lua/plenary.nvim; fi
.PHONY: test
test: plenary
nvim --headless --noplugin -u $(MINIMAL_PATH) -c "PlenaryBustedDirectory $(TEST_DIR) {minimal_init = '$(MINIMAL_INIT_PATH)'}"
.PHONY: testcov
testcov:
TEST_COV=1 $(MAKE) --no-print-directory test
@luacov-console lua/rsync/
@luacov-console -s
@luacov -r lcov || luacov
ifeq ($(NOCLEAN), )
@$(MAKE) --no-print-directory test-clean
endif
.PHONY: testcov-html
testcov-html:
NOCLEAN=1 $(MAKE) --no-print-directory testcov
luacov -r html
xdg-open luacov-html/index.html
.PHONY: test-clean
test-clean:
@rm -rf luacov*
.PHONY: clean
clean: test-clean
@rm -rf lua/deps
@rm lua/rsync_nvim.so