@@ -64,31 +64,44 @@ def _ecsact_build_recipe(ctx):
6464 })
6565 recipe_data .append (info .plugin )
6666
67+ cc_dep_compilation_contexts = []
6768 for cc_dep in ctx .attr .cc_deps :
6869 cc_info = cc_dep [CcInfo ]
70+ cc_dep_compilation_contexts .append (cc_info .compilation_context )
6971
70- for hdr in cc_info .compilation_context .headers .to_list ():
72+ if len (cc_dep_compilation_contexts ) > 0 :
73+ cc_dep_compilation_context = cc_common .merge_compilation_contexts (compilation_contexts = cc_dep_compilation_contexts )
74+
75+ for hdr in cc_dep_compilation_context .headers .to_list ():
7176 hdr_prefix = ""
7277
73- for quote_inc in cc_info . compilation_context .quote_includes .to_list ():
78+ for quote_inc in cc_dep_compilation_context .quote_includes .to_list ():
7479 if hdr .path .startswith (quote_inc ):
7580 hdr_prefix = quote_inc
7681 break
77- for sys_inc in cc_info . compilation_context .system_includes .to_list ():
82+ for sys_inc in cc_dep_compilation_context .system_includes .to_list ():
7883 if hdr .path .startswith (sys_inc ):
7984 hdr_prefix = sys_inc
8085 break
86+ for inc in cc_dep_compilation_context .includes .to_list ():
87+ if hdr .path .startswith (inc ):
88+ hdr_prefix = inc
89+ break
8190
91+ hdr_prefix_base = ""
8292 if hdr_prefix :
8393 hdr_prefix_base = hdr .path .removeprefix (hdr_prefix )
8494 hdr_prefix_base_idx = hdr_prefix_base .rindex ("/" )
8595 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 )
96+ else :
97+ hdr_prefix_base_idx = hdr .path .rindex ("/" )
98+ hdr_prefix_base = "/" + hdr .path [:hdr_prefix_base_idx ]
99+ sources .append ({
100+ "path" : hdr .path ,
101+ "outdir" : "include" + hdr_prefix_base ,
102+ "relative_to_cwd" : True ,
103+ })
104+ recipe_data .append (hdr )
92105
93106 recipe = {
94107 "name" : ctx .attr .name ,
0 commit comments