-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
138 lines (108 loc) · 3.95 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
UNAME := $(shell uname)
cpp_example = ./example/cpp-example
cpp_docs = ./docs/cpp
.PHONY: wasm js wasmweb android ios test clean cleanall mac_install cpp python-tests lint-fix lint-py wasm-tests wasm-ci-tests proto cpp-ci-tests cpp-tests mobile-release
wasm:
wasm-pack build --scope crypto-com bindings/wasm
js:
wasm-pack build --scope crypto-com bindings/wasm
./js_build.sh
wasmweb:
wasm-pack build -d target/wasmweb --scope crypto-com bindings/wasm --target web
android:
./android_build.sh
ios:
./ios_build.sh
test:
cargo test --all-features
clean:
rm -rf target bindings/android bindings/ios
./clean.sh
cleanall:
rm -rf target bindings/android bindings/ios
rm -rf NDK
./clean.sh
mobile-release:
cp mobile_modules/android_module/dwclib/build/outputs/aar/dwclib-release.aar target/release/
zip -q -r target/release/dwclib-framework-iphoneos.zip mobile_modules/ios_module/dwclib/build/Release-iphoneos/dwclib.framework
zip -q -r target/release/dwclib-framework-iphonesimulator.zip mobile_modules/ios_module/dwclib/build/Release-iphonesimulator/dwclib.framework
mac_install:
cargo install uniffi_bindgen
brew install ktlint
brew install swiftformat
build_cpp:
ifeq ($(shell uname -m), x86_64)
./checkmac.sh && cargo build --package defi-wallet-core-cpp --release
endif
ifeq ($(shell uname -m), arm64)
rustup target add x86_64-apple-darwin
./checkmac.sh && cargo build --package defi-wallet-core-cpp --release --target x86_64-apple-darwin
endif
cd $(cpp_example) && make
cpp: build_cpp
. ./scripts/.env && cd $(cpp_example) && make run
proto:
cd proto-build && cargo run
python-tests:
@nix-shell ./integration_tests/shell.nix --run scripts/python-tests
wasm-ci-tests:
export WASM_BINDGEN_TEST_TIMEOUT=60
@nix-shell ./integration_tests/shell.nix --run "scripts/chainmain-ctl start"
cd bindings/wasm/ && wasm-pack test --firefox --headless && cd ../..
@nix-shell ./integration_tests/shell.nix --run "scripts/chainmain-ctl stop"
@nix-shell ./integration_tests/shell.nix --run "scripts/chainmain-ctl clear"
@nix-shell ./integration_tests/shell.nix --run "scripts/start-all"
cd bindings/wasm/ && wasm-pack test --firefox --headless -- --features cronos-test,ibc-test --test ibc --test ethereum && cd ../..
@nix-shell ./integration_tests/shell.nix --run "scripts/stop-all"
# No ibc test
wasm-tests:
sh ./scripts/wasm-tests
# Full test with ibc cases
full-wasm-tests:
sh ./scripts/full-wasm-tests
cpp-ci-tests: build_cpp
make cpp-tests
cpp-tests: python-tests
# Choose the defualt cpp docs engine
cpp-docs: cpp-docs-gitbook
cpp-docs-doxygen: build_cpp
@nix-shell ./docs/cpp/shell.nix --run "cd $(cpp_docs) && doxygen"
ifeq ($(UNAME), Darwin)
open $(cpp_docs)/doxygen/html/index.html
endif
cpp-docs-sphinx: build_cpp
@nix-shell ./docs/cpp/shell.nix --run "cd $(cpp_docs) && doxygen && cd sphinx && make html"
ifeq ($(UNAME), Darwin)
open $(cpp_docs)/sphinx/_build/html/index.html
endif
cpp-docs-gitbook: build_cpp
@nix-shell ./docs/cpp/shell.nix --run "\
cd $(cpp_docs) && doxygen && doxybook2 \
--input doxygen/xml \
--output gitbook/src \
--config config.json \
--summary-input SUMMARY.md.tmpl \
--summary-output gitbook/src/SUMMARY.md \
&& cd gitbook/src && gitbook build"
ifeq ($(UNAME), Darwin)
@nix-shell ./docs/cpp/shell.nix --run "\
cd $(cpp_docs)/gitbook/src && gitbook serve --open"
endif
cpp-docs-mdbook: build_cpp
@nix-shell ./docs/cpp/shell.nix --run "\
cd $(cpp_docs) && doxygen && doxybook2 \
--input doxygen/xml \
--output mdbook/src \
--config config.json \
--summary-input SUMMARY.md.tmpl \
--summary-output mdbook/src/SUMMARY.md \
&& cd mdbook && mdbook build"
ifeq ($(UNAME), Darwin)
@nix-shell ./docs/cpp/shell.nix --run "\
cd $(cpp_docs)/mdbook && mdbook serve --open"
endif
lint-py:
flake8 --show-source --count --statistics \
--format="::error file=%(path)s,line=%(row)d,col=%(col)d::%(path)s:%(row)d:%(col)d: %(code)s %(text)s" \
lint-nix:
find . -name "*.nix" ! -path './example/*' | xargs nixpkgs-fmt --check