-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile.toml
More file actions
315 lines (279 loc) · 8.43 KB
/
Makefile.toml
File metadata and controls
315 lines (279 loc) · 8.43 KB
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
[config]
default_to_workspace = false
skip_core_tasks = true
skip_git_env_info = true
modify_core_tasks = { private = true, namespace = "default" }
init_task = "init"
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CARGO_VERBOSE_FLAGS = { source = "${CARGO_MAKE_CI}", default_value = "", mapping = { "true" = "--verbose" } }
CARGO_MAKE_RUST_SCRIPT_PROVIDER = "rust-script"
CARGO_MAKE_USE_WORKSPACE_PROFILE = true
CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "--no-fail-fast"
CARGO_TARGET_DIR = { value = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
BACKTRACE_DEFAULT = { source = "${CARGO_MAKE_CI}", mapping = { "true" = "1", "false" = "0" } }
RUST_BACKTRACE = { value = "${BACKTRACE_DEFAULT}", condition = { env_not_set = [
"RUST_BACKTRACE",
] } }
LOCAL_BIN_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/bin"
LOCAL_INSTALL_DIR = "${LOCAL_BIN_DIR}/${CARGO_MAKE_RUST_TARGET_TRIPLE}"
# Workaround for https://github.com/0xMiden/miden-vm/issues/2025
RUST_MIN_STACK = 16777216
[env.development]
MIDEN_DEBUG_BUILD_PROFILE = "debug"
[env.production]
MIDEN_DEBUG_BUILD_PROFILE = "release"
[tasks.init]
script_runner = "@duckscript"
script = '''
args = split ${CARGO_MAKE_TASK_ARGS} ";"
while not array_is_empty ${args}
next_arg = array_get ${args} 0
if starts_with ${next_arg} "--target"
echo "found target"
target_arg = array_get ${args} 1
CARGO_TARGET_ARG = trim ${target_arg}
array_clear ${args}
else
array_remove ${args} 0
end
end
if ${CARGO_TARGET_ARG}
set_env CARGO_ARTIFACT_DIR "${CARGO_TARGET_DIR}/${CARGO_TARGET_ARG}/${MIDEN_DEBUG_BUILD_PROFILE}"
else
set_env CARGO_ARTIFACT_DIR "${CARGO_TARGET_DIR}/${MIDEN_DEBUG_BUILD_PROFILE}"
end
cm_run_task print-env
'''
[tasks.default]
category = "Build"
description = "Default task builds the debugger"
alias = "build"
[tasks.print-env]
category = "Tools"
run_task = [
{ name = [
"print-build-env",
"print-ci-env",
"print-rust-env",
"print-cargo-env",
] },
]
[tasks.print-build-env]
private = true
script = ['''
#!@duckscript
echo "*************************************"
echo "Build Environment:"
echo " Task: ${CARGO_MAKE_TASK}"
echo " Task Arguments: ${CARGO_MAKE_TASK_ARGS}"
echo " Command: ${CARGO_MAKE_COMMAND}"
echo " Working Directory: ${CARGO_MAKE_WORKING_DIRECTORY}"
echo " Target Directory: ${CARGO_TARGET_DIR}"
echo " Profile: ${CARGO_MAKE_PROFILE}"
echo " Cargo Artifact Directory: ${CARGO_ARTIFACT_DIR}"
echo " Bin Directory: ${LOCAL_BIN_DIR}"
echo " Install Directory: ${LOCAL_INSTALL_DIR}"
echo " Target Triple: ${CARGO_MAKE_RUST_TARGET_TRIPLE}"
echo " RUST_BACKTRACE: ${RUST_BACKTRACE}"
echo "*************************************"
''']
[tasks.print-ci-env]
private = true
condition = { env = { "CARGO_MAKE_CI" = "true" } }
script = ['''
#!@duckscript
echo "*************************************"
echo "CI:"
echo " CI: ${CARGO_MAKE_CI}"
echo " PR: ${CARGO_MAKE_PR}"
echo " Branch Name: ${CARGO_MAKE_CI_BRANCH_NAME}"
echo " CI Vendor: ${CARGO_MAKE_CI_VENDOR}"
echo "*************************************"
''']
[tasks.print-rust-env]
category = "Tools"
condition = { env_set = ["CARGO_MAKE_RUST_CHANNEL"] }
script = ['''
#!@duckscript
output = exec --fail-on-error rustc "--version"
assert_eq ${output.code} 0
rustc_version_parts = split ${output.stdout} " "
hash_raw = array_get ${rustc_version_parts} 2
hash = replace ${hash_raw} "(" ""
date_raw = array_get ${rustc_version_parts} 3
date = replace ${date_raw} ")\n" ""
release ${rustc_version_parts}
echo "*************************************"
echo "Rust:"
echo " Version: ${CARGO_MAKE_RUST_VERSION}"
echo " Channel: ${CARGO_MAKE_RUST_CHANNEL}"
echo " Build Hash: ${hash}"
echo " Build Date: ${date}"
echo " Target Arch: ${CARGO_MAKE_RUST_TARGET_ARCH}"
echo " Target Env: ${CARGO_MAKE_RUST_TARGET_ENV}"
echo " Target OS: ${CARGO_MAKE_RUST_TARGET_OS}"
echo " Pointer Width: ${CARGO_MAKE_RUST_TARGET_POINTER_WIDTH}"
echo " Target Triple: ${CARGO_MAKE_RUST_TARGET_TRIPLE}"
echo "*************************************"
''']
[tasks.print-cargo-env]
category = "Tools"
condition = { env_set = ["CARGO_MAKE_CARGO_HOME"] }
script = ['''
#!@duckscript
echo "*************************************"
echo "Cargo:"
echo " Home: ${CARGO_MAKE_CARGO_HOME}"
echo " Profile: ${CARGO_MAKE_CARGO_PROFILE}"
echo "*************************************"
''']
[tasks.format]
category = "Development"
dependencies = ["format-rust"]
[tasks.check-format]
description = "Runs cargo fmt to check appropriate code format."
category = "Test"
command = "cargo"
args = ["fmt", "--", "--check"]
dependencies = ["install-rustfmt"]
[tasks.format-rust]
category = "Development"
description = "Formats source code (Rust)"
command = "cargo"
toolchain = "nightly"
args = ["fmt"]
dependencies = ["install-rustfmt"]
[tasks.install-rustfmt]
category = "Development"
description = "Installs cargo rustfmt plugin."
env.CFG_RELEASE = { value = "${CARGO_MAKE_RUST_VERSION}", condition = { env_not_set = [
"CFG_RELEASE",
] } }
env.CFG_RELEASE_CHANNEL = { value = "${CARGO_MAKE_RUST_CHANNEL}", condition = { env_not_set = [
"CFG_RELEASE_CHANNEL",
] } }
install_crate = { crate_name = "rustfmt-nightly", rustup_component_name = "rustfmt", binary = "rustfmt", test_arg = "--help" }
[tasks.bloat]
category = "Development"
description = "Run cargo-bloat"
command = "cargo"
args = ["bloat", "${@}"]
[tasks.miden-debug]
category = "Build"
description = "Builds miden-debug and installs it to the bin folder"
run_task = [{ name = ["build", "install-miden-debug-locally"]}]
[tasks.build]
category = "Build"
description = "Runs cargo build on the workspace"
command = "cargo"
args = ["build", "--lib", "--bins", "${@}"]
[tasks.install]
category = "Install"
description = "Installs the debugger via cargo"
run_task = [{ name = ["install-miden-debug"] }]
[tasks.install-miden-debug]
category = "Install"
description = "Builds miden-debug and installs it globally via the cargo bin directory"
command = "cargo"
args = [
"install",
"--locked",
"--force",
"--bin",
"miden-debug",
"${@}"
]
[tasks.install-miden-debug-locally]
category = "Install"
description = "miden-debug and installs it globally via the cargo bin directory"
private = true
script_runner = "@duckscript"
script = '''
mkdir ${LOCAL_BIN_DIR}
src = concat ${CARGO_ARTIFACT_DIR} "/miden-debug"
dst = concat ${LOCAL_BIN_DIR} "/miden-debug"
cp ${src} ${dst}
'''
[tasks.check]
category = "Build"
description = "Runs cargo check on the workspace"
command = "cargo"
args = ["check", "${@}"]
[tasks.check-each]
category = "Build"
description = "Runs cargo check on each member of the workspace independently"
workspace = true
command = "cargo"
args = ["check", "${@}"]
[tasks.clean]
category = "Build"
description = "Clean build artifacts"
command = "cargo"
args = ["clean", "${@}"]
[tasks.update]
category = "Dependencies"
description = "Update dependencies to latest semver-compatible version"
command = "cargo"
args = ["update"]
[tasks.outdated]
category = "Dependencies"
description = "Look for dependencies with newer, possibly-incompatible versions"
command = "cargo"
args = ["outdated", "--workspace", "--root-deps-only"]
[tasks.check-deps]
category = "Dependencies"
description = "Check dependencies for lack of use, duplicates, vulnerabilities, etc."
run_task = [
{ name = [
"unused",
"duplicates",
"audit",
] },
]
[tasks.unused]
category = "Dependencies"
description = "Check for unused dependencies"
command = "cargo"
args = ["machete", "--with-metadata"]
[tasks.duplicates]
category = "Dependencies"
description = "Check dependencies for multiple versions of the same crate"
command = "cargo"
args = ["tree", "--duplicate"]
[tasks.audit]
category = "Dependencies"
description = "Check dependencies for known vulnerabilities, deprecations"
command = "cargo"
args = ["audit"]
[tasks.test]
category = "Test"
description = "Runs all tests including integration node tests"
dependencies = ["test-rust"]
[tasks.test-rust]
category = "Test"
description = "Runs tests written in Rust"
command = "cargo"
args = [
"nextest",
"run",
"@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)",
"@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )",
"${@}",
]
[tasks.clippy]
description = "Runs clippy on the workspace"
category = "Development"
command = "cargo"
args = [
"clippy",
"--all",
"--all-targets",
"--",
"-D",
"clippy::all",
"-D",
"warnings",
]