Minor Bash improvements Based on output of static analysis tool. https://github.com/koalaman/shellcheck/wiki/SC2166 https://github.com/koalaman/shellcheck/wiki/SC2207 https://github.com/koalaman/shellcheck/wiki/SC2145 https://github.com/koalaman/shellcheck/wiki/SC2001 https://github.com/koalaman/shellcheck/wiki/SC2129 https://github.com/koalaman/shellcheck/wiki/SC2128 https://github.com/koalaman/shellcheck/wiki/SC2004 https://github.com/koalaman/shellcheck/wiki/SC2048 Closes #3162. PiperOrigin-RevId: 160261247
diff --git a/scripts/ci/ci.sh b/scripts/ci/ci.sh index e25f8d5..546c3b4 100755 --- a/scripts/ci/ci.sh +++ b/scripts/ci/ci.sh
@@ -50,15 +50,15 @@ # Get a list of the current files in package form by querying Bazel. files=() for file in $(git diff --name-only ${COMMIT_RANGE} ); do - files+=($(bazel query $file)) - echo $(bazel query $file) + IFS=$'\n' read -r -a files <<< "$(bazel query $file)" + bazel query $file done # Query for the associated buildables buildables=$(bazel query \ --keep_going \ --noshow_progress \ - "kind(.*_binary, rdeps(//..., set(${files[@]})))") + "kind(.*_binary, rdeps(//..., set(${files[*]})))") # Run the tests if there were results if [[ ! -z $buildables ]]; then echo "Building binaries" @@ -68,7 +68,7 @@ tests=$(bazel query \ --keep_going \ --noshow_progress \ - "kind(test, rdeps(//..., set(${files[@]}))) except attr('tags', 'manual', //...)") + "kind(test, rdeps(//..., set(${files[*]}))) except attr('tags', 'manual', //...)") # Run the tests if there were results if [[ ! -z $tests ]]; then echo "Running tests"