Skip to content

Commit 6e76b13

Browse files
committed
Add an arg to run task on single crate
1 parent 5688089 commit 6e76b13

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ci/run_task.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ usage() {
3030
cat <<EOF
3131
Usage:
3232
33-
./run_task.sh TASK
33+
./run_task.sh TASK [CRATE]
3434
3535
TASK
3636
- stable Run tests with stable toolchain.
@@ -41,6 +41,10 @@ TASK
4141
- docsrs Build docs with nightly toolchain.
4242
- bench Run the bench tests.
4343
44+
CRATE (optional)
45+
- If provided, run the task only on the specified crate.
46+
- If not provided, run the task on all crates from contrib/crates.sh.
47+
4448
Environment Variables:
4549
MAINTAINER_TOOLS_LOG_LEVEL Control script and cargo output verbosity.
4650
verbose (default) Show all script and cargo messages.
@@ -50,6 +54,7 @@ EOF
5054

5155
main() {
5256
local task="${1:-usage}"
57+
local single_crate="${2:-}"
5358
local crates_script="$REPO_DIR/contrib/crates.sh"
5459

5560
# FIXME: This is a hackish way to get the help flag.
@@ -70,9 +75,13 @@ main() {
7075
fi
7176

7277
verbose_say "Repository: $REPO_DIR"
73-
verbose_say "Script invocation: $0 $task"
78+
verbose_say "Script invocation: $0 $task $single_crate"
7479

75-
if [ -e "$crates_script" ]; then
80+
# Override crates.sh if there is a crate arg.
81+
if [ -n "$single_crate" ]; then
82+
verbose_say "Using single crate: $single_crate"
83+
CRATES="$single_crate"
84+
elif [ -e "$crates_script" ]; then
7685
verbose_say "Sourcing $crates_script"
7786
# can't find the file because of the ENV var
7887
# shellcheck source=/dev/null

0 commit comments

Comments
 (0)