From 7c691d791ae5d13b05fe9ff4cc415bec805cd822 Mon Sep 17 00:00:00 2001 From: John Murray <63568820+murray-stripe@users.noreply.github.com> Date: Mon, 22 Mar 2021 12:21:27 -0400 Subject: [PATCH 1/3] Update run_clang_tidy.sh to support repository Support running `run_clang_tidy.sh` when Envoy is a sub-workspace within a project (such as used when developing custom filters and nesting Envoy as a git-submodule). This can be done by setting the compilation DB targets as an environment variable: ```bash COMP_DB_TARGETS="@envoy//source/... @envoy//test/... @envoy//tools/..." ``` ``` Signed-off-by: John Murray Signed-off-by: John Murray <63568820+murray-stripe@users.noreply.github.com> --- ci/run_clang_tidy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/run_clang_tidy.sh b/ci/run_clang_tidy.sh index 6412bedc1061..0cc829843099 100755 --- a/ci/run_clang_tidy.sh +++ b/ci/run_clang_tidy.sh @@ -26,7 +26,7 @@ echo "Generating compilation database..." # bazel build need to be run to setup virtual includes, generating files which are consumed # by clang-tidy -"${ENVOY_SRCDIR}/tools/gen_compilation_database.py" --include_headers +"${ENVOY_SRCDIR}/tools/gen_compilation_database.py" --include_headers ${COMP_DB_TARGETS:+${COMP_DB_TARGETS[@]}} # Do not run clang-tidy against win32 impl # TODO(scw00): We should run clang-tidy against win32 impl once we have clang-cl support for Windows From 31214f07e8c2a45b258049154ac5f24c211e6fa1 Mon Sep 17 00:00:00 2001 From: John Murray <63568820+murray-stripe@users.noreply.github.com> Date: Mon, 22 Mar 2021 15:48:37 -0400 Subject: [PATCH 2/3] remove array expansion Signed-off-by: John Murray <63568820+murray-stripe@users.noreply.github.com> Signed-off-by: John Murray --- ci/run_clang_tidy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/run_clang_tidy.sh b/ci/run_clang_tidy.sh index 0cc829843099..45302ca67157 100755 --- a/ci/run_clang_tidy.sh +++ b/ci/run_clang_tidy.sh @@ -26,7 +26,7 @@ echo "Generating compilation database..." # bazel build need to be run to setup virtual includes, generating files which are consumed # by clang-tidy -"${ENVOY_SRCDIR}/tools/gen_compilation_database.py" --include_headers ${COMP_DB_TARGETS:+${COMP_DB_TARGETS[@]}} +"${ENVOY_SRCDIR}/tools/gen_compilation_database.py" --include_headers ${COMP_DB_TARGETS:+$COMP_DB_TARGETS} # Do not run clang-tidy against win32 impl # TODO(scw00): We should run clang-tidy against win32 impl once we have clang-cl support for Windows From 778c01faeaf3b9ab7dece3c163d01fcb9ef8e0a1 Mon Sep 17 00:00:00 2001 From: John Murray Date: Mon, 22 Mar 2021 14:21:29 -0600 Subject: [PATCH 3/3] PR Feedbac - use read + array expansion Signed-off-by: John Murray --- ci/run_clang_tidy.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/run_clang_tidy.sh b/ci/run_clang_tidy.sh index 45302ca67157..f9b54d3a80d8 100755 --- a/ci/run_clang_tidy.sh +++ b/ci/run_clang_tidy.sh @@ -26,7 +26,8 @@ echo "Generating compilation database..." # bazel build need to be run to setup virtual includes, generating files which are consumed # by clang-tidy -"${ENVOY_SRCDIR}/tools/gen_compilation_database.py" --include_headers ${COMP_DB_TARGETS:+$COMP_DB_TARGETS} +read -ra COMP_DB_TARGETS <<< "$COMP_DB_TARGETS" +"${ENVOY_SRCDIR}/tools/gen_compilation_database.py" --include_headers "${COMP_DB_TARGETS[@]}" # Do not run clang-tidy against win32 impl # TODO(scw00): We should run clang-tidy against win32 impl once we have clang-cl support for Windows