From 5b09c615c91aae97793803bdc8270ac5630c7eaa Mon Sep 17 00:00:00 2001 From: devqore Date: Sun, 22 Oct 2023 17:42:37 +0200 Subject: [PATCH] Improve error message with rustup not found (#1659) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve error message with rustup not found * Improve error message with rustup not found on the mobile devices * Fix `err` function in setup.sh Fix `err` function printing repeated error lines --------- Co-authored-by: VĂ­tor Vasconcellos --- scripts/setup.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index dcf851dbd..e04a793e1 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -8,7 +8,7 @@ fi err() { for _line in "$@"; do - echo "$@" >&2 + echo "$_line" >&2 done exit 1 } @@ -52,7 +52,7 @@ if [ "${CI:-}" != "true" ]; then 'https://pnpm.io/installation' fi - if ! has rustup rustc cargo; then + if ! has rustc cargo; then err 'Rust was not found.' \ "Ensure the 'rustc' and 'cargo' binaries are in your \$PATH." \ 'https://rustup.rs' @@ -74,6 +74,12 @@ if [ "${1:-}" = "mobile" ]; then "Ensure 'python3' is available in your \$PATH and try again." fi + if ! has rustup; then + err 'Rustup was not found. It is required for cross-compiling rust to mobile targets.' \ + "Ensure the 'rustup' binary is in your \$PATH." \ + 'https://rustup.rs' + fi + # Android targets echo "Installing Android targets for Rust..."