Skip to content

Commit

Permalink
Update run_clang_tidy.sh to support bazel targets with '@repository' …
Browse files Browse the repository at this point in the history
…prefixes (#15604)

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/..."
```

__Additional Description:__ In order to build from the SRCDIR (not ENVOY_SRCDIR), such as with the envoy-filter-example, need to be able to specify a repository on the targets built by `gen_compilation_database.py`. Simplest way to enable this is to allow for specifying the comp-db targets.

__Risk Level:__ Low. Default maintains current behavior
__Testing:__ Tested manually in docker container with setup similar to envoy-filter-example repo via:
```bash
SRCDIR='/src' COMP_DB_TARGETS="@envoy//source/... @envoy//test/... @envoy//tools/... //filters/..." bash -ex ./envoy/ci/do_ci.sh 'bazel.clang_tidy' '//filters/...'
```

Signed-off-by: John Murray <[email protected]>
  • Loading branch information
murray-stripe authored Mar 23, 2021
1 parent 634aa1a commit 531c6ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ci/run_clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Expand Down

0 comments on commit 531c6ac

Please sign in to comment.