-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathMakefile.toml
More file actions
345 lines (291 loc) · 10.9 KB
/
Makefile.toml
File metadata and controls
345 lines (291 loc) · 10.9 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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# NOTE: This file is automatically synchronized from Patina DevOps. Update the original file there
# instead of the file in this repo.
#
# - Patina DevOps Repo: https://github.com/OpenDevicePartnership/patina-devops
# - File Sync Settings: https://github.com/OpenDevicePartnership/patina-devops/blob/main/.sync/Files.yml
[config]
default_to_workspace = false
[env]
NO_STD_FLAGS = "--profile ${RUSTC_PROFILE} -Zbuild-std=core,compiler_builtins,alloc -Zbuild-std-features=compiler-builtins-mem -Zunstable-options --timings"
STD_FLAGS = "--profile ${RUSTC_PROFILE} --features std"
COV_FLAGS = { value = "--workspace --profile test --ignore-filename-regex .*test.*", condition = { env_not_set = ["COV_FLAGS"] } }
RUSTDOCFLAGS = "-D warnings -D missing_docs"
[env.development]
RUSTC_PROFILE = "dev"
[env.release]
RUSTC_PROFILE = "release"
[tasks.individual-package-targets]
script_runner = "@duckscript"
script = '''
args = get_env CARGO_MAKE_TASK_ARGS
if is_empty ${args}
exit
end
1 = array ""
2 = split ${args} ,
3 = array_concat ${1} ${2}
joined_args = array_join ${3} " -p "
release ${1}
release ${2}
release ${3}
joined_args = trim ${joined_args}
set_env INDIVIDUAL_PACKAGE_TARGETS ${joined_args}
release ${joined_args}
'''
[tasks.build]
description = """Builds a single rust package with the standard library.
Customizations:
-p [development|release]: Builds in debug or release. Default: development
-e FEATURES=[feature,...]: Builds with the specified features. Default: none
Example:
`cargo make build`
`cargo make -p release build`
`cargo make -e FEATURES=feature1,feature2 build`
"""
alias = "build-std"
[tasks.build-std]
description = """Builds crates in the repository with the standard library, and their examples.
Customizations:
-p [development|release]: Builds in debug or release. Default: development
-e FEATURES=[feature,...]: Builds with the specified features. Default: none
Example:
`cargo make build-std`
`cargo make -p release build-std`
`cargo make build-std <package_name>`
"""
clear = true
command = "cargo"
args = ["build", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(STD_FLAGS, )", "--examples"]
dependencies = ["individual-package-targets", "build-lib"]
[tasks.build-lib]
description = """Builds crates in the repository with the standard library.
Customizations:
-p [development|release]: Builds in debug or release. Default: development
-e FEATURES=[feature,...]: Builds with the specified features. Default: none
Example:
`cargo make build-lib`
`cargo make -p release build-lib`
`cargo make build-lib <package_name>`
"""
clear = true
command = "cargo"
args = ["build", "--all-features", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(STD_FLAGS, )"]
dependencies = ["individual-package-targets"]
[tasks.run-bin]
description = """Runs the standard library DXE core.
Example:
`cargo make run-bin`
`cargo make -p release run-bin`
"""
clear = true
command = "cargo"
args = ["run", "@@split(STD_FLAGS, )", "--example", "dxe_core_std"]
[tasks.build-bin]
description = """Builds the standard library DXE core.
Customizations:
-p [development|release]: Builds in debug or release. Default: development
Example:
`cargo make build-bin`
`cargo make -p release build-bin`
"""
clear = true
command = "cargo"
args = ["build", "@@split(STD_FLAGS, )", "--example", "dxe_core_std"]
[tasks.check_code]
description = "Checks rust code for no_std build errors with results."
private = true
command = "cargo"
args = ["check", "--all-targets", "--all-features", "@@split(CARGO_MAKE_TASK_ARGS, )"]
[tasks.check_tests]
description = "Checks rust test code for build errors with results."
private = true
command = "cargo"
args = ["test", "--no-run", "--all-targets", "--all-features", "@@split(CARGO_MAKE_TASK_ARGS, )"]
[tasks.check-no-default-features-code]
description = "Checks rust code compiles without default features."
private = true
command = "cargo"
args = ["check", "--no-default-features", "@@split(CARGO_MAKE_TASK_ARGS, )"]
[tasks.check-no-default-features-tests]
description = "Checks rust test code compiles without default features."
private = true
command = "cargo"
args = ["test", "--no-run", "--no-default-features", "@@split(CARGO_MAKE_TASK_ARGS, )"]
[tasks.check-no-default-features]
description = "Checks rust code and tests compile without default features to catch feature-gate regressions."
clear = true
run_task = [{ name = ["check-no-default-features-code", "check-no-default-features-tests"], parallel = true }]
[tasks.check]
description = "Checks rust code for errors. Example `cargo make check`"
clear = true
run_task = [{ name = ["check_code", "check_tests"], parallel = true }]
[tasks.patina-test]
description = "Builds crates with Patina tests enabled. Example `cargo make patina-test`"
clear = true
command = "cargo"
args = ["build", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(STD_FLAGS, )", "--features", "test-runner"]
dependencies = ["individual-package-targets"]
[tasks.generate-lockfile]
description = "Generate Cargo.lock file."
private = true
command = "cargo"
args = ["generate-lockfile"]
[tasks.llvm-cov-clean]
description = "Clean coverage data"
private = true
install_crate = false
command = "cargo"
args = ["llvm-cov", "clean", "--workspace"]
[tasks.test]
description = "Runs tests with native cargo test behavior. Example `cargo make test` or `cargo make test -p package_name -- --nocapture`"
clear = true
command = "cargo"
args = ["test", "@@split(CARGO_MAKE_TASK_ARGS,;)"]
[tasks.test-cov]
description = "Run tests and collect coverage data without generating reports."
install_crate = false
clear = true
command = "cargo"
args = ["llvm-cov", "@@split(COV_FLAGS, )", "--no-report", "--doctests"]
dependencies = ["individual-package-targets", "llvm-cov-clean"]
[tasks.test-asan]
description = "Run tests with AddressSanitizer enabled. Example `cargo make test-asan`. Use `cargo make test-asan --print-dll-path` to print the ASan runtime DLL directory."
clear = true
script_runner = "@duckscript"
script = '''
os = os_family
if eq ${os} "windows"
# ASan testing is only supported on Windows x64.
# https://learn.microsoft.com/cpp/sanitizers/asan
arch = get_env PROCESSOR_ARCHITECTURE
if not eq ${arch} "AMD64"
echo "test-asan is only supported on Windows x64. Detected arch: ${arch}. Skipping."
exit 0
end
# The ASan runtime DLL (clang_rt.asan_dynamic-x86_64.dll) from the
# MSVC toolchain must be on PATH for ASan-instrumented test binaries to run.
#
# Resolve the VC toolset path per vswhere docs:
# https://github.com/microsoft/vswhere/wiki/Find-VC
program_files_x86 = get_env "ProgramFiles(x86)"
vswhere = set "${program_files_x86}/Microsoft Visual Studio/Installer/vswhere.exe"
output = exec "${vswhere}" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
install_dir = trim ${output.stdout}
version = readfile "${install_dir}/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt"
version = trim ${version}
asan_dll_path = set "${install_dir}/VC/Tools/MSVC/${version}/bin/HostX64/x64"
args = get_env CARGO_MAKE_TASK_ARGS
if contains "${args}" "--print-dll-path"
asan_dll_path = replace ${asan_dll_path} / \\
echo "${asan_dll_path}"
exit 0
end
current_path = get_env PATH
set_env PATH "${asan_dll_path};${current_path}"
elseif eq ${os} "linux"
# On Linux, the ASan runtime is resolved automatically by the linker.
noop
else
echo "test-asan is not supported on ${os}. Skipping."
exit 0
end
set_env RUSTFLAGS "-Zsanitizer=address"
set_env RUSTDOCFLAGS "-Zsanitizer=address"
target = get_env CARGO_MAKE_RUST_TARGET_TRIPLE
exec --fail-on-error cargo test --target ${target} --workspace --features std
'''
[tasks.coverage-lcov]
description = "Generate an LCOV coverage report from collected data."
install_crate = false
clear = true
command = "cargo"
args = ["llvm-cov", "report", "--lcov", "--output-path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/lcov.info"]
[tasks.coverage-html]
description = "Generate an HTML coverage report from collected data."
install_crate = false
clear = true
command = "cargo"
args = ["llvm-cov", "report", "--html", "--output-dir", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/coverage"]
[tasks.coverage]
description = "Build and run all tests and calculate coverage (runs test once and generates LCOV and HTML reports)."
dependencies = ["test-cov", "coverage-lcov", "coverage-html"]
clear = true
[tasks.build-aarch64]
description = "Builds crates in the repository for AARCH64"
clear = true
command = "cargo"
args = ["build", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "--target", "aarch64-unknown-uefi", "@@split(NO_STD_FLAGS, )", ]
dependencies = ["individual-package-targets"]
[tasks.build-x64]
description = "Builds crates in the repository for X64"
clear = true
command = "cargo"
args = ["build", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "--target", "x86_64-unknown-uefi", "@@split(NO_STD_FLAGS, )", ]
dependencies = ["individual-package-targets"]
[tasks.doc]
description = "Builds all rust documentation in the workspace. Example `cargo make doc`"
command = "cargo"
args = ["doc", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "--features", "doc", "--no-deps"]
[tasks.doc-open]
description = "Builds all rust documentation in the workspace and opens the documentation. Example `cargo make doc-open`"
clear = true
command = "cargo"
args = ["doc", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "--features", "doc", "--open"]
[tasks.clippy]
description = "Run cargo clippy."
clear = true
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
[tasks.fmt]
description = "Run cargo format."
clear = true
command = "cargo"
args = ["fmt", "--all"]
[tasks.fmt-check]
description = "Check cargo format without modifying files."
clear = true
command = "cargo"
args = ["fmt", "--all", "--check"]
[tasks.doc-test]
description = "Run documentation tests."
clear = true
command = "cargo"
args = ["test", "--doc"]
[tasks.cspell]
description = "Run cspell for spell checking." # npm install -g cspell@latest
script = "cspell --quiet --no-progress --no-summary --dot --gitignore -e \"{.git/**,.github/**,.vscode/**}\" ."
[tasks.deny]
description = "Run cargo deny."
install_crate = false
clear = true
command = "cargo"
args = ["deny", "check"]
[tasks.bench]
description = "Run cargo bench."
clear = true
command = "cargo"
args = ["bench", "@@split(CARGO_MAKE_TASK_ARGS,;)"]
[tasks.vet]
description = "Run cargo vet."
install_crate = false
clear = true
dependencies = ["generate-lockfile"]
command = "cargo"
args = ["vet", "--locked"]
ignore_errors = false
[tasks.all]
description = "Run all tasks for PR readiness."
dependencies = [
"fmt-check",
"deny",
"cspell",
"clippy",
"check-no-default-features",
"build",
"build-x64",
"build-aarch64",
"patina-test",
"coverage",
"doc-test",
"doc",
]