Skip to content

Commit

Permalink
Enable usage of machine set CRATES var
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tcharding committed Aug 21, 2024
1 parent 1023780 commit b249949
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ci/run_task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ main() {
if [ -e "$crates_script" ]; then
verbose_say "Sourcing $crates_script"
. "$crates_script"
for crate in "${CRATES[@]}"; do
for crate in $CRATES; do
verbose_say "Found crate: $crate"
done
else
Expand Down Expand Up @@ -109,7 +109,7 @@ main() {

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

# Clean variables and also make sure they are defined.
Expand Down Expand Up @@ -282,7 +282,7 @@ build_docs_with_stable_toolchain() {
do_bench() {
verbose_say "Running bench tests for: $CRATES"

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

0 comments on commit b249949

Please sign in to comment.