This repository has been archived by the owner on Jul 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
68 lines (51 loc) · 1.81 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
default: integration
##@ Generates Schema
.PHONY: gen
MOLC := moleculec
MOLC_VERSION := 0.4.2
GEN_MOL_IN_DIR := types/schemas
GEN_MOL_OUT_DIR := types/src/generated
GEN_MOL_FILES := ${GEN_MOL_OUT_DIR}/godwoken.rs ${GEN_MOL_OUT_DIR}/blockchain.rs
remove-generated:
rm ${GEN_MOL_FILES} # Remove Generate Files
gen: check-moleculec-version remove-generated ${GEN_MOL_FILES} # Generate Files
.PHONY: check-moleculec-version
check-moleculec-version:
test "$$(${MOLC} --version | awk '{ print $$2 }' | tr -d ' ')" = ${MOLC_VERSION}
${GEN_MOL_OUT_DIR}/godwoken.rs: ${GEN_MOL_IN_DIR}/godwoken.mol
${MOLC} --language rust --schema-file $< | rustfmt > $@
${GEN_MOL_OUT_DIR}/blockchain.rs: ${GEN_MOL_IN_DIR}/blockchain.mol
${MOLC} --language rust --schema-file $< | rustfmt > $@
install-tools:
test "$$(${MOLC} --version)" == "Moleculec ${MOLC_VERSION}" || \
cargo install --force --path molecule/tools/compiler --bin "${MOLC}"
##@ Development
CONTRACTS := contracts
TESTS := contracts-test
CARGO_PROJS := ${CONTRACTS}/main ${CONTRACTS}/challenge ${CONTRACTS}/dummy-lock ${TESTS}
.PHONY: integration
integration: contracts-via-docker check-fmt clippy test
contracts-via-docker:
make -C ${CONTRACTS} $@
test: ${GEN_MOL_OUT_DIR}/godwoken.rs
cd ${TESTS} && cargo test --all --all-features ${TEST_ARGS} -- --nocapture
clippy:
cd ${TESTS} && cargo clippy --all --all-features --all-targets
check-fmt:
cd ${TESTS} && cargo fmt --all -- --check
check:
cd ${TESTS} && cargo check --all --all-targets
fmt:
CURRENT_DIR=`pwd`; \
for proj in ${CARGO_PROJS} ; do \
cd $$CURRENT_DIR/$$proj && cargo fmt --all ; \
done
clean-contracts:
make -C ${CONTRACTS} clean
clean-cargo:
CURRENT_DIR=`pwd`; \
for proj in ${CARGO_PROJS} ; do \
cd $$CURRENT_DIR/$$proj && cargo clean ; \
done
clean: clean-cargo clean-contracts
# .PHONY: