diff --git a/templates/common/generate_component_package.py b/templates/common/generate_component_package.py index 217a922bbc341c82d254ed38c92b1d8ab952e899..573cded6c4f760936f74bcfeaf29941ba84c62da 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__':