Skip to content

Commit e47feb6

Browse files
committed
Support venv in Makefile
1 parent 66cd846 commit e47feb6

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.antlr
2-
gqlex/
2+
gqlex/
3+
__pycache__/

Makefile

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
gen_dir = gen
22
lang = Java
3+
package = com.intuit.oss.gqlex.parser
34

4-
.PHONY: all clean install
5+
.PHONY: all clean install test_cases
56

6-
all:
7+
all: install
78
@echo "Generating code..."
89
@mkdir -p $(gen_dir)
9-
@antlr4 -Dlanguage=$(lang) -o $(gen_dir) -visitor -lib $(gen_dir) gqlex.g4
10+
@source gqlex/bin/activate; antlr4 -Dlanguage=$(lang) -o $(gen_dir) -visitor -package $(package) -lib $(gen_dir) gqlex.g4
1011

11-
clean:
12-
rm -rf $(gen_dir)/*
13-
14-
install:
12+
install: requirements.txt
1513
@echo "Installing dependencies..."
16-
@pip install antlr4-tools
14+
@python3 -m venv gqlex && source gqlex/bin/activate; python3 -m pip install -r requirements.txt
1715

18-
test_cases:
16+
test_cases: install
1917
@echo "Generating test cases..."
20-
@grammarinator-process gqlex.g4 -o tests/fuzzer/ --no-actions
21-
@grammarinator-generate gqlexGenerator.gqlexGenerator -r document -d 25 -n 10 -o tests/cases/test_%d.gql --sys-path tests/fuzzer/
18+
@mkdir -p tests/fuzzer/ tests/cases/
19+
@source gqlex/bin/activate; grammarinator-process gqlex.g4 -o tests/fuzzer/ --no-actions
20+
@source gqlex/bin/activate; grammarinator-generate gqlexGenerator.gqlexGenerator -r document -d 25 -n 10 -o tests/cases/test_%d.gql --sys-path tests/fuzzer/
21+
22+
clean:
23+
rm -rf $(gen_dir)/* tests/ gqlex/ gen/

requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
grammarinator==23.7
2+
antlr4-python3-runtime==4.13.0
3+
antlr4-tools==0.2.1

0 commit comments

Comments
 (0)