解决diff工具结果名称列出现空的情况和collect_h工具增加-D命令行参数

Signed-off-by: zhangwuf <zhangwu47@huawei.com>
This commit is contained in:
zhangwuf 2024-08-27 17:07:22 +08:00
parent d5b81b3da9
commit 7a61d7dfbb
3 changed files with 21 additions and 10 deletions

View File

@ -55,7 +55,7 @@ def run_tools(options):
elif tool_name == ToolNameType["CHECK"].value:
check.curr_entry(options.path, options.checker, options.output)
elif tool_name == ToolNameType['COLLECT_H'].value:
parser.parser_direct(options.parser_path)
parser.parser_direct(options.parser_path, options.dependent_path)
elif tool_name == ToolNameType['COLLECT_FILE'].value:
parser.parser_file_level(options.output_path)
elif tool_name == ToolNameType['CHECK_SYNTAX'].value:

View File

@ -807,7 +807,8 @@ def get_ch_api_kind(dict_key):
def collect_change_data_total(data: dict, diff_info_list):
for element in diff_info_list:
element.set_api_node_name(data['name'])
if (data['kind'] == Scene.STRUCT_DECL.value or data['kind'] == Scene.UNION_DECL.value) and (not data['name']):
if (data['kind'] == Scene.STRUCT_DECL.value or data['kind'] == Scene.UNION_DECL.value
or data['kind'] == Scene.ENUM_DECL.value) and (not data['name']):
element.set_api_node_name(data['type'])
element.set_current_api_unique_id(data['unique_id'])
element.set_open_close_api(data['open_close_api'])

View File

@ -404,20 +404,30 @@ def complete_kit_or_system(api_message: OneFileApiMessage, json_path):
api_message.set_sub_system(sub_system_name)
def parser_direct(path): # 目录路径
def get_dependent_path_all(dependent_path):
all_dependent_path_list = []
for dir_path, _, _ in os.walk(dependent_path):
if 'sysroot_myself' not in dir_path and 'build-tools' not in dir_path:
all_dependent_path_list.append(dir_path)
return all_dependent_path_list
def parser_direct(path, dependent_path): # 目录路径
file_path_list = []
link_include_path = [] # 装链接头文件路径
link_include_path.extend(get_dependent_path_all(dependent_path))
dir_path = ''
if os.path.isdir(path):
link_include_path.append(path)
file_path_total, link_include_total = get_dir_file_path(path)
if path not in link_include_path:
link_include_path.append(path)
file_path_total, _ = get_dir_file_path(path)
file_path_list.extend(file_path_total)
link_include_path.extend(link_include_total)
dir_path = path
else:
if path.endswith('.h'):
file_path_list.append(path)
dir_path = os.path.dirname(path)
elif path.endswith('.h'):
file_path_list.append(path)
dir_path = os.path.dirname(path)
if dir_path not in link_include_path:
link_include_path.append(dir_path)
data_total = parse_include.get_include_file(file_path_list, link_include_path, dir_path)
generating_tables.get_api_data(data_total, StringConstant.PARSER_DIRECT_EXCEL_NAME.value)