From cd2c6effc0ad8e66d21b5c70aa48cb3eda053ea1 Mon Sep 17 00:00:00 2001 From: Michael Ahn Date: Thu, 12 Sep 2024 14:47:22 -0700 Subject: [PATCH] Add external includes to clang-tidy invocation - Current workaround is to manually add paths, e.g. `build:clang-tidy --copt=-isystem./external/mylibrary/include` - This uses bazel's [`external_includes`](https://bazel.build/rules/lib/builtins/CompilationContext#external_includes) to fix this --- clang_tidy/clang_tidy.bzl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang_tidy/clang_tidy.bzl b/clang_tidy/clang_tidy.bzl index c52dbbb..0a36c75 100644 --- a/clang_tidy/clang_tidy.bzl +++ b/clang_tidy/clang_tidy.bzl @@ -66,6 +66,8 @@ def _run_tidy( args.add_all(compilation_context.system_includes.to_list(), before_each = "-isystem") + args.add_all(compilation_context.external_includes.to_list(), before_each = "-isystem") + ctx.actions.run( inputs = inputs, outputs = [outfile],