-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
31 lines (23 loc) · 1017 Bytes
/
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
WORKDIR=build
ANTLR_VERSION=4.10
ANTLR_JAR=antlr-$(ANTLR_VERSION)-complete.jar
PROJECT=grammars-v4
[email protected]:facetoe/$(PROJECT).git
GRAMMAR_COMMIT=4a9bb0a5dc9cedbfafac688791ad0245a8d9d539
$(WORKDIR)/$(ANTLR_JAR):
mkdir -p $(WORKDIR)
curl https://www.antlr.org/download/$(ANTLR_JAR) -o $(WORKDIR)/$(ANTLR_JAR)
$(WORKDIR)/$(PROJECT):
git clone $(GITHUB_URL) $(WORKDIR)/$(PROJECT)
generate-parser: $(WORKDIR)/$(ANTLR_JAR) $(WORKDIR)/$(PROJECT)
git -C $(WORKDIR)/$(PROJECT) reset --hard "$(GRAMMAR_COMMIT)"
(cd $(WORKDIR)/$(PROJECT)/promql && java -jar $(CURDIR)/$(WORKDIR)/$(ANTLR_JAR) -Dlanguage=Python3 PromQLLexer.g4 -visitor -o $(CURDIR)/promval/parser)
(cd $(WORKDIR)/$(PROJECT)/promql && java -jar $(CURDIR)/$(WORKDIR)/$(ANTLR_JAR) -Dlanguage=Python3 PromQLParser.g4 -visitor -o $(CURDIR)/promval/parser)
clean:
rm -rf $(WORKDIR)
test:
PYTHONPATH=. pytest-3 tests/
reformat:
black --exclude promval/parser promval/ tests/
flake8:
flake8 --exclude promval/parser/ promval/ tests/