File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ root = true
2+
3+ [* ]
4+ end_of_line = lf
5+ insert_final_newline = true
6+
7+ [* .{cc,hh,cpp,hpp} ]
8+ # matching .clang-format IndentWidth
9+ indent_size = 2
10+
11+ [* .{bzl,bazel} ]
12+ # matches output of buildifier
13+ indent_size = 4
14+ indent_style = space
Original file line number Diff line number Diff line change @@ -64,6 +64,32 @@ def _ecsact_build_recipe(ctx):
6464 })
6565 recipe_data .append (info .plugin )
6666
67+ for cc_dep in ctx .attr .cc_deps :
68+ cc_info = cc_dep [CcInfo ]
69+
70+ for hdr in cc_info .compilation_context .headers .to_list ():
71+ hdr_prefix = ""
72+
73+ for quote_inc in cc_info .compilation_context .quote_includes .to_list ():
74+ if hdr .path .startswith (quote_inc ):
75+ hdr_prefix = quote_inc
76+ break
77+ for sys_inc in cc_info .compilation_context .system_includes .to_list ():
78+ if hdr .path .startswith (sys_inc ):
79+ hdr_prefix = sys_inc
80+ break
81+
82+ if hdr_prefix :
83+ hdr_prefix_base = hdr .path .removeprefix (hdr_prefix )
84+ hdr_prefix_base_idx = hdr_prefix_base .rindex ("/" )
85+ hdr_prefix_base = hdr_prefix_base [:hdr_prefix_base_idx ]
86+ sources .append ({
87+ "path" : hdr .path ,
88+ "outdir" : "include" + hdr_prefix_base ,
89+ "relative_to_cwd" : True ,
90+ })
91+ recipe_data .append (hdr )
92+
6793 recipe = {
6894 "name" : ctx .attr .name ,
6995 "sources" : sources ,
@@ -89,6 +115,9 @@ ecsact_build_recipe = rule(
89115 "srcs" : attr .label_list (
90116 allow_files = True ,
91117 ),
118+ "cc_deps" : attr .label_list (
119+ providers = [CcInfo ],
120+ ),
92121 "fetch_srcs" : attr .string_list_dict (
93122 allow_empty = True ,
94123 ),
You can’t perform that action at this time.
0 commit comments