summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMai Hussien <70515749+mai93@users.noreply.github.com>2022-06-23 12:16:48 -0700
committerGitHub <noreply@github.com>2022-06-23 12:16:48 -0700
commit1a2897a5316d1f8358f2253e5a7b6a6b3f41e3c7 (patch)
tree66b2d1272de29b9aae8617aed30db30531a649ce
parent960a8224b3ad01e87370cbce433e1ff27439f47a (diff)
downloadkythe-1a2897a5316d1f8358f2253e5a7b6a6b3f41e3c7.tar.gz
Generate compilation database for workspace (#5315)
* Generate compilation database for workspace * Use bash arrays to hold the queried targets * Use mapfile to fix Lint check
-rwxr-xr-xtools/cpp/generate_compilation_database.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/cpp/generate_compilation_database.sh b/tools/cpp/generate_compilation_database.sh
index 6ad9d3cdd..d5cfba410 100755
--- a/tools/cpp/generate_compilation_database.sh
+++ b/tools/cpp/generate_compilation_database.sh
@@ -1,18 +1,17 @@
#!/bin/bash
# Generates a compile_commands.json file at $(bazel info execution_root) for
-# the given file path.
+# your Clang tooling needs.
set -e
-FILENAME=${1:?Missing required source path}
+mapfile -t TARGETS < <(bazel query 'kind(cc_.*, //...) - attr(tags, manual, //...)')
bazel build \
--experimental_action_listener=//kythe/cxx/tools/generate_compile_commands:extract_json \
--noshow_progress \
--noshow_loading_progress \
--output_groups=compilation_outputs \
- --compile_one_dependency \
- "$FILENAME" > /dev/null
+ "${TARGETS[@]}" > /dev/null
BAZEL_ROOT="$(bazel info execution_root)"
pushd "$BAZEL_ROOT" > /dev/null