# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") import("//build/lite/config/component/lite_component.gni") import("//build/ohos.gni") ## Build contactsapi.so {{{ config("contactsapi_public_config") { visibility = [ ":*" ] include_dirs = [ "include" ] cflags = [] } jspath = "src/contact.js" # compile .js to .abc. action("gen_contact_abc") { visibility = [ ":*" ] script = "../../../../arkcompiler/ets_frontend/es2panda/scripts/generate_js_bytecode.py" args = [ "--src-js", rebase_path(jspath), "--dst-file", rebase_path(target_out_dir + "/contact.abc"), "--frontend-tool-path", rebase_path("${es2abc_build_path}"), "--module", ] deps = [ "../../../../arkcompiler/ets_frontend/es2panda:es2panda_build" ] inputs = [ jspath ] outputs = [ target_out_dir + "/contact.abc" ] } base_output_path = get_label_info(":contact_js", "target_out_dir") contact_obj_path = base_output_path + "/contact.o" gen_js_obj("contact_js") { input = jspath output = contact_obj_path dep = ":gen_contact_abc" } abc_output_path = get_label_info(":contact_abc", "target_out_dir") contact_abc_obj_path = abc_output_path + "/contact_abc.o" gen_js_obj("contact_abc") { input = "$target_out_dir/contact.abc" output = contact_abc_obj_path dep = ":gen_contact_abc" } ohos_shared_library("contact") { sources = [ "src/contacts_api.cpp", "src/contacts_build.cpp", "src/contacts_control.cpp", "src/contacts_napi_utils.cpp", "src/native_module.cpp", "src/result_convert.cpp", ] include_dirs = [ "//utils/system/safwk/native/include", "//commonlibrary/c_utils/base/include", "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", "//foundation/ability/ability_runtime/services/abilitymgr/include", "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native", ] public_configs = [ ":contactsapi_public_config" ] deps = [ ":contact_abc", ":contact_js", ] sanitize = { cfi = true cfi_cross_dso = true debug = false } external_deps = [ "ability_base:zuri", "ability_runtime:abilitykit_native", "ability_runtime:app_context", "ability_runtime:napi_base_context", "c_utils:utils", "data_share:datashare_consumer", "hilog:libhilog", "napi:ace_napi", "relational_store:native_dataability", "relational_store:native_rdb", ] defines = [ "CONTACTSDATA_LOG_TAG = \"ContactsApi\"", "LOG_DOMAIN = 0xD001F09", ] public_deps = [] relative_install_dir = "module" part_name = "contacts_data_hap" subsystem_name = "applications" } ## Build contactsapi.so }}}