diff --git a/indep_configs/config/binary_package_exclusion_list.json b/indep_configs/config/binary_package_exclusion_list.json index abb84156834324603076339d34fd4c5da0a82b18..564f0f999bbf1c776b60402b1ab857fce2a9e708 100644 --- a/indep_configs/config/binary_package_exclusion_list.json +++ b/indep_configs/config/binary_package_exclusion_list.json @@ -1,7 +1,6 @@ [ "googletest", "benchmark", - "hisysevent", "rust_bindgen", "css-what" ] \ No newline at end of file diff --git a/templates/common/generate_component_package.py b/templates/common/generate_component_package.py index 85f6a0b3215d6e9c14c42bb5d8b81e4d058d46aa..a36ed025a5355ccb3adbfc4f9578133a3b0b351d 100644 --- a/templates/common/generate_component_package.py +++ b/templates/common/generate_component_package.py @@ -807,23 +807,6 @@ def process_hisysevent(part_data, parts_path_info, part_name, subsystem_name, co _finish_component_build(part_data) -def _generate_runtime_core_build_gn(): - gn_path = os.path.join(args.get("out_path"), "component_package", args.get("part_path"), - "innerapis", module, "BUILD.gn") - fd = os.open(gn_path, os.O_WRONLY | os.O_CREAT, mode=0o640) - fp = os.fdopen(fd, 'w') - _generate_import(fp) - _generate_configs(fp, module) - _generate_prebuilt_shared_library(fp, json_data.get('type'), module) - _generate_public_configs(fp, module) - _list = _generate_public_external_deps(fp, module, deps, components_json, public_deps_list) - _generate_other(fp, args, json_data, module) - _generate_end(fp) - print("_generate_build_gn has done ") - fp.close() - return _list - - def _handle_module_runtime_core(args, components_json, module): public_deps_list = [] if _is_innerkit(components_json, args.get("part_name"), module) == False: @@ -864,101 +847,11 @@ def process_runtime_core(part_data, parts_path_info, part_name, subsystem_name, _finish_component_build(part_data) -def process_drivers_interface_display(part_data, parts_path_info, part_name, subsystem_name, components_json): - part_path = _get_parts_path(parts_path_info, part_name) - if part_path is None: - return - part_data.update({"subsystem_name": subsystem_name, "part_name": part_name, - "part_path": part_path}) - modules = _parse_module_list(part_data) - print('modules', modules) - if len(modules) == 0: - return - is_component_build = False - _public_deps_list = [] - for module in modules: - module_deps_list = _handle_module(part_data, components_json, module) - if module_deps_list: - _public_deps_list.extend(module_deps_list) - is_component_build = True - lib_out_dir = os.path.join(part_data.get("out_path"), "component_package", - part_data.get("part_path"), "innerapis", "display_commontype_idl_headers", "libs") - if not os.path.exists(lib_out_dir): - os.makedirs(lib_out_dir) - file_path = os.path.join(lib_out_dir, 'libdisplay_commontype_idl_headers') - with open(file_path, 'wb') as file: - pass - if is_component_build: - _copy_required_docs(part_data, _public_deps_list) - _finish_component_build(part_data) - - -def process_drivers_interface_usb(part_data, parts_path_info, part_name, subsystem_name, components_json): - part_path = _get_parts_path(parts_path_info, part_name) - if part_path is None: - return - part_data.update({"subsystem_name": subsystem_name, "part_name": part_name, - "part_path": part_path}) - modules = _parse_module_list(part_data) - print('modules', modules) - if len(modules) == 0: - return - is_component_build = False - _public_deps_list = [] - for module in modules: - module_deps_list = _handle_module(part_data, components_json, module) - if module_deps_list: - _public_deps_list.extend(module_deps_list) - is_component_build = True - lib_out_dir = os.path.join(part_data.get("out_path"), "component_package", - part_data.get("part_path"), "innerapis", "usb_idl_headers_1.1", "libs") - if not os.path.exists(lib_out_dir): - os.makedirs(lib_out_dir) - file_path = os.path.join(lib_out_dir, 'libusb_idl_headers_1.1') - with open(file_path, 'wb') as file: - pass - if is_component_build: - _copy_required_docs(part_data, _public_deps_list) - _finish_component_build(part_data) - - -def process_drivers_interface_ril(part_data, parts_path_info, part_name, subsystem_name, components_json): - part_path = _get_parts_path(parts_path_info, part_name) - if part_path is None: - return - part_data.update({"subsystem_name": subsystem_name, "part_name": part_name, - "part_path": part_path}) - modules = _parse_module_list(part_data) - print('modules', modules) - if len(modules) == 0: - return - is_component_build = False - _public_deps_list = [] - for module in modules: - module_deps_list = _handle_module(part_data, components_json, module) - if module_deps_list: - _public_deps_list.extend(module_deps_list) - is_component_build = True - lib_out_dir = os.path.join(part_data.get("out_path"), "component_package", - part_data.get("part_path"), "innerapis", "ril_idl_headers", "libs") - if not os.path.exists(lib_out_dir): - os.makedirs(lib_out_dir) - file_path = os.path.join(lib_out_dir, 'libril_idl_headers') - with open(file_path, 'wb') as file: - pass - if is_component_build: - _copy_required_docs(part_data, _public_deps_list) - _finish_component_build(part_data) - - # 函数映射字典 function_map = { 'musl': process_musl, "developer_test": process_developer_test, # 同rust - "drivers_interface_display": process_drivers_interface_display, # 驱动的, 新建一个libs目录/ innerapi同名文件 "runtime_core": process_runtime_core, # 编译参数, 所有下面的innerapi的cflags都不 - "drivers_interface_usb": process_drivers_interface_usb, # 同驱动 - "drivers_interface_ril": process_drivers_interface_ril, # 同驱动 "skia": process_skia, } @@ -1137,6 +1030,17 @@ def _get_target_include(part_name, include): else: return "" +def _get_target_include(part_name, include): + part_whitch_use_multilayer_include = ["camera_framework", "graphic_2d", "player_framework", "os_account"] + if part_name in part_whitch_use_multilayer_include: + target_include = include.replace("//", "") + if target_include.endswith("/"): + target_include = target_include[:-1] + return target_include + else: + return "" + + def _copy_includes(args, module, includes: list): if module == 'ipc_single': @@ -1209,6 +1113,8 @@ def _toolchain_static_file_path_mapping(subsystem_name, args, i): args.get("part_name")) return toolchain_path +def remove_prefix_if_present(path, prefix="ohos_clang_arm64/"): + return path[len(prefix):] if path.startswith(prefix) else path def replace_default_toolchains_in_output(path, default_toolchain="ohos_clang_arm64/"): return path.replace(default_toolchain, "") @@ -1417,7 +1323,9 @@ def _copy_bundlejson(args, public_deps_list): if args.get('organization_name'): _name_pattern = r'@(.*.)/' bundle_data['name'] = re.sub(_name_pattern, '@' + args.get('organization_name') + '/', - bundle_data['name']) + bundle_data['name'].split('/')[-1]) + bundle_data['name'] = f"@{args.get('organization_name')}/{bundle_data['name']}" + print(bundle_data['name']) if bundle_data.get('scripts'): bundle_data.update({'scripts': {}}) if bundle_data.get('licensePath'): @@ -1538,9 +1446,25 @@ def _generate_configs(fp, module, json_data, _part_name): fp.write(' }\n') +def _generate_group_configs(fp, module, json_data, _part_name): + includes = _handle_includes_data(json_data) + target_includes = [] + fp.write(' include_dirs = [\n') + for include in includes: + target_include = _get_target_include(_part_name, include) + if target_include not in target_includes: + target_includes.append(target_include) + for include_dir in target_includes: + include_dir = os.path.join('includes', include_dir) + fp.write(' "{}",\n'.format(include_dir)) + fp.write(' ]\n') + + def _generate_prebuilt_target(fp, target_type, module, is_ohos_ets_copy=False): if target_type == 'static_library': fp.write('ohos_prebuilt_static_library("' + module + '") {\n') + elif target_type == 'group': + fp.write('\nohos_shared_headers("' + module + '") {\n') elif target_type == 'executable': fp.write('ohos_prebuilt_executable("' + module + '") {\n') elif module != 'ipc_core' and (target_type == 'etc' or target_type == 'copy'): @@ -1560,7 +1484,6 @@ def _generate_public_configs(fp, module): # 目前特殊处理的依赖关系映射 _DEPENDENCIES_MAP = { - ('samgr', 'samgr_proxy'): ["ipc:ipc_core"], ('ets_runtime', 'libark_jsruntime'): ["runtime_core:libarkfile_static"], } @@ -1585,6 +1508,14 @@ def _generate_public_external_deps(fp, module, deps: list, components_json, publ return public_deps_list +def _get_rust_external_deps(components_json: dict, dep): + matching_results = [] + for key, value in components_json.items(): + for innerapi in value.get("innerapis", []): + if innerapi.get("label") == dep: + label_field = innerapi["label"].split(":")[1] + return (key, label_field) + return None def _find_ohos_ets_dir(outputs): for path in outputs: @@ -1614,7 +1545,8 @@ def _generate_other(fp, args, json_data, module, is_ohos_ets_copy=False): so_name = output.split('/')[-1] if json_data.get('type') == 'copy' and module != 'ipc_core': fp.write(' copy_linkable_file = true \n') - fp.write(' source = "libs/' + so_name + '"\n') + if json_data.get('type') != 'group': + fp.write(' source = "libs/' + so_name + '"\n') fp.write(' part_name = "' + args.get("part_name") + '"\n') fp.write(' subsystem_name = "' + args.get("subsystem_name") + '"\n') @@ -1716,12 +1648,19 @@ def _generate_build_gn(args, module, json_data, deps: list, components_json, pub static_deps_files = _get_static_deps(args, module, "") # 处理静态库依赖 fd = os.open(gn_path, os.O_WRONLY | os.O_CREAT, mode=0o640) fp = os.fdopen(fd, 'w') - _generate_import(fp, is_ohos_ets_copy) - _generate_configs(fp, module, json_data, args.get('part_name')) _target_type = json_data.get('type') + _generate_import(fp, is_ohos_ets_copy) + if _target_type != "group": + _generate_configs(fp, module, json_data, args.get('part_name')) _generate_prebuilt_target(fp, _target_type, module, is_ohos_ets_copy) - _generate_public_configs(fp, module) - _list = _generate_public_external_deps(fp, module, deps, components_json, public_deps_list, args) + if _target_type == "group": + _generate_group_configs(fp, module, json_data, args.get('part_name')) + else: + _generate_public_configs(fp, module) # 写入public_configs的,group就不写入 + if _target_type != "group": + _list = _generate_public_external_deps(fp, module, deps, components_json, public_deps_list, args) + else: + _list = public_deps_list _generate_static_public_deps(fp, args, static_deps_files, "") # 处理静态库依赖 if _target_type == "rust_library" or _target_type == "rust_proc_macro": _copy_rust_crate_info(fp, json_data) @@ -1972,10 +1911,7 @@ def _package_interface(args, parts_path_info, part_name, subsystem_name, compone if part_name in [ "musl", # 从obj/third_party/musl/usr 下提取到includes和libs "developer_test", # 同rust - "drivers_interface_display", # 驱动的, 新建一个libs目录/ innerapi同名文件 "runtime_core", # 编译参数, 所有下面的innerapi的cflags都不 - "drivers_interface_usb", # 同驱动 - "drivers_interface_ril", # 同驱动 "skia", ]: _process_part(args, parts_path_info, part_name, subsystem_name, components_json)