This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
126 lines (94 loc) · 3.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
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
RUSTUP = rustup
TOOLCHAIN = $(shell cat rust-toolchain)
CARGO = $(RUSTUP) run --install $(TOOLCHAIN) cargo --color always
NIGHTLY_TOOLCHAIN = "nightly-2019-07-31"
CARGO_NIGHTLY = $(RUSTUP) run --install $(NIGHTLY_TOOLCHAIN) cargo --color always
# cannot use the unix-socket to talk to the docker daemon on windows
ifeq ($(OS),Windows_NT)
BUILD_ARGS = --no-default-features --features windows
TEST_ARGS = --no-default-features --features windows
INSTALL_ARGS = --no-default-features --features windows
endif
.PHONY: install_rust install_rust_nightly install_clippy install_rustfmt install_tomlfmt install clean all format build build_debug release clippy test doc check_format e2e_scenarios e2e yarn_install_all yarn_check_all yarn_fix_all
default: build
install_rust:
$(RUSTUP) install $(TOOLCHAIN)
install_rust_nightly:
$(RUSTUP) install $(NIGHTLY_TOOLCHAIN)
## Dev environment
install_clippy: install_rust
$(RUSTUP) component list --installed --toolchain $(TOOLCHAIN) | grep -q clippy || $(RUSTUP) component add clippy --toolchain $(TOOLCHAIN)
# need nightly toolchain to get access to `merge_imports`
install_rustfmt: install_rust_nightly
$(RUSTUP) component list --installed --toolchain $(NIGHTLY_TOOLCHAIN) | grep -q rustfmt || $(RUSTUP) component add rustfmt --toolchain $(NIGHTLY_TOOLCHAIN)
install_tomlfmt: install_rust
$(CARGO) --list | grep -q tomlfmt || $(CARGO) install cargo-tomlfmt
## User install
install:
$(CARGO) install --force --path create $(INSTALL_ARGS)
$(CARGO) install --force --path scripts $(INSTALL_ARGS)
clean:
$(CARGO) clean
## Development tasks
all: format build_debug clippy test doc e2e_scenarios
format: install_rustfmt install_tomlfmt
$(CARGO_NIGHTLY) fmt
$(CARGO) tomlfmt -p Cargo.toml
$(CARGO) tomlfmt -p create/Cargo.toml
$(CARGO) tomlfmt -p scripts/Cargo.toml
build: build_debug
build_debug:
cd ./create; $(CARGO) build --all-targets $(BUILD_ARGS)
cd ./scripts; $(CARGO) build --all-targets $(BUILD_ARGS)
release: release_create release_scripts
release_create:
cd ./create; $(CARGO) build --all-targets --release $(BUILD_ARGS)
release_scripts:
cd ./scripts; $(CARGO) build --all-targets --release $(BUILD_ARGS)
clippy: install_clippy
$(CARGO) clippy --all-targets -- -D warnings
test:
cd ./create; $(CARGO) test $(TEST_ARGS)
cd ./scripts; $(CARGO) test $(TEST_ARGS)
doc:
$(CARGO) doc
check_format: install_rustfmt install_tomlfmt
$(CARGO_NIGHTLY) fmt -- --check
$(CARGO) tomlfmt -d -p Cargo.toml
$(CARGO) tomlfmt -d -p create/Cargo.toml
$(CARGO) tomlfmt -d -p scripts/Cargo.toml
yarn_install_all:
cd ./common; yarn install
cd ./scripts/npm; yarn install
cd ./create/npm; yarn install
cd ./create/new_project/demos/btc_eth; yarn install
cd ./create/new_project/demos/erc20_btc; yarn install
cd ./create/new_project/examples/btc_eth; yarn install
yarn_upgrade_all:
cd ./common; yarn upgrade
cd ./scripts/npm; yarn upgrade
cd ./create/npm; yarn upgrade
cd ./create/new_project/demos/btc_eth; yarn upgrade
cd ./create/new_project/demos/erc20_btc; yarn upgrade
cd ./create/new_project/examples/btc_eth; yarn upgrade
yarn_fix_all:
cd ./common; yarn run fix
cd ./scripts/npm; yarn run fix
cd ./create/npm; yarn run fix
cd ./create/new_project/demos/btc_eth; yarn run fix
cd ./create/new_project/demos/erc20_btc; yarn run fix
cd ./create/new_project/examples/btc_eth; yarn run fix
yarn_check_all: yarn_install_all
cd ./common; yarn run check
cd ./scripts/npm; yarn run check
cd ./create/npm; yarn run check
cd ./create/new_project/demos/btc_eth; yarn run check
cd ./create/new_project/demos/erc20_btc; yarn run check
cd ./create/new_project/examples/btc_eth; yarn run check
e2e_scenarios:
./scripts/tests/start_env.sh
./scripts/tests/force_clean_env.sh
./create/tests/new.sh
./create/tests/run_demo.sh btc_eth
./create/tests/run_demo.sh erc20_btc
e2e: build_debug e2e_scenarios