1# Copyright (C) 2025-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") #导入taige.gni 17 18copy_taihe_idl("copy_telephonysms") { 19 sources = [ "idl/ohos.telephony.sms.taihe" ] 20 21} 22subsystem_name = "telephony" 23part_name = "sms_mms" 24taihe_generated_file_path = "$taihe_file_path/out/$subsystem_name/$part_name" #建议直接用此路径 25 26ohos_taihe("run_taihe") { #调用ohos_taihe模板,生成文件在/out/rk3568/taihe/out/security/crypto_framework文件夹下 27 taihe_generated_file_path = "$taihe_generated_file_path" 28 deps = [ ":copy_telephonysms" ] 29 outputs = [ 30 "$taihe_generated_file_path/src/ohos.telephony.sms.ani.cpp", 31 "$taihe_generated_file_path/src/ohos.telephony.sms.abi.c", 32 ] 33} 34 35taihe_shared_library("telephony_sms_taihe_native") { #调用taihe_shared_library模板编译so 36 taihe_generated_file_path = "$taihe_generated_file_path" 37 part_name = "$part_name" 38 subsystem_name = "$subsystem_name" 39 sources = get_target_outputs(":run_taihe") 40 include_dirs = [ "../../js/napi/include" ] #根据业务需求添加include目录 41 sources += [ 42 "src/ani_constructor.cpp", 43 "src/ohos.telephony.sms.impl.cpp", 44 ] 45 deps = [ 46 ":run_taihe", 47 "//base/telephony/sms_mms/frameworks/native:tel_sms_mms_api" #根据业务添加编译依赖 48 ] 49 50 external_deps = [ 51 "ability_base:base", 52 "ability_base:want", 53 "ability_runtime:ability_manager", 54 "ability_runtime:napi_common", 55 "c_utils:utils", 56 "core_service:libtel_common", 57 "core_service:tel_core_service_api", 58 "hilog:libhilog", 59 "image_framework:image", 60 "image_framework:image_native", 61 "init:libbegetutil", 62 "libuv:uv", 63 "napi:ace_napi", 64 ] 65 66 sanitize = { 67 cfi = false # napi target, not required to enable cfi 68 cfi_cross_dso = false 69 debug = false 70 } 71 branch_protector_ret = "pac_ret" 72} 73generate_static_abc("telephony_sms_abc") { #调用generate_static_abc编译abc 74 base_url = "$taihe_generated_file_path" #base_url直接设置为taihe_generated_file_path 75 files = [ "$taihe_generated_file_path/@ohos.telephony.sms.ets" ] #files传入生成的ets文件 76 is_boot_abc = "True" 77 device_dst_file = "/system/framework/telephony_sms_abc.abc" 78 dependencies = [ ":run_taihe" ] #编译abc依赖太和工具链调用 79} 80 81ohos_prebuilt_etc("telephony_sms_etc") { #调用ohos_prebuilt_etc将abc拷贝到/system/framework下 82 source = "$target_out_dir/telephony_sms_abc.abc" 83 module_install_dir = "framework" 84 part_name = "$part_name" 85 subsystem_name = "$subsystem_name" 86 deps = [ ":telephony_sms_abc" ] #拷贝abc依赖编译abc 87} 88group("telephony_sms_taihe") { 89 deps = [ 90 ":telephony_sms_etc", 91 ":telephony_sms_taihe_native", 92 ] 93}