-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
67 lines (60 loc) · 1.26 KB
/
Makefile.toml
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
[env]
CRATE_NAME = { script = ["echo ${PWD##*/}"] }
CRATE_NAME_SNAKE_CASE = { script = ["echo ${CRATE_NAME//-/_}"] }
TARGET_DIR="docs/"
BUILD="release"
TARGET_NAME="${CRATE_NAME_SNAKE_CASE}.wasm"
TARGET_PATH="${TARGET_DIR}/${TARGET_NAME}"
[tasks.install-wasm]
command = "rustup"
args = [
"target",
"add",
"wasm32-unknown-unknown",
]
[tasks.build-wasm]
command = "cargo"
args = [
"build",
"--lib",
"--${BUILD}",
"-p",
"${CRATE_NAME}",
"--target=wasm32-unknown-unknown",
]
[tasks.wasm-bindgen]
install_crate = { crate_name = "wasm-bindgen-cli", binary = "wasm-bindgen", test_arg = "--help" }
command = "wasm-bindgen"
args = [
"target/wasm32-unknown-unknown/${BUILD}/${TARGET_NAME}",
"--out-dir",
"${TARGET_DIR}",
"--no-modules",
"--no-typescript",
]
[tasks.build-web]
dependencies = [
"clean-web",
"install-wasm",
"build-wasm",
"wasm-bindgen",
]
script = '''
cargo build --${BUILD} -p ${CRATE_NAME} \
--lib --target=wasm32-unknown-unknown
'''
[tasks.clean-web]
script = [
"rm -f ${TARGET_PATH}",
]
[tasks.run-web]
dependencies = [
"build-web",
]
install_crate = { crate_name = "basic-http-server", binary = "basic-http-server", test_arg = "--help" }
command = "basic-http-server"
args = [
"--addr",
"127.0.0.1:8080",
"${TARGET_DIR}"
]