-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
142 lines (100 loc) · 3.75 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
.PHONY: test go-test rust-test rust-build python-build python-test python-flask-build \
python-flask-test python-django-test python-sqlalchemy-test ruby-test \
java-test docs-test fmt clippy lint wasm-build wasm-test js-test \
lint-ruby lint-js lint-go lint-java lint-rust fmt-java fmt-rust fmt-go fmt-js fmt-python \
clean clean-docs clean-rust clean-go clean-js clean-polar-wasm-api
#! If you add another dependency to this you must also add it to the Test
#! github action or it won't run in CI. All jobs run in parallel on CI and
#! `make test` is just a local convenience.
test: go-test rust-test python-test ruby-test java-test python-flask-test \
python-django-test python-sqlalchemy-test wasm-test js-test
rust-test:
cargo test --all-targets --all-features
rust-build:
cargo build -p polar-c-api
python-build: rust-build
$(MAKE) -C languages/python/oso build
python-flask-build: python-build
$(MAKE) -C languages/python/flask-oso build
python-django-build: python-build
$(MAKE) -C languages/python/django-oso build
python-sqlalchemy-build: python-build
$(MAKE) -C languages/python/sqlalchemy-oso build
python-test: python-build
$(MAKE) -C languages/python/oso test
cd test && python test.py
python-flask-test: python-build python-flask-build
$(MAKE) -C languages/python/flask-oso test
python-django-test: python-build python-django-build
$(MAKE) -C languages/python/django-oso test
$(MAKE) -C languages/python/django-oso test22
python-sqlalchemy-test: python-build
$(MAKE) -C languages/python/sqlalchemy-oso test
ruby-test:
$(MAKE) -C languages/ruby test
OSO_VERSION :=$(shell cat VERSION)
java-test:
$(MAKE) -C languages/java package
cd test && \
javac -classpath "../languages/java/oso/target/oso-$(OSO_VERSION).jar:." Test.java && \
java -classpath "../languages/java/oso/target/oso-$(OSO_VERSION).jar:." -enableassertions Test
go-test: rust-build
$(MAKE) -C languages/go test
docs-test: python-build
$(MAKE) -C docs test
fmt: fmt-java fmt-rust fmt-python fmt-js fmt-go
# Ensure jq is installed.
$(if $(shell command -v jq 2> /dev/null),,$(error Please install jq <https://stedolan.github.io/jq/>))
fmt.jar:
$(eval URL := $(shell curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/google/google-java-format/releases/latest | jq '.assets[] | select(.name | test("all-deps.jar")) | .browser_download_url'))
curl -L $(URL) > fmt.jar
fmt-java: fmt.jar
$(eval FILES := $(shell git ls-files '*.java'))
$(eval OPENS := $(shell echo "--add-opens jdk.compiler/com.sun.tools.javac."{api,tree,file,util,parser}"=ALL-UNNAMED"))
java $(OPENS) -jar fmt.jar --replace $(FILES)
fmt-rust:
cargo fmt
fmt-go:
$(MAKE) -C languages/go fmt
fmt-js:
$(MAKE) -C languages/js fmt
fmt-python:
$(MAKE) -C languages/python fmt
clippy:
cargo clippy --all-features --all-targets -- -D warnings
lint-python: python-build python-flask-build python-sqlalchemy-build python-django-build
$(MAKE) -C languages/python lint
lint-ruby:
$(MAKE) -C languages/ruby lint typecheck
lint-js:
$(MAKE) -C languages/js lint
lint-go:
$(MAKE) -C languages/go lint
lint-java:
$(MAKE) -C languages/java lint
lint-rust:
$(MAKE) -C languages/rust lint
lint: clippy lint-python lint-ruby lint-js lint-go lint-java lint-rust
$(MAKE) fmt
wasm-build:
$(MAKE) -C polar-wasm-api build
wasm-test:
$(MAKE) -C polar-wasm-api test
js-test:
$(MAKE) -C languages/js parity
$(MAKE) -C languages/js test
clean: clean-docs clean-rust clean-go clean-java clean-js clean-polar-wasm-api clean-python
clean-docs:
$(MAKE) -C docs clean
clean-rust:
cargo clean
clean-go:
$(MAKE) -C languages/go clean
clean-java:
$(MAKE) -C languages/java clean
clean-js:
$(MAKE) -C languages/js clean
clean-polar-wasm-api:
$(MAKE) -C polar-wasm-api clean
clean-python:
$(MAKE) -C languages/python clean