| #!/bin/bash | |
| # Copyright 2023 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. | |
| #### CATEGORY=Build | |
| #### PREBUILTS=${PREBUILT_BAZEL} ${PREBUILT_BUILDIFIER} ${PREBUILT_JQ} ${PREBUILT_PYTHON3} | |
| ### Run the bazel-tool script in the Fuchsia Bazel workspace. | |
| ## usage: fx bazel-tool <command> ... | |
| ## | |
| ## Runs the `bazel-tool` script inside the Fuchsia Bazel workspace. | |
| ## This script provides many commands to help developers perform useful | |
| ## queries easily. Use --help for details. | |
| ## | |
| # shellcheck source=/dev/null | |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $? | |
| fx-config-read | |
| if [[ ! -d "${FUCHSIA_BUILD_DIR}" ]]; then | |
| fx-error "No Fuchsia build directory, please run 'fx set' or 'fx gen'." | |
| fi | |
| # shellcheck source=/dev/null | |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/bazel_utils.sh || exit $? | |
| fx-update-bazel-workspace | |
| "${PREBUILT_PYTHON3}" "${FUCHSIA_DIR}"/build/bazel/scripts/bazel_tool.py \ | |
| --workspace="$(fx-get-bazel-workspace)" \ | |
| --fuchsia-dir="${FUCHSIA_DIR}" \ | |
| --build-dir="${FUCHSIA_BUILD_DIR}" \ | |
| --bazel="$(fx-get-bazel)" \ | |
| --buildifier="${PREBUILT_BUILDIFIER}" \ | |
| "${@}" |