File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -297,10 +297,24 @@ def _collect_all_sources_and_headers(ctx):
297297 sources_and_headers = all_files + headers .to_list ()
298298 return sources_and_headers
299299
300+ def _merge_options (default , custom ):
301+ """
302+ Merge command line arguments so that default options can be overridden
303+ """
304+ final = []
305+ args_set = []
306+ for item in custom :
307+ args_set .append (item .split (" " )[0 ].split ("=" )[0 ])
308+ final .append (item )
309+ for option in default :
310+ if option .split (" " )[0 ].split ("=" )[0 ] not in args_set :
311+ final .append (option )
312+ return final
313+
300314def _code_checker_impl (ctx ):
301315 compile_commands_json = _compile_commands_impl (ctx )
302316 sources_and_headers = _collect_all_sources_and_headers (ctx )
303- options = ctx .attr .default_options + ctx .attr .options
317+ options = _merge_options ( ctx .attr .default_options , ctx .attr .options )
304318 all_files = [compile_commands_json ]
305319 for target in ctx .attr .targets :
306320 if not CcInfo in target :
You can’t perform that action at this time.
0 commit comments