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
+
1
9
filegroup (
2
10
name = "clang_tidy_config_default" ,
3
11
srcs = [
Original file line number Diff line number Diff line change 1
1
load ("@bazel_tools//tools/build_defs/cc:action_names.bzl" , "ACTION_NAMES" )
2
2
load ("@bazel_tools//tools/cpp:toolchain_utils.bzl" , "find_cpp_toolchain" )
3
+ load ("@bazel_skylib//rules:common_settings.bzl" , "BuildSettingInfo" )
3
4
4
5
def _run_tidy (
5
6
ctx ,
@@ -198,6 +199,12 @@ def _clang_tidy_aspect_impl(target, ctx):
198
199
cxx_flags = _safe_flags (_toolchain_flags (ctx , ACTION_NAMES .cpp_compile ) + rule_flags ) + ["-xc++" ]
199
200
200
201
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
+
201
208
srcs = _rule_sources (ctx , include_headers )
202
209
203
210
outputs = [
@@ -229,6 +236,7 @@ clang_tidy_aspect = aspect(
229
236
"_clang_tidy_executable" : attr .label (default = Label ("//:clang_tidy_executable" )),
230
237
"_clang_tidy_additional_deps" : attr .label (default = Label ("//:clang_tidy_additional_deps" )),
231
238
"_clang_tidy_config" : attr .label (default = Label ("//:clang_tidy_config" )),
239
+ "_run_on_headers" : attr .label (default = Label ("//:run_on_headers" )),
232
240
},
233
241
toolchains = ["@bazel_tools//tools/cpp:toolchain_type" ],
234
242
)
You can’t perform that action at this time.
0 commit comments