diff options
author | Artem Serov <artem.serov@linaro.org> | 2021-07-26 12:55:15 +0100 |
---|---|---|
committer | Artem Serov <artem.serov@linaro.org> | 2021-07-27 13:32:39 +0100 |
commit | 04b96565858580314a7a723f99d6aeb680e4cf7f (patch) | |
tree | 647273a9c4c16f6a31fdd0fdf2ef7f6934fb9fd3 | |
parent | 96d6c69593fa88fc786247d6875f8103d836ced7 (diff) | |
download | art-build-scripts-04b96565858580314a7a723f99d6aeb680e4cf7f.tar.gz |
Add a compdb script.
Adds a script to generate a compilation database
file for ART project; this could be used for IDE
indexing and code navigation.
Test: running ./generate_compdb.sh and using it
for code navigation for VS code.
Change-Id: I9622495bf8689e3b0228598e6d2f819548896cb4
-rwxr-xr-x | generate_compdb.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/generate_compdb.sh b/generate_compdb.sh new file mode 100755 index 00000000..2216e4fa --- /dev/null +++ b/generate_compdb.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# Copyright (c) 2021, Linaro Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script generates a compilation database (compdb) - a file that stores +# information about the build process for a C++ project. + +readonly local_path=$(dirname "$0") +source "${local_path}/utils/utils.sh" +source "${local_path}/utils/utils_android.sh" +source "${local_path}/utils/utils_android_root.sh" + +set_environment_compdb() { + export SOONG_GEN_COMPDB=1 + export SOONG_GEN_COMPDB_DEBUG=1 + export SOONG_LINK_COMPDB_TO="${ANDROID_BUILD_TOP}" +} + +main() { + if android_build_already_setup; then + log E "This test does not support environment targets. Please re-run in a clean environment." + exit 1 + fi + + if [[ ! -d "${PWD}/.repo" ]]; then + log E "Script needs to be run at the root of the android tree." + exit 1 + fi + + source_android_environment_default + set_environment_host + + # Default armv8 target is used. + setup_android_target "armv8" + set_environment_compdb + safe_make_build "nothing" +} + +main "$@" |