File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1+ load ("@bazel_skylib//rules:common_settings.bzl" , "bool_flag" )
2+
3+ bool_flag (
4+ name = "run_on_headers" ,
5+ build_setting_default = True ,
6+ visibility = ["//visibility:public" ],
7+ )
8+
19filegroup (
210 name = "clang_tidy_config_default" ,
311 srcs = [
Original file line number Diff line number Diff line change 11load ("@bazel_tools//tools/build_defs/cc:action_names.bzl" , "ACTION_NAMES" )
22load ("@bazel_tools//tools/cpp:toolchain_utils.bzl" , "find_cpp_toolchain" )
3+ load ("@bazel_skylib//rules:common_settings.bzl" , "BuildSettingInfo" )
34
45def _run_tidy (
56 ctx ,
@@ -198,6 +199,12 @@ def _clang_tidy_aspect_impl(target, ctx):
198199 cxx_flags = _safe_flags (_toolchain_flags (ctx , ACTION_NAMES .cpp_compile ) + rule_flags ) + ["-xc++" ]
199200
200201 include_headers = "no-clang-tidy-headers" not in ctx .rule .attr .tags
202+
203+ run_on_headers = ctx .attr ._run_on_headers [BuildSettingInfo ].value
204+ if type (run_on_headers ) == type (True ):
205+ if not run_on_headers :
206+ include_headers = False
207+
201208 srcs = _rule_sources (ctx , include_headers )
202209
203210 outputs = [
@@ -229,6 +236,7 @@ clang_tidy_aspect = aspect(
229236 "_clang_tidy_executable" : attr .label (default = Label ("//:clang_tidy_executable" )),
230237 "_clang_tidy_additional_deps" : attr .label (default = Label ("//:clang_tidy_additional_deps" )),
231238 "_clang_tidy_config" : attr .label (default = Label ("//:clang_tidy_config" )),
239+ "_run_on_headers" : attr .label (default = Label ("//:run_on_headers" )),
232240 },
233241 toolchains = ["@bazel_tools//tools/cpp:toolchain_type" ],
234242)
You can’t perform that action at this time.
0 commit comments