-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
45 lines (36 loc) · 1.48 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
ALL_CONTRACTS = cep85 cep85-test-contract
CONTRACT_TARGET_DIR = contracts/target/wasm32-unknown-unknown/release
PINNED_TOOLCHAIN := $(shell cat contracts/rust-toolchain)
prepare:
rustup target add wasm32-unknown-unknown
rustup component add clippy --toolchain ${PINNED_TOOLCHAIN}
rustup component add rustfmt --toolchain ${PINNED_TOOLCHAIN}
.PHONY: build-contract
build-contract:
cd contracts/cep85 && cargo build --release
wasm-strip $(CONTRACT_TARGET_DIR)/cep85.wasm
.PHONY: build-all-contracts
build-all-contracts:
cd contracts && cargo build --release $(patsubst %,-p %, $(ALL_CONTRACTS))
$(foreach WASM, $(ALL_CONTRACTS), wasm-strip $(CONTRACT_TARGET_DIR)/$(subst -,_,$(WASM)).wasm ;)
setup-test: build-all-contracts
mkdir -p tests/wasm
cp $(CONTRACT_TARGET_DIR)/cep85.wasm tests/wasm
cp $(CONTRACT_TARGET_DIR)/cep85_test_contract.wasm tests/wasm
test: setup-test
cd tests && cargo test
clippy:
cd contracts && cargo clippy --bins --target wasm32-unknown-unknown -- -D warnings
cd contracts && cargo clippy --lib --target wasm32-unknown-unknown -- -D warnings
cd contracts && cargo clippy --lib --target wasm32-unknown-unknown --no-default-features -- -D warnings
cd tests && cargo clippy --all-targets -- -D warnings
check-lint: clippy
cd contracts && cargo fmt -- --check
cd tests && cargo +$(PINNED_TOOLCHAIN) fmt -- --check
format:
cd contracts && cargo fmt
cd tests && cargo +$(PINNED_TOOLCHAIN) fmt
clean:
cd contracts && cargo clean
cd tests && cargo clean
rm -rf tests/wasm