forked from emacs-lsp/lsp-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
123 lines (97 loc) · 3.14 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
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
SHELL := /usr/bin/env bash
EMACS ?= emacs
CASK ?= cask
INIT="(progn \
(require 'package) \
(push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) \
(package-initialize) \
(package-refresh-contents))"
LINT="(progn \
(unless (package-installed-p 'package-lint) \
(package-install 'package-lint)) \
(require 'package-lint) \
(package-lint-batch-and-exit))"
LSP-FILES := lsp-protocol.el lsp-mode.el lsp.el lsp-completion.el \
lsp-diagnostics.el lsp-lens.el lsp-modeline.el \
$(wildcard clients/*.el)
WIN-BOOTSTRAP=test/windows-bootstrap.el
TEST-PKGS=test/test-packages.el
TEST-FILES := test/test-helper.el $(shell ls test/lsp-*.el)
LOAD-FILE = -l $(test-file)
LOAD-TEST-FILES := $(foreach test-file, $(TEST-FILES), $(LOAD-FILE))
all:
$(CASK) build
unix-build:
$(CASK) install
# TODO: add 'checkdoc' and 'lint' here when they pass
unix-ci: clean unix-build unix-compile prepare_cpp_project unix-test test-downstream-pkgs
windows-ci: CASK=
windows-ci: clean windows-compile windows-test test-downstream-pkgs
unix-compile:
@echo "Compiling..."
@$(CASK) $(EMACS) -Q --batch \
-L . -L clients \
--eval '(setq byte-compile-error-on-warn t)' \
-f batch-byte-compile $(LSP-FILES)
prepare_cpp_project:
@echo "Setting up Sample C++ project with CMake and clangd"
cd test/fixtures/SampleCppProject/ && mkdir -p build && cd build/ && cmake ..
windows-compile:
@echo "Compiling..."
@$(CASK) $(EMACS) -Q --batch \
--eval '(setq emacs-lsp-ci t)' \
-l $(WIN-BOOTSTRAP) \
-L . -L clients \
--eval '(setq byte-compile-error-on-warn t)' \
-f batch-byte-compile $(LSP-FILES)
test-downstream-pkgs:
@echo "Test downstream packages..."
@$(CASK) $(EMACS) -Q --batch \
--eval '(setq emacs-lsp-ci t)' \
-l $(WIN-BOOTSTRAP) \
-l $(TEST-PKGS)
checkdoc:
$(eval LOG := $(shell mktemp -d)/checklog.log)
@touch $(LOG)
@echo "checking doc..."
@for f in $(LSP-FILES); do \
$(CASK) $(EMACS) -Q --batch \
--eval "(checkdoc-file \"$$f\")" \
2>&1 | tee -a $(LOG); \
done
@if [ -s $(LOG) ]; then \
echo ''; \
exit 1; \
else \
echo 'checkdoc ok!'; \
fi
lint:
@echo "package linting..."
@$(CASK) $(EMACS) -Q --batch \
-L . -L clients \
--eval $(INIT) \
--eval $(LINT) \
$(LSP-FILES)
unix-test:
@echo "Testing..."
$(CASK) exec ert-runner -L . -L clients $(LOAD-TEST-FILES) -t '!no-win' -t '!org'
windows-test:
@echo "Testing..."
@$(EMACS) -Q --batch \
--eval '(setq emacs-lsp-ci t)' \
-l $(WIN-BOOTSTRAP) \
-L . -L clients \
$(LOAD-TEST-FILES) \
--eval "(ert-run-tests-batch-and-exit \
'(and (not (tag no-win)) (not (tag org))))"
docs:
make -C docs/ generate
local-webpage: docs
cp -rf README.md examples docs
docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pandoc/core:2.9 -s CHANGELOG.org -t gfm -o docs/page/CHANGELOG.md
docker login docker.pkg.github.com
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs docker.pkg.github.com/emacs-lsp/docs-image/docs-image
clean:
rm -rf .cask *.elc clients/*.elc
rm -rf test/fixtures/SampleCppProject/build test/fixtures/SampleCppProject/.cache
.PHONY: all unix-build ci unix-compile windows-compile checkdoc lint unix-test windows-test docs local-webpage clean