-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
99 lines (77 loc) · 2.37 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
# TODO: split sub-language makes into their dirs & call `$(MAKE) -C dir` for them
SHELL = bash
ifeq ($(WINDOWS),true)
VENV=venv/Scripts/python.exe
else
VENV=venv/bin/python
endif
ifeq ($(PYTHON),)
PYTHON := python$(PY_VER)
endif
.PHONY: build
build:
cargo build --release
.PHONY: build-wasm
build-wasm: setup
cargo clean -p jsonlogic-rs
rm -rf ./js && wasm-pack build --target nodejs --out-dir js --out-name index --release --scope bestow -- --features wasm
.PHONY: debug-wasm
debug-wasm:
rm -rf ./js && wasm-pack build --target nodejs --out-dir js --out-name index --debug --scope bestow -- --features wasm
.PHONY: clean-py
clean-py:
rm -rf build/*
rm -rf dist/*
.PHONY: build-py-sdist
build-py-sdist: $(VENV) clean-py
cargo clean -p jsonlogic-rs
$(VENV) setup.py sdist
.PHONY: build-py-wheel
build-py-wheel: $(VENV) clean-py
cargo clean -p jsonlogic-rs
$(VENV) setup.py bdist_wheel
# NOTE: this command may require sudo on linux
.PHONY: build-py-wheel-manylinux
build-py-wheel-manylinux: clean-py
docker run -v "$$PWD":/io --rm "$(MANYLINUX_IMG)" /io/build-wheels.sh
# NOTE: this command may require sudo on linux
.PHONY: build-py-wheel-manylinux-no-clean
build-py-wheel-manylinux-no-clean:
docker run -v "$$PWD":/io --rm "$(MANYLINUX_IMG)" /io/build-wheels.sh
.PHONY: build-py-all
build-py-all: $(VENV) clean-py
cargo clean -p jsonlogic-rs
$(VENV) setup.py sdist bdist_wheel
.PHONY: develop-py-wheel
develop-py-wheel: $(VENV)
$(VENV) setup.py bdist_wheel
.PHONY: develop-py
develop-py: $(VENV)
$(VENV) setup.py develop
.PHONY: distribute-py
distribute-py: $(VENV)
$(VENV) -m pip install twine
twine upload -s dist/*
.PHONY: test-distribute-py
test-distribute-py:
$(VENV) -m pip install twine
twine upload -s --repository testpypi dist/*
.PHONY: setup
setup:
wasm-pack --version > /dev/null 2>&1 || cargo install wasm-pack
.PHONY: test
test:
PYTHON=$(PYTHON) WINDOWS=$(WINDOWS) cargo test --all-features
.PHONY: test-wasm
test-wasm:
node tests/test_wasm.js
.PHONY: test-py
test-py: $(VENV)
$(VENV) tests/test_py.py
# Note: please change both here and in the build-wheels script if specifying a
# particular version or removing the version pin. setuptools-rust is currently
# pinned because the windows builds were broken with v0.11.3.
venv: $(VENV)
$(VENV): setup.py pyproject.toml
$(PYTHON) -m venv venv
$(VENV) -m pip install setuptools wheel setuptools-rust==0.10.6