1# Copyright (c) 2021-2022 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/es2abc_config.gni") 15import("//build/lite/config/component/lite_component.gni") 16import("//build/ohos.gni") 17 18## Build contactsapi.so {{{ 19config("contactsapi_public_config") { 20 visibility = [ ":*" ] 21 include_dirs = [ "include" ] 22 cflags = [] 23} 24 25jspath = "src/contact.js" 26 27# compile .js to .abc. 28es2abc_gen_abc("gen_contact_abc") { 29 src_js = rebase_path(jspath) 30 dst_file = rebase_path(target_out_dir + "/contact.abc") 31 32 extra_args = [ "--module" ] 33 in_puts = [ jspath ] 34 out_puts = [ target_out_dir + "/contact.abc" ] 35} 36 37base_output_path = get_label_info(":contact_js", "target_out_dir") 38contact_obj_path = base_output_path + "/contact.o" 39gen_js_obj("contact_js") { 40 input = jspath 41 output = contact_obj_path 42 dep = ":gen_contact_abc" 43} 44 45abc_output_path = get_label_info(":contact_abc", "target_out_dir") 46contact_abc_obj_path = abc_output_path + "/contact_abc.o" 47gen_js_obj("contact_abc") { 48 input = "$target_out_dir/contact.abc" 49 output = contact_abc_obj_path 50 dep = ":gen_contact_abc" 51} 52 53ohos_shared_library("contact") { 54 sources = [ 55 "src/contacts_api.cpp", 56 "src/contacts_build.cpp", 57 "src/contacts_control.cpp", 58 "src/contacts_napi_utils.cpp", 59 "src/contacts_telephony_permission.cpp", 60 "src/native_module.cpp", 61 "src/result_convert.cpp", 62 ] 63 64 include_dirs = [ 65 ] 66 67 public_configs = [ ":contactsapi_public_config" ] 68 69 deps = [ 70 ":contact_abc", 71 ":contact_js", 72 ] 73 74 sanitize = { 75 cfi = true 76 cfi_cross_dso = true 77 debug = false 78 } 79 80 external_deps = [ 81 "ability_base:zuri", 82 "ability_runtime:abilitykit_native", 83 "ability_runtime:app_context", 84 "ability_runtime:app_manager", 85 "ability_runtime:extensionkit_native", 86 "ability_runtime:napi_base_context", 87 "access_token:libaccesstoken_sdk", 88 "access_token:libprivacy_sdk", 89 "c_utils:utils", 90 "data_share:datashare_consumer", 91 "hilog:libhilog", 92 "ipc:ipc_single", 93 "napi:ace_napi", 94 "relational_store:native_dataability", 95 "relational_store:native_rdb", 96 "samgr:samgr_proxy", 97 ] 98 99 defines = [ 100 "CONTACTSDATA_LOG_TAG = \"ContactsApi\"", 101 "LOG_DOMAIN = 0xD001F09", 102 ] 103 104 public_deps = [] 105 relative_install_dir = "module" 106 part_name = "contacts_data" 107 subsystem_name = "applications" 108} 109## Build contactsapi.so }}} 110