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("//arkcompiler/ets_frontend/es2panda/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. 28action("gen_contact_abc") { 29 visibility = [ ":*" ] 30 script = "../../../../arkcompiler/ets_frontend/es2panda/scripts/generate_js_bytecode.py" 31 32 args = [ 33 "--src-js", 34 rebase_path(jspath), 35 "--dst-file", 36 rebase_path(target_out_dir + "/contact.abc"), 37 "--frontend-tool-path", 38 rebase_path("${es2abc_build_path}"), 39 "--module", 40 ] 41 deps = [ "../../../../arkcompiler/ets_frontend/es2panda:es2panda_build" ] 42 inputs = [ jspath ] 43 outputs = [ target_out_dir + "/contact.abc" ] 44} 45 46base_output_path = get_label_info(":contact_js", "target_out_dir") 47contact_obj_path = base_output_path + "/contact.o" 48gen_js_obj("contact_js") { 49 input = jspath 50 output = contact_obj_path 51 dep = ":gen_contact_abc" 52} 53 54abc_output_path = get_label_info(":contact_abc", "target_out_dir") 55contact_abc_obj_path = abc_output_path + "/contact_abc.o" 56gen_js_obj("contact_abc") { 57 input = "$target_out_dir/contact.abc" 58 output = contact_abc_obj_path 59 dep = ":gen_contact_abc" 60} 61 62ohos_shared_library("contact") { 63 sources = [ 64 "src/contacts_api.cpp", 65 "src/contacts_build.cpp", 66 "src/contacts_control.cpp", 67 "src/contacts_napi_utils.cpp", 68 "src/contacts_telephony_permission.cpp", 69 "src/native_module.cpp", 70 "src/result_convert.cpp", 71 ] 72 73 include_dirs = [ 74 "//utils/system/safwk/native/include", 75 "//commonlibrary/c_utils/base/include", 76 "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", 77 "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", 78 "//foundation/ability/ability_runtime/services/abilitymgr/include", 79 "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native", 80 ] 81 82 public_configs = [ ":contactsapi_public_config" ] 83 84 deps = [ 85 ":contact_abc", 86 ":contact_js", 87 ] 88 89 sanitize = { 90 cfi = true 91 cfi_cross_dso = true 92 debug = false 93 } 94 95 external_deps = [ 96 "ability_base:zuri", 97 "ability_runtime:abilitykit_native", 98 "ability_runtime:app_context", 99 "ability_runtime:extensionkit_native", 100 "ability_runtime:napi_base_context", 101 "access_token:libaccesstoken_sdk", 102 "access_token:libprivacy_sdk", 103 "c_utils:utils", 104 "data_share:datashare_consumer", 105 "hilog:libhilog", 106 "ipc:ipc_single", 107 "napi:ace_napi", 108 "relational_store:native_dataability", 109 "relational_store:native_rdb", 110 ] 111 112 defines = [ 113 "CONTACTSDATA_LOG_TAG = \"ContactsApi\"", 114 "LOG_DOMAIN = 0xD001F09", 115 ] 116 117 public_deps = [] 118 relative_install_dir = "module" 119 part_name = "contacts_data" 120 subsystem_name = "applications" 121} 122## Build contactsapi.so }}} 123