From 79b60a14def3382b155ab9630a3fcd2d89879ee2 Mon Sep 17 00:00:00 2001 From: xietingwei Date: Fri, 5 Sep 2025 14:08:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E4=BA=8C=E8=BF=9B=E5=88=B6=E5=8C=85bundle.json?= =?UTF-8?q?=E9=87=8C=E6=B7=BB=E5=8A=A0=E4=BB=A3=E7=A0=81=E5=88=86=E6=94=AF?= =?UTF-8?q?=E5=92=8C=E5=BD=A2=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xietingwei --- .../common/generate_component_package.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/templates/common/generate_component_package.py b/templates/common/generate_component_package.py index 217a922bbc..573cded6c4 100644 --- a/templates/common/generate_component_package.py +++ b/templates/common/generate_component_package.py @@ -47,6 +47,10 @@ def _get_args(): help="local test ,default: not local , 0", ) parser.add_argument("-origin", "--build-origin", default="", type=str, help="Origin marker for HPM package", ) + parser.add_argument("-branch", "--code_branch", default="master", type=str, + help="The branch where the code is located") + parser.add_argument("-variant", "--variant", default="standard", type=str, + help="The form of binary packages") args = parser.parse_args() return args @@ -591,6 +595,8 @@ def process_developer_test(part_data, parts_path_info, part_name, subsystem_name gn_path = os.path.join(dst_path, "bundle.json") bundle_content = _generate_developer_test_bundle_content() + bundle_content.update({"branch": part_data["code_branch"]}) + bundle_content.update({"variant": part_data["variant"]}) _create_bundle_json(gn_path, bundle_content) _copy_license(part_data) @@ -648,6 +654,8 @@ def process_variants_default(part_data, parts_path_info, part_name, subsystem_na print("All confiauration files copied successfully") bundle_content = generate_variants_default_bundle_info() + bundle_content.update({"branch": part_data["code_branch"]}) + bundle_content.update({"variant": part_data["variant"]}) bundle_path = os.path.join(variants_root, 'bundle.json') _create_bundle_json(bundle_path, bundle_content) @@ -1379,6 +1387,8 @@ def _copy_bundlejson(args, public_deps_list): bundle_data['publishAs'] = 'binary' bundle_data.update({'os': args.get('os')}) bundle_data.update({'buildArch': args.get('buildArch')}) + bundle_data.update({'branch': args.get('code_branch')}) + bundle_data.update({'variant': args.get('variant')}) dirs = _dirs_handler(bundlejson_out) bundle_data['dirs'] = dirs bundle_data['version'] = str(bundle_data['version']) @@ -2035,7 +2045,7 @@ def additional_comoponents_json(): def generate_component_package(out_path, root_path, components_list=None, build_type=0, organization_name='ohos', - os_arg='linux', build_arch_arg='x86', local_test=0, build_origin=''): + os_arg='linux', build_arch_arg='x86', local_test=0, build_origin='', code_branch='', variant=''): """ Args: @@ -2086,7 +2096,9 @@ def generate_component_package(out_path, root_path, components_list=None, build_ "build_type": build_type, "organization_name": organization_name, "toolchain_info": toolchain_info, "static_deps": {}, - "build_origin": build_origin + "build_origin": build_origin, + "code_branch": code_branch, + "variant": variant } for key, value in part_subsystem.items(): part_name = key @@ -2109,7 +2121,9 @@ def main(): os_arg=py_args.os_arg, build_arch_arg=py_args.build_arch, local_test=py_args.local_test, - build_origin=py_args.build_origin) + build_origin=py_args.build_origin, + code_branch=py_args.code_branch, + variant=py_args.variant) if __name__ == '__main__': -- Gitee