blob: 432b82de4473456f86afa6d5a351a56aa4db44a9 [file] [log] [blame]
#!/bin/bash
#
# Copyright 2022 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Returns true if colors are supported.
function is-stderr-tty {
[[ -t 2 ]]
}
# echo-info prints a line to stderr with a green INFO: prefix.
function echo-info {
if is-stderr-tty; then
echo -e >&2 "\033[1;32mINFO:\033[0m $*"
else
echo -e >&2 "INFO: $*"
fi
}
# echo-warning prints a line to stderr with a yellow WARNING: prefix.
function echo-warning {
if is-stderr-tty; then
echo -e >&2 "\033[1;33mWARNING:\033[0m $*"
else
echo -e >&2 "WARNING: $*"
fi
}
# echo-error prints a line to stderr with a red ERROR: prefix.
function echo-error {
if is-stderr-tty; then
echo -e >&2 "\033[1;31mERROR:\033[0m $*"
else
echo -e >&2 "ERROR: $*"
fi
}
function ensure-embedder-dir {
if [[ -z "${FUCHSIA_EMBEDDER_DIR}" ]]; then
echo-error '$FUCHSIA_EMBEDDER_DIR must be set to your flutter-embedder folder before running this script.'
echo-error 'Add this line to your shell profile:'
echo-error "export FUCHSIA_EMBEDDER_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && cd ../.. && pwd)"
exit 1
fi
}
embedder_depot_tools="${FUCHSIA_EMBEDDER_DIR}"/third_party/depot_tools
embedder_engine_dir="${FUCHSIA_EMBEDDER_DIR}"/third_party/engine/src
function ensure-engine-dir {
if [ ! -d "${embedder_engine_dir}" ]; then
echo-error 'You must set up your Engine development environment before running this script.'
echo-error 'To do this, run:'
echo-error '$FUCHSIA_EMBEDDER_DIR/scripts/setup_engine --github-username my_username'
exit 1
fi
}