diff --git a/HISTORY.md b/HISTORY.md index c7fdbd1..28e15d8 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,6 +9,8 @@ 3. 修订老式命令行接口的错误码 4. 优化忽略规则 5. 修订重复的自定义参数的问题 +6. 支持多个 `proto_file` 配置 +7. 修复 `global` 里配置的默认 `option` 配置 1.4.0 ------ diff --git a/xresconv_cli.py b/xresconv_cli.py index bd4d408..dee2784 100644 --- a/xresconv_cli.py +++ b/xresconv_cli.py @@ -44,6 +44,7 @@ def main(): "default_scheme": {}, "data_version": None, "output_matrix": {"file_path": None, "outputs": []}, + "protocol_files": {"file_path": None, "inputs": []}, } # 默认双线程,实际测试过程中java的运行优化反而比多线程更能提升效率 @@ -260,7 +261,16 @@ def load_global_options(gns): xconv_options["output_matrix"]["outputs"].append(output_rule) elif tag_name == "proto_file": - xconv_options["args"]["-f"] = '"' + text_value + '"' + if ( + global_node["file_path"] + != xconv_options["protocol_files"]["file_path"] + ): + xconv_options["protocol_files"]["inputs"] = [] + xconv_options["protocol_files"]["file_path"] = global_node[ + "file_path" + ] + xconv_options["protocol_files"]["inputs"].append("-f") + xconv_options["protocol_files"]["inputs"].append('"' + text_value + '"') elif tag_name == "output_dir": xconv_options["args"]["-o"] = '"' + text_value + '"' @@ -435,6 +445,8 @@ def load_list_item_nodes(lis): for item_output in item_output_matrix: item_cmd_args_array = [] + item_cmd_args_array.extend(global_cmd_args_prefix_array) + item_cmd_args_array.extend(xconv_options["protocol_files"]["inputs"]) # merge global options if "tags" in item_output and item_output["tags"]: @@ -588,11 +600,12 @@ def worker_func(idx, exit_data): cprintf_stdout( [print_style.FC_GREEN], - ('"{0}"' + os.linesep + "\t>{1}" + os.linesep).format( - '" "'.join(java_options), (os.linesep + "\t>").join(this_thd_cmds) + ('"{0}"' + os.linesep + "\t> {1}" + os.linesep).format( + '" "'.join(java_options), (os.linesep + "\t> ").join(this_thd_cmds) ), ) + # ----------------------------------------- 实际开始转换 ----------------------------------------- for i in range(0, options.parallelism): this_worker_thd = threading.Thread(target=worker_func, args=[i, exit_data]) this_worker_thd.start() @@ -602,8 +615,6 @@ def worker_func(idx, exit_data): for thd in all_worker_thread: thd.join() - # ----------------------------------------- 实际开始转换 ----------------------------------------- - cprintf_stdout( [print_style.FC_MAGENTA], "[INFO] all jobs done. {0} job(s) failed.{1}".format(exit_data["exit_code"], os.linesep),