-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
152 lines (123 loc) · 3.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
[config]
default_to_workspace = false
additional_profiles = ["debug"]
[env]
APP = "echo"
DIST = "target/dist"
[tasks.choose_profile.env]
MODE = "release"
ADDITIONAL = "--release"
[tasks.choose_profile.env.debug]
MODE = "debug"
ADDITIONAL = "--color=auto" # it's a stub
[tasks.parse_params]
script_runner = "@duckscript"
script = '''
if not is_empty ${1}
set_env APP ${1}
end
'''
[tasks.wasm_build_prepare]
dependencies = ["choose_profile", "parse_params"]
[tasks.wasm_build_prepare.env]
RUSTFLAGS = "-Copt-level=s"
[tasks.wasm_build_prepare.env.debug]
RUSTFLAGS = ""
[tasks.create_lapp_dir]
script_runner = "@duckscript"
script = "mkdir ${DIST}/${APP}"
dependencies = ["parse_params"]
[tasks.copy_data]
script_runner = "@duckscript"
script = '''
if is_path_exists data
rm -r ${DIST}/${APP}/data
if not eq ${APP} "laplace"
cp data ${DIST}/${APP}/
end
end
'''
dependencies = ["create_lapp_dir"]
[tasks.copy_static]
script_runner = "@duckscript"
script = '''
rm -r ${DIST}/${APP}/static
if not eq ${APP} "laplace"
cp static ${DIST}/${APP}/
end
'''
dependencies = ["create_lapp_dir"]
[tasks.copy_config]
script_runner = "@duckscript"
script = '''
if is_path_exists config.toml
rm ${DIST}/${APP}/config.toml
cp config.toml ${DIST}/${APP}/config.toml
end
'''
dependencies = ["create_lapp_dir"]
[tasks.build_client]
toolchain = "stable"
command = "cargo"
args = ["build", "-p", "${APP}_client", "--target", "wasm32-unknown-unknown", "${ADDITIONAL}"]
dependencies = ["wasm_build_prepare"]
[tasks.build_server]
toolchain = "stable"
command = "cargo"
args = ["build", "-p", "${APP}_server", "--target", "wasm32-unknown-unknown", "${ADDITIONAL}"]
dependencies = ["wasm_build_prepare"]
[tasks.build_server_wasi]
env = { RUSTFLAGS = "${RUSTFLAGS} -C lto=no -Z wasi-exec-model=reactor" }
toolchain = "nightly"
command = "cargo"
args = ["build", "-p", "${APP}_server", "--target", "wasm32-wasi", "${ADDITIONAL}"]
dependencies = ["wasm_build_prepare"]
[tasks.deploy_client]
command = "wasm-bindgen"
args = [
"--target",
"web",
"--no-typescript",
"--out-dir",
"${DIST}/${APP}/static",
"--out-name",
"${APP}_client",
"target/wasm32-unknown-unknown/${MODE}/${APP}_client.wasm",
]
dependencies = ["choose_profile", "copy_static", "copy_data"]
[tasks.deploy_server]
script_runner = "@duckscript"
script = '''
rm ${DIST}/${APP}/${APP}_server.wasm
cp target/wasm32-unknown-unknown/${MODE}/${APP}_server.wasm ${DIST}/${APP}/${APP}_server.wasm
'''
dependencies = ["choose_profile", "copy_config"]
[tasks.deploy_server_wasi]
script_runner = "@duckscript"
script = '''
rm ${DIST}/${APP}/${APP}_server.wasm
cp target/wasm32-wasi/${MODE}/${APP}_server.wasm ${DIST}/${APP}/${APP}_server.wasm
'''
dependencies = ["choose_profile", "copy_config"]
[tasks.client]
dependencies = ["build_client", "deploy_client"]
[tasks.server]
dependencies = ["build_server", "deploy_server"]
[tasks.wasi]
dependencies = ["build_server_wasi", "deploy_server_wasi"]
[tasks.all]
run_task = [
{ name = ["client", "server"] },
]
[tasks.watch]
toolchain = "stable"
command = "cargo"
args = ["watch", "-w", "client", "-w", "static", "-x", "make client"]
[tasks.lar]
script_runner = "@shell"
script = '''
rm -f ${DIST}/${APP}.lar
cd ${DIST}
zip -r ${APP}.lar ${APP}
'''
dependencies = ["all"]