forked from tauri-apps/tauri
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcargo-check.sh
executable file
·45 lines (39 loc) · 1.08 KB
/
cargo-check.sh
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
#!/usr/bin/env sh
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
# note: you can pass in the cargo sub-commands used to check manually.
# allowed commands: check, clippy, fmt, test
# default: clippy, fmt, test
# exit the script early if any of the commands return an error
set -e
# set the script arguments if none are found
if [ -z "$*" ]; then
set -- "clippy" "fmt" "test"
fi
# run n+1 times, where n is the amount of mutually exclusive features.
# the extra run is for all the crates without mutually exclusive features.
# as many features as possible are enabled at for each command
run() {
command=$1
shift 1
cargo "$command" --workspace --all-targets --all-features "$@"
}
for command in "$@"; do
case "$command" in
check | test)
run "$command"
;;
clippy)
run clippy -- -D warnings
;;
fmt)
echo "[$command] checking formatting"
cargo +nightly fmt -- --check
;;
*)
echo "[cargo-check.sh] Unknown cargo sub-command: $command"
exit 1
;;
esac
done