-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile.toml
252 lines (211 loc) · 6.52 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
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = 1
RUSTDOCFLAGS = { value = "", condition = { env_not_set = ["RUSTDOCFLAGS"] } }
NIGHTLY = { script = ["cat rust-nightly.txt"], condition = { env_not_set = ["NIGHTLY"] } }
RUSTFLAGS = { value = "-Dwarnings", condition = { env_true = ["CARGO_MAKE_CI"] } }
[config]
default_to_workspace = false
skip_core_tasks = true
skip_git_env_info = true
skip_rust_env_info = true
[tasks.default]
description = "List tasks"
script = "cargo make --quiet --list-all-steps --hide-uninteresting"
# Build
[tasks.build-code]
category = "build"
description = "Build Code"
command = "cargo"
args = ["build", "--verbose", "--release", "${@}"]
[tasks.tgz-daemon]
category = "build"
description = "Archive daemon"
script = "tar -czf aranya-daemon.tar.gz -C target/release aranya-daemon"
# Build the `aranya-client-capi` C API.
[tasks.build-capi]
category = "build"
description = "Build C API"
run_task = { name = [
"build-capi-header",
"build-capi-docs",
"build-capi-lib",
] }
# Build the `aranya-client-capi` C API `aranya-client.h` header file.
[tasks.build-capi-header]
category = "build"
description = "Build C API header"
toolchain = "${NIGHTLY}"
cwd = "crates/aranya-client-capi"
command = "cbindgen"
args = ["--config=cbindgen.toml", "--output=output/aranya-client.h"]
dependencies = ["install-cbindgen", "install-nightly"]
[tasks.build-capi-docs]
category = "build"
description = "Build C API docs"
cwd = "crates/aranya-client-capi"
command = "doxygen"
[tasks.tgz-capi-docs]
category = "docs"
description = "Archive capi docs"
script = "tar -cvzf aranya-client-capi-docs.tar.gz -C crates/aranya-client-capi/docs ."
[tasks.build-capi-lib]
category = "build"
description = "Build C API shared library"
cwd = "crates/aranya-client-capi"
command = "cargo"
args = ["build", "--release"]
dependencies = ["install-nightly"]
[tasks.tgz-capi]
category = "build"
description = "Archive C API artifacts"
script = '''
#!/usr/bin/env bash
capi="$(mktemp -d)"
mkdir -p "${capi}/"{lib,cmake,include}
ls target/release/libaranya_client*
cp target/release/libaranya_client_capi.dylib "${capi}"/lib/ || cp target/release/libaranya_client_capi.so "${capi}"/lib/
ls "${capi}"/lib
cp examples/c/cmake/AranyaConfig.cmake "${capi}"/cmake/
cp crates/aranya-client-capi/output/aranya-client.h "${capi}"/include/
tar -cvzf aranya-client-lib.tar.gz -C "${capi}" .
'''
[tasks.install-cbindgen]
private = true
install_crate = { crate_name = "cbindgen", version = "0.27.0", binary = "cbindgen", test_arg = "-V" }
# Test
[tasks.unit-tests]
category = "test"
description = "Run Unit Tests"
workspace = true
command = "cargo"
args = ["--verbose", "test-all-features", "${@}"]
dependencies = ["install-cargo-all-features"]
# Security
[tasks.security]
category = "security"
description = "Run security checks"
run_task = { name = [
"cargo-audit",
"cargo-deny",
"cargo-vet",
] }
[tasks.cargo-audit]
category = "security"
install_crate = { crate_name = "cargo-audit", version = "0.21.0", binary = "cargo-audit", test_arg = "-V" }
command = "cargo"
args = ["audit"]
[tasks.cargo-deny]
category = "security"
install_crate = { crate_name = "cargo-deny", version = "0.16.3", binary = "cargo-deny", test_arg = "-V" }
command = "cargo"
args = ["deny", "check"]
[tasks.cargo-vet]
category = "security"
install_crate = { crate_name = "cargo-vet", version = "0.10.0", binary = "cargo-vet", test_arg = "-V" }
command = "cargo"
args = ["vet", "check"]
# Correctness
[tasks.correctness]
category = "correctness"
description = "Run correctness checks"
run_task = { name = [
"fmt",
"check-features",
"clippy",
"machete",
] }
[tasks.check-fmt]
dependencies = ["check-fmt-rust", "check-fmt-toml"]
description = "Check file formatting"
[tasks.fmt]
dependencies = ["fmt-rust", "fmt-toml"]
description = "Format files"
[tasks.check-fmt-rust]
category = "correctness"
description = "Check rust code formatting"
toolchain = "${NIGHTLY}"
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
dependencies = ["install-nightly"]
[tasks.fmt-rust]
category = "correctness"
description = "Format rust code"
toolchain = "${NIGHTLY}"
command = "cargo"
args = ["fmt", "--all"]
dependencies = ["install-nightly"]
[tasks.check-fmt-toml]
category = "correctness"
description = "Check toml formatting"
script = "git ls-files -z '*.toml' | xargs -0 -- taplo fmt --check --diff"
dependencies = ["install-taplo"]
[tasks.fmt-toml]
category = "correctness"
description = "Format toml"
script = "git ls-files -z '*.toml' | xargs -0 taplo fmt"
dependencies = ["install-taplo"]
[tasks.install-taplo]
private = true
install_crate = { crate_name = "taplo-cli", version = "0.9.0", binary = "taplo", test_arg = ["-V"] }
[tasks.check-features]
category = "correctness"
description = "Check features"
workspace = true
command = "cargo"
args = ["--verbose", "check-all-features"]
dependencies = ["install-cargo-all-features"]
[tasks.clippy]
category = "correctness"
description = "Run clippy to lint code"
workspace = true
script = '''
cargo clippy
cargo clippy --all-targets
cargo clippy --no-default-features
cargo clippy --all-targets --all-features
'''
install_crate = { rustup_component_name = "clippy" }
[tasks.machete]
command = "cargo"
args = ["machete"]
install_crate = { crate_name = "cargo-machete", version = "0.6.2", binary = "cargo-machete", test_arg = "--version" }
# Docs
[tasks.gen-docs-nightly]
category = "docs"
description = "Generate docs with rust nightly"
toolchain = "${NIGHTLY}"
env = { RUSTDOCFLAGS = "--cfg docs ${RUSTDOCFLAGS}" }
command = "cargo"
args = ["doc", "--all-features"]
dependencies = ["install-nightly"]
[tasks.tgz-docs]
category = "docs"
description = "Archive Rust docs"
script = "tar -czf rust-docs.tar.gz -C target/doc ."
# Misc
[tasks.install-nightly]
description = "Install nightly rust"
# First check if the toolchain is installed, because that is much faster.
# Don't do this if you want to keep a rolling channel up-to-date.
script = "rustup run ${NIGHTLY} true 2>/dev/null || rustup toolchain install ${NIGHTLY} --profile minimal -c rustfmt"
[tasks.git-unchanged]
description = "Verify files are unchanged"
script = '''
git diff
status=$(git status -s)
if [ -n "$status" ]; then
echo "$status"
exit 1
fi
'''
[tasks.install-cargo-all-features]
private = true
install_crate = { crate_name = "cargo-all-features", version = "1.10.0", binary = "cargo-check-all-features", test_arg = ["-V"] }
# Examples
# C Example
[tasks.run-capi-example]
category = "examples"
description = "Run C example application"
cwd = "examples/c"
script = "./run.bash"
dependencies = ["build-capi-header", "build-capi-lib"]