| #!/bin/bash | |
| # Copyright 2018 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 | |
| ### generate a compilation database for the current build configuration | |
| ## usage: fx compdb | |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../lib/vars.sh || exit $? | |
| fx-config-read | |
| main () { | |
| if [ $# -gt 0 ]; then | |
| echo "Script to generate compile_commands.json file" | |
| echo "Concatenates the Fuchsia and Zircon compile_commands.json into one" | |
| echo "Usage: fx compdb" | |
| echo | |
| exit | |
| fi | |
| rm -f "${FUCHSIA_DIR}/compile_commands.json" | |
| fx-gen | |
| ${FUCHSIA_DIR}/scripts/editors/cat_compile_commands.py ${ZIRCON_BUILDROOT}/compile_commands.json \ | |
| ${FUCHSIA_BUILD_DIR}/compile_commands.json > ${FUCHSIA_DIR}/compile_commands.json | |
| } | |
| main "$@" |