blob: 06799ae8124c71bb08831bf3ecc31a7b5acda1d2 [file] [log] [blame]
#!/bin/bash
# Copyright 2024 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.
_script_dir="${BASH_SOURCE[0]%/*}"
if [[ "${_script_dir}" == "${BASH_SOURCE[0]}" ]]; then _script_dir="."; fi
readonly _script_dir
source "${_script_dir}/../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
bazel_sdk_dir=$(${FUCHSIA_DIR}/build/api/client print bazel_sdk_info |
fx-command-run jq -r ".[0] | .location")
if [[ ! -d "${FUCHSIA_BUILD_DIR}/${bazel_sdk_dir}" ]]; then
fx-error "No bazel sdk in build directory, please run $(fx build generate_fuchsia_sdk_repository)"
fi
source "${_script_dir}/../lib/bazel_utils.sh" || exit $?
fx-update-bazel-workspace
BAZEL_EXE="$(fx-get-bazel)"
"${_script_dir}/refresh-bazel-compdb-bin.py" \
--bazel $BAZEL_EXE \
--build-dir "${FUCHSIA_BUILD_DIR}" \
"$@"