forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
61 lines (44 loc) · 1.68 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
.PHONY: all
.DEFAULT: all
all:
OS = $(shell uname)
GIT_ROOT = $(shell git rev-parse --show-toplevel)
TOKENIZER_FILE = semmle/python/parser/tokenizer.py
TOKENIZER_DEPS = tokenizer_generator/state_transition.txt tokenizer_generator/tokenizer_template.py
# Must use the same Python version as on jenkins, since output differs per version.
# However, output is unstable on Python 3.5 (which jenkins uses)
TOKENIZER_CMD = python3 -m tokenizer_generator.gen_state_machine $(TOKENIZER_DEPS)
.PHONY: tokenizer
tokenizer: $(TOKENIZER_FILE)
$(TOKENIZER_FILE): $(TOKENIZER_DEPS)
$(TOKENIZER_CMD) > $@
MASTER_FILE = semmle/python/master.py
DBSCHEME_FILE = $(GIT_ROOT)/python/ql/lib/semmlecode.python.dbscheme
.PHONY: dbscheme
dbscheme: $(MASTER_FILE)
python3 -m semmle.dbscheme_gen $(DBSCHEME_FILE)
AST_GENERATED_DIR = $(GIT_ROOT)/python/ql/lib/semmle/python/
AST_GENERATED_FILE = $(AST_GENERATED_DIR)AstGenerated.qll
.PHONY: ast
ast: $(MASTER_FILE)
python3 -m semmle.query_gen $(AST_GENERATED_DIR)
codeql query format --in-place $(AST_GENERATED_FILE)
################################################################################
# Tests
################################################################################
.PHONY: test-all
test-all: test-3
.PHONY: test-3
test-3: pytest-3 test-tokenizer
.PHONY: test-tokenizer
test-tokenizer: SHELL:=/bin/bash
test-tokenizer:
@echo Not running test-tokenizer as jenkins uses Python 3.5
# TODO: Enable again once we run Python > 3.5 on Jenkins
# diff -u $(TOKENIZER_FILE) <($(TOKENIZER_CMD))
.PHONY: pytest-3
pytest-3:
poetry run pytest
.PHONY: pytest-3-deprecation-error
pytest-3-deprecation-error:
PYTHONWARNINGS='error::DeprecationWarning' poetry run pytest