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
version: '3'
vars:
PROFILE: '{{ .PROFILE | default "debug" }}'
PROFILE_FLAG: '{{ if eq .PROFILE "release" }}--release{{ end }}'
# Extra cargo flags, e.g. FEATURES="--features process-detection" or "--all-features".
FEATURES: '{{ .FEATURES | default "" }}'
tasks:
default:
cmds:
- task --list --sort=none
silent: true
build:
desc: Compile the crate (PROFILE=debug|release, FEATURES="--all-features")
aliases:
preconditions:
- sh: command -v cargo
msg: "cargo not found - install Rust from https://rustup.rs/"
cmds:
- cargo build --all-targets {{.PROFILE_FLAG}} {{.FEATURES}} {{.CLI_ARGS}}
run:
desc: Run the `detect` example
aliases:
preconditions:
- sh: command -v cargo
msg: "cargo not found - install Rust from https://rustup.rs/"
cmds:
- cargo run --example detect {{.PROFILE_FLAG}} {{.FEATURES}} {{.CLI_ARGS}}
test:
desc: Run the test suite (pass extra args after --)
aliases:
preconditions:
- sh: command -v cargo
msg: "cargo not found - install Rust from https://rustup.rs/"
cmds:
- cargo test --all-targets {{.FEATURES}} {{.CLI_ARGS}}
- cargo test --doc {{.FEATURES}}
fmt:
desc: Format code with rustfmt
aliases:
preconditions:
- sh: command -v cargo
msg: "cargo not found - install Rust from https://rustup.rs/"
cmds:
- cargo fmt --all
lint:
desc: Lint with clippy (deny warnings)
preconditions:
- sh: command -v cargo-clippy
msg: "clippy not found - rustup component add clippy"
cmds:
- cargo clippy --all-targets {{.FEATURES}} {{.CLI_ARGS}} -- -D warnings
lint:fix:
desc: Lint with clippy and auto-apply fixes
aliases:
preconditions:
- sh: command -v cargo-clippy
msg: "clippy not found - rustup component add clippy"
cmds:
- cargo clippy --fix --allow-dirty --allow-staged --all-targets {{.FEATURES}}
docs:
desc: Build API docs
preconditions:
- sh: command -v cargo
msg: "cargo not found - install Rust from https://rustup.rs/"
cmds:
- cargo doc --no-deps {{.FEATURES}}
docs:open:
desc: Build API docs and open in browser
preconditions:
- sh: command -v cargo
msg: "cargo not found - install Rust from https://rustup.rs/"
cmds:
- cargo doc --no-deps --open {{.FEATURES}}
check:
desc: All static checks - fmt check + clippy (both feature sets)
cmds:
- cargo fmt --all -- --check
- cargo clippy --all-targets -- -D warnings
- cargo clippy --all-targets --all-features -- -D warnings
ci:
desc: Full CI sequence - static checks + tests (both feature sets)
cmds:
- task: check
- cargo test --all-targets
- cargo test --all-targets --all-features
- cargo test --doc --all-features
clean:
desc: Remove build output
status:
- test ! -d target
cmds:
- cargo clean