# 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("//build/config/components/ets_frontend/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 = "//build/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",
]
if (host_os == "linux") {
external_deps = [ "ets_frontend:es2panda(${toolchain_linux})" ]
}
if (host_os == "mac") {
external_deps = [ "ets_frontend:es2panda(${toolchain_mac})" ]
}
if (host_os == "ohos") {
external_deps = [ "ets_frontend:es2panda(${toolchain_ohos})" ]
}
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") {
cflags_cc = [
"-fstack-protector-strong",
"-D_FORTIFY_SOURCE=2",
"-O2",
]
sources = [
"src/contacts_api.cpp",
"src/contacts_sync_api.cpp",
"src/contacts_sync_operations.cpp",
"src/contacts_build.cpp",
"src/contacts_control.cpp",
"src/contacts_napi_utils.cpp",
"src/kit_pixel_map_util.cpp",
"src/native_module.cpp",
"src/result_convert.cpp",
"src/contacts_telephony_permission.cpp",
"src/kit_bundle_mgr_helper.cpp",
"src/sync_json_helper.cpp",
]
public_configs = [ ":contactsapi_public_config" ]
deps = [
":contact_abc",
":contact_js",
]
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
external_deps = [
"ability_base:want",
"ability_base:zuri",
"ability_runtime:ability_context_native",
"ability_runtime:abilitykit_native",
"ability_runtime:app_context",
"ability_runtime:app_manager",
"ability_runtime:extensionkit_native",
"ability_runtime:napi_base_context",
"ability_runtime:napi_common",
"ability_runtime:ui_extension",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"app_file_service:fileuri_native",
"protobuf:protobuf_lite",
"c_utils:utils",
"data_share:datashare_consumer",
"hilog:libhilog",
"napi:ace_napi",
"relational_store:native_dataability",
"relational_store:native_rdb",
"access_token:libaccesstoken_sdk",
"access_token:libprivacy_sdk",
"image_framework:image",
"ipc:ipc_single",
"ace_engine:ace_uicontent",
"window_manager:libwm",
"i18n:intl_util",
"libphonenumber:phonenumber_standard",
"libphonenumber:geocoding",
"protobuf:protobuf_lite",
"protobuf:protobuf",
# "protobuf:protoc_lib",
"samgr:samgr_proxy",
]
defines = [
"CONTACTSDATA_LOG_TAG = \"ContactsApi\"",
"LOG_DOMAIN = 0xD001F09",
]
relative_install_dir = "module"
part_name = "contacts_data"
subsystem_name = "applications"
}
## Build contactsapi.so }}}