2022-02-08 14:35:50 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2023-03-22 07:41:40 -07:00
|
|
|
# Finds the version of platform-tools used by this source tree.
|
2022-02-08 14:35:50 -08:00
|
|
|
#
|
|
|
|
# stdout of this script may be eval-ed.
|
|
|
|
#
|
|
|
|
|
|
|
|
here="$(dirname "$0")"
|
|
|
|
|
|
|
|
SBF_TOOLS_VERSION=unknown
|
|
|
|
|
2022-05-24 17:36:12 -07:00
|
|
|
cargo_build_sbf_main="${here}/../sdk/cargo-build-sbf/src/main.rs"
|
|
|
|
if [[ -f "${cargo_build_sbf_main}" ]]; then
|
2023-03-22 07:41:40 -07:00
|
|
|
version=$(sed -e 's/^.*platform_tools_version\s*=\s*String::from("\(v[0-9.]\+\)").*/\1/;t;d' "${cargo_build_sbf_main}")
|
2022-02-08 14:35:50 -08:00
|
|
|
if [[ ${version} != '' ]]; then
|
|
|
|
SBF_TOOLS_VERSION="${version}"
|
|
|
|
else
|
|
|
|
echo '--- unable to parse SBF_TOOLS_VERSION'
|
|
|
|
fi
|
|
|
|
else
|
2022-05-24 17:36:12 -07:00
|
|
|
echo "--- '${cargo_build_sbf_main}' not present"
|
2022-02-08 14:35:50 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo SBF_TOOLS_VERSION="${SBF_TOOLS_VERSION}"
|