Skip to content

Commit 534e497

Browse files
committed
Enable usage of machine set CRATES var
Repos using the `run_task` script would like to set the `CRATES` env var by using CRATES="$(cargo metadata --no-deps --format-version 1 | jq -j -r '.packages | map(.manifest_path | rtrimstr("/Cargo.toml") | ltrimstr("'"$PWD"'/")) | join(" ")')" I don't know exactly why but this results in some sort of square braces data type that seems to only work in a loop using `for crate in $CRATES` instead of the `for crate in ${CRATES[@]}` like we currently have.
1 parent 0f235e0 commit 534e497

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ci/run_task.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ main() {
6464
# can't find the file because of the ENV var
6565
# shellcheck source=/dev/null
6666
. "$crates_script"
67-
for crate in "${CRATES[@]}"; do
67+
for crate in $CRATES; do
6868
verbose_say "Found crate: $crate"
6969
done
7070
else
@@ -111,7 +111,7 @@ main() {
111111

112112
# Build and test for each crate, done with each toolchain.
113113
build_and_test() {
114-
for crate in "${CRATES[@]}"; do
114+
for crate in $CRATES; do
115115
local test_vars_script="$REPO_DIR/$crate/contrib/test_vars.sh"
116116

117117
# Clean variables and also make sure they are defined.
@@ -287,7 +287,7 @@ build_docs_with_stable_toolchain() {
287287
do_bench() {
288288
verbose_say "Running bench tests for: $CRATES"
289289

290-
for crate in "${CRATES[@]}"; do
290+
for crate in $CRATES; do
291291
pushd "$REPO_DIR/$crate" > /dev/null
292292
# Unit tests are ignored so if there are no bench test then this will just succeed.
293293
RUSTFLAGS='--cfg=bench' cargo bench

0 commit comments

Comments
 (0)