| #!/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 |
| ### 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. |
| ## |
| |
| 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 |
| |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/bazel_utils.sh || exit $? |
| fx-update-bazel-workspace |
| |
| "${PREBUILT_PYTHON3}" "${FUCHSIA_DIR}"/scripts/bazel-tool \ |
| --workspace="${BAZEL_WORKSPACE}" \ |
| --bazel="$(fx-get-bazel)" \ |
| --buildifier="${PREBUILT_BUILDIFIER}" \ |
| "${@}" |