platform-tools-info.sh 681 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. #
  3. # Finds the version of platform-tools used by this source tree.
  4. #
  5. # stdout of this script may be eval-ed.
  6. #
  7. here="$(dirname "$0")"
  8. SBF_TOOLS_VERSION=unknown
  9. cargo_build_sbf_main="${here}/../platform-tools-sdk/cargo-build-sbf/src/toolchain.rs"
  10. if [[ -f "${cargo_build_sbf_main}" ]]; then
  11. version=$(sed -e 's/^.*DEFAULT_PLATFORM_TOOLS_VERSION.*=\s*"\(v[0-9.]\+\)".*/\1/;t;d' "${cargo_build_sbf_main}")
  12. if [[ ${version} != '' ]]; then
  13. SBF_TOOLS_VERSION="${version}"
  14. else
  15. echo '--- unable to parse SBF_TOOLS_VERSION'
  16. fi
  17. else
  18. echo "--- '${cargo_build_sbf_main}' not present"
  19. fi
  20. echo SBF_TOOLS_VERSION="${SBF_TOOLS_VERSION}"