@@ -211,44 +211,6 @@ compile_info_aspect = aspect(
211211 toolchains = ["@bazel_tools//tools/cpp:toolchain_type" ],
212212)
213213
214- def _compile_commands_json (compile_commands ):
215- json = "[\n "
216- entries = [entry .to_json () for entry in compile_commands ]
217- json += ",\n " .join (entries )
218- json += "]\n "
219- return json
220-
221- def _compile_commands_data (ctx ):
222- compile_commands = []
223- for target in ctx .attr .targets :
224- if not CcInfo in target :
225- continue
226- if CompileInfo in target :
227- if hasattr (target [CompileInfo ], "arguments" ):
228- srcs = target [CompileInfo ].arguments .keys ()
229- for src in srcs :
230- args = target [CompileInfo ].arguments [src ]
231-
232- # print("args =", str(args))
233- record = struct (
234- file = src .path ,
235- command = " " .join (args ),
236- directory = "." ,
237- )
238- compile_commands .append (record )
239- return compile_commands
240-
241- def _compile_commands_impl (ctx ):
242- compile_commands = _compile_commands_data (ctx )
243- content = _compile_commands_json (compile_commands )
244- file_name = ctx .attr .name + "/data/compile_commands.json"
245- compile_commands_json = ctx .actions .declare_file (file_name )
246- ctx .actions .write (
247- output = compile_commands_json ,
248- content = content ,
249- )
250- return compile_commands_json
251-
252214def _collect_all_sources_and_headers (ctx ):
253215 # NOTE: we are only using this function for CTU
254216 all_files = []
@@ -283,7 +245,6 @@ def _create_wrapper_script(ctx, options, compile_commands_json):
283245 )
284246
285247def _per_file_impl (ctx ):
286- #compile_commands_json = _compile_commands_impl(ctx)
287248 compile_commands = None
288249 source_files = None
289250 for output in compile_commands_impl (ctx ):
0 commit comments