Skip to content

Commit 7d180c4

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 b217fe5 commit 7d180c4

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
@@ -59,7 +59,7 @@ main() {
5959
if [ -e "$crates_script" ]; then
6060
verbose_say "Sourcing $crates_script"
6161
. "$crates_script"
62-
for crate in "${CRATES[@]}"; do
62+
for crate in $CRATES; do
6363
verbose_say "Found crate: $crate"
6464
done
6565
else
@@ -106,7 +106,7 @@ main() {
106106

107107
# Build and test for each crate, done with each toolchain.
108108
build_and_test() {
109-
for crate in "${CRATES[@]}"; do
109+
for crate in $CRATES; do
110110
local test_vars_script="$REPO_DIR/$crate/contrib/test_vars.sh"
111111

112112
# Clean variables and also make sure they are defined.
@@ -279,7 +279,7 @@ build_docs_with_stable_toolchain() {
279279
do_bench() {
280280
verbose_say "Running bench tests for: $CRATES"
281281

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

0 commit comments

Comments
 (0)