-
-
Notifications
You must be signed in to change notification settings - Fork 664
/
Makefile.toml
284 lines (249 loc) · 6.88 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# Global Settings
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_TARGET_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target"
SKIP_TEST = false
ZELLIJ_EXAMPLE_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/example"
ZELLIJ_ASSETS_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets"
# Add clippy to the default flow
[tasks.dev-test-flow]
dependencies = [
"plugins",
"format-flow",
"format-toml-conditioned-flow",
"pre-build",
"build",
"post-build",
"test-flow",
"clippy",
]
[tasks.test]
dependencies = ["get-host-triple"]
args = ["test", "--target", "${CARGO_HOST_TRIPLE}", "--", "@@split(CARGO_MAKE_TASK_ARGS,;)"]
# Running Zellij using the development data directory
[tasks.run]
workspace = false
dependencies = ["build-workspace"]
run_task = "launch"
[tasks.build-workspace]
run_task = { name = "build", fork = true }
[tasks.build]
env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = "default-plugins*" }
args = ["build"]
[tasks.build-release]
args = ["build", "--release"]
[tasks.build-e2e-data-dir]
dependencies = ["plugins-release"]
script_runner = "@duckscript"
script = '''
target_dir = set ${CARGO_TARGET_DIR}
data_dir = set ${target_dir}/e2e-data
rm -r ${data_dir}
plugins = glob_array ${target_dir}/wasm32-wasi/release/*.wasm
mkdir ${data_dir}
mkdir ${data_dir}/plugins
for plugin in ${plugins}
plugin_name = basename ${plugin}
cp ${plugin} ${data_dir}/plugins/${plugin_name}
end
writefile ${data_dir}/VERSION ${CARGO_MAKE_CRATE_VERSION}
'''
[tasks.launch]
command = "cargo"
args = [
"run",
"--",
"--data-dir",
"${CARGO_TARGET_DIR}/dev-data/",
"@@split(CARGO_MAKE_TASK_ARGS,;)",
]
# Simple clippy tweak
[tasks.clippy]
dependencies = ["plugins"]
args = ["clippy", "--all-targets", "--all-features", "@@split(CARGO_MAKE_TASK_ARGS,;)"]
# Release building and installing Zellij
[tasks.install]
workspace = false
dependencies = ["wasm-opt-plugins", "build-release", "manpage"]
script_runner = "@duckscript"
script = '''
if is_dir ${CARGO_MAKE_TASK_ARGS}
trigger_error "You need to specify a full path for the binary, not just a directory!"
else
cp ${CARGO_TARGET_DIR}/release/${CARGO_MAKE_CRATE_NAME} ${CARGO_MAKE_TASK_ARGS}
end
'''
[tasks.wasm-opt-plugins]
alias = "plugins-release"
[tasks.plugins-release]
workspace = false
script_runner = "@duckscript"
script = '''
plugins = glob_array ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/default-plugins/*
out_dir = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets/plugins/
mkdir ${out_dir}
for plugin in ${plugins}
cd ${plugin}
exec cargo build --release
plugin_name = basename ${plugin}
plugin_in = set ${CARGO_TARGET_DIR}/wasm32-wasi/release/${plugin_name}.wasm
plugin_out = set ${out_dir}/${plugin_name}.wasm
exec wasm-opt -O ${plugin_in} -o ${plugin_out}
cd ..
end
'''
[tasks.plugins]
workspace = false
script_runner = "@duckscript"
script = '''
plugins = glob_array ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/default-plugins/*
out_dir = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets/plugins/
mkdir ${out_dir}
for plugin in ${plugins}
cd ${plugin}
exec cargo build
plugin_name = basename ${plugin}
plugin_in = set ${CARGO_TARGET_DIR}/wasm32-wasi/debug/${plugin_name}.wasm
plugin_out = set ${out_dir}/${plugin_name}.wasm
cp ${plugin_in} ${plugin_out}
cd ..
end
'''
[tasks.get-host-triple]
script_runner = "@duckscript"
script = '''
output = exec rustc -v -V
lines = split ${output.stdout} \n
triple = set ""
for line in ${lines}
if starts_with ${line} "host:" && not is_empty ${line}
bits = split ${line} " "
triple = array_get ${bits} 1
triple = set ${triple}
end
end
if not is_empty ${triple}
set_env CARGO_HOST_TRIPLE "${triple}"
end
'''
[tasks.manpage]
workspace = false
description = "Use mandown crate to create or update man entry from docs/MANPAGES.md"
script = '''
root_dir=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}
mkdir -p ${root_dir}/assets/man
mandown ${root_dir}/docs/MANPAGE.md ZELLIJ 1 > ${root_dir}/assets/man/zellij.1
'''
dependencies = ["install-mandown"]
[tasks.install-mandown]
command = "cargo"
args = ["install", "mandown"]
# copy the example default config from assets directory to a more user facing one
[tasks.update-default-config]
workspace = false
dependencies = []
script_runner = "@duckscript"
script = '''
cp ${ZELLIJ_ASSETS_DIR}/config/default.kdl ${ZELLIJ_EXAMPLE_DIR}/default.kdl
'''
# CI Releasing Zellij
[tasks.ci-build-release]
workspace = false
dependencies = [
"plugins-release",
"setup-cross-compilation",
"manpage",
]
command = "cross"
args = [
"build",
"--verbose",
"--release",
"--target",
"${CARGO_MAKE_TASK_ARGS}",
]
# Build e2e asset
[tasks.build-e2e]
workspace = false
dependencies = ["wasm-opt-plugins", "build-e2e-data-dir"]
command = "cargo"
args = [
"build",
"--verbose",
"--release",
"--target",
"x86_64-unknown-linux-musl",
]
# Run e2e tests - we mark the e2e tests as "ignored" so they will not be run with the normal ones
[tasks.e2e-test]
workspace = false
dependencies = ["build-e2e", "plugins"]
command = "cargo"
args = [
"test",
"--",
"--ignored",
"--nocapture",
"--test-threads",
"1",
"@@split(CARGO_MAKE_TASK_ARGS,;)",
]
[tasks.setup-cross-compilation]
command = "cargo"
args = ["install", "cross"]
# Publishing Zellij
[tasks.publish]
clear = true
workspace = false
dependencies = [
"plugins-release",
"update-default-config",
"release-commit",
]
run_task = "publish-zellij"
[tasks.release-commit]
dependencies = ["commit-all", "tag-release"]
command = "git"
args = ["push", "--atomic", "origin", "main", "v${CARGO_MAKE_CRATE_VERSION}"]
[tasks.commit-all]
ignore_errors = true
dependencies = ["plugins-release"]
command = "git"
args = ["commit", "-aem", "chore(release): v${CARGO_MAKE_CRATE_VERSION}"]
[tasks.tag-release]
command = "git"
args = ["tag", "--annotate", "--message", "Version ${CARGO_MAKE_CRATE_VERSION}", "v${CARGO_MAKE_CRATE_VERSION}"]
[tasks.publish-zellij-tile]
ignore_errors = true
dependencies = ["publish-zellij-utils"]
cwd = "zellij-tile"
script = "cargo publish && sleep 15"
[tasks.publish-zellij-client]
ignore_errors = true
dependencies = ["publish-zellij-utils"]
cwd = "zellij-client"
script = "cargo publish && sleep 15"
[tasks.publish-zellij-server]
ignore_errors = true
dependencies = ["publish-zellij-utils"]
cwd = "zellij-server"
script = "cargo publish && sleep 15"
[tasks.publish-zellij-utils]
ignore_errors = true
dependencies = ["publish-zellij-utils"]
cwd = "zellij-utils"
script = "cargo publish && sleep 15"
[tasks.publish-zellij-tile-utils]
ignore_errors = true
cwd = "zellij-tile-utils"
script = "cargo publish && sleep 15"
[tasks.publish-zellij]
dependencies = [
"publish-zellij-utils",
"publish-zellij-tile-utils",
"publish-zellij-tile",
"publish-zellij-client",
"publish-zellij-server",
]
command = "cargo"
args = ["publish"]