cargo-fmt.sh 684 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. here="$(dirname "$0")"
  3. cargo="$(readlink -f "${here}/../cargo")"
  4. if [[ -z $cargo ]]; then
  5. >&2 echo "Failed to find cargo. Mac readlink doesn't support -f. Consider switching
  6. to gnu readlink with 'brew install coreutils' and then symlink greadlink as
  7. /usr/local/bin/readlink."
  8. exit 1
  9. fi
  10. fmt_dirs=(
  11. .
  12. programs/sbf
  13. platform-tools-sdk/cargo-build-sbf/tests/crates/fail
  14. platform-tools-sdk/cargo-build-sbf/tests/crates/noop
  15. storage-bigtable/build-proto
  16. )
  17. for fmt_dir in "${fmt_dirs[@]}"; do
  18. (
  19. manifest_path="$(readlink -f "$here"/../"$fmt_dir"/Cargo.toml)"
  20. set -ex
  21. "$cargo" nightly fmt --all --manifest-path "$manifest_path"
  22. )
  23. done