-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
56 lines (49 loc) · 1.58 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
[tasks.clean-frontend]
description = "Clean the generated frontend WASM files"
command = "bash"
args = ["-c", "yes | rm -rf static/frontend/* wasm-frontend/target/wasm32-unknown-unknown/debug/wasm_*"]
[tasks.install-wasm-target]
description = "Ensure wasm target is installed"
command = "rustup"
args = ["target", "add", "wasm32-unknown-unknown"]
condition = { files_exist = ["target/wasm32-unknown-unknown"] }
[tasks.build-frontend]
description = "Build the frontend (WASM)"
cwd = "wasm-frontend"
command = "cargo"
args = ["build", "--target", "wasm32-unknown-unknown"]
dependencies = ["clean-frontend", "install-wasm-target"]
[tasks.install-wasm-bindgen]
description = "Ensure wasm-bindgen is installed"
script = [
'''
if ! command -v wasm-bindgen &> /dev/null
then
echo "wasm-bindgen not found, installing..."
cargo install wasm-bindgen-cli
else
echo "wasm-bindgen is already installed"
fi
'''
]
[tasks.wasm-bindgen]
description = "Run wasm-bindgen to generate bindings for the web"
cwd = "wasm-frontend"
command = "wasm-bindgen"
args = [
"--target", "web",
"--out-dir", "../static/frontend/",
"target/wasm32-unknown-unknown/debug/wasm_frontend.wasm"
]
dependencies = ["build-frontend", "install-wasm-bindgen"]
[tasks.run-backend]
description = "Run the backend"
command = "cargo"
args = ["run"]
[tasks.build-and-run]
description = "Build the frontend, generate wasm bindings, and run the backend"
dependencies = ["wasm-bindgen", "run-backend"]
[tasks.default]
description = "Build and run the project"
clear = true
dependencies = ["build-and-run"]