1# Copyright (c) 2025 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/config/components/ets_frontend/ets2abc_config.gni") 15import("//build/ohos.gni") 16import("//build/ohos/taihe_idl/taihe.gni") 17import("../../../../powermgr.gni") 18 19copy_taihe_idl("copy_power_manager") { 20 sources = [ "idl/ohos.power.taihe" ] 21} 22 23ohos_taihe("run_taihe") { 24 taihe_generated_file_path = "${taihe_generated_file_path_power}" 25 deps = [ ":copy_power_manager" ] 26 outputs = [ 27 "$taihe_generated_file_path/src/ohos.power.ani.cpp", 28 "$taihe_generated_file_path/src/ohos.power.abi.c", 29 ] 30} 31 32taihe_shared_library("power_manager_taihe_native") { 33 branch_protector_ret = "pac_ret" 34 sanitize = { 35 cfi = true 36 cfi_cross_dso = true 37 debug = false 38 } 39 taihe_generated_file_path = "${taihe_generated_file_path_power}" 40 sources = get_target_outputs(":run_taihe") 41 include_dirs = [ "./include" ] 42 configs = [ 43 "${powermgr_utils_path}:utils_config", 44 "${powermgr_utils_path}:coverage_flags", 45 ] 46 sources += [ 47 "src/ani_constructor.cpp", 48 "src/ohos.power.impl.cpp", 49 ] 50 deps = [ 51 ":run_taihe", 52 "${powermgr_inner_api}:powermgr_client", 53 "${powermgr_utils_path}/appmgr:power_appmgr", 54 ] 55 external_deps = [ 56 "c_utils:utils", 57 "hilog:libhilog", 58 "ipc:ipc_core", 59 ] 60 if (has_ability_runtime_part) { 61 external_deps += [ "ability_runtime:app_manager" ] 62 } 63 64 subsystem_name = "powermgr" 65 part_name = "${powermgr_part_name}" 66} 67 68generate_static_abc("power_abc") { 69 base_url = "${taihe_generated_file_path_power}" 70 files = [ "${taihe_generated_file_path_power}/@ohos.power.ets" ] 71 is_boot_abc = "True" 72 device_dst_file = "/system/framework/power_abc.abc" 73 dependencies = [ ":run_taihe" ] 74} 75 76ohos_prebuilt_etc("power_abc_etc") { 77 source = "$target_out_dir/power_abc.abc" 78 module_install_dir = "framework" 79 subsystem_name = "powermgr" 80 part_name = "${powermgr_part_name}" 81 deps = [ ":power_abc" ] 82} 83