• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/ts2panda/ts2abc_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/ts2panda/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    "--node",
38    rebase_path("${node_path}"),
39    "--frontend-tool-path",
40    rebase_path("${ts2abc_build_path}"),
41    "--node-modules",
42    rebase_path("${node_modules}"),
43    "--module",
44  ]
45  deps = [ "../../../../arkcompiler/ets_frontend/ts2panda:ark_ts2abc_build" ]
46  inputs = [ jspath ]
47  outputs = [ target_out_dir + "/contact.abc" ]
48}
49
50base_output_path = get_label_info(":contact_js", "target_out_dir")
51contact_obj_path = base_output_path + "/contact.o"
52gen_js_obj("contact_js") {
53  input = jspath
54  output = contact_obj_path
55  dep = ":gen_contact_abc"
56}
57
58abc_output_path = get_label_info(":contact_abc", "target_out_dir")
59contact_abc_obj_path = abc_output_path + "/contact_abc.o"
60gen_js_obj("contact_abc") {
61  input = "$target_out_dir/contact.abc"
62  output = contact_abc_obj_path
63  dep = ":gen_contact_abc"
64}
65
66ohos_shared_library("contact") {
67  sources = [
68    "src/contacts_api.cpp",
69    "src/contacts_build.cpp",
70    "src/contacts_control.cpp",
71    "src/contacts_napi_utils.cpp",
72    "src/native_module.cpp",
73    "src/result_convert.cpp",
74  ]
75
76  include_dirs = [
77    "//utils/system/safwk/native/include",
78    "//commonlibrary/c_utils/base/include",
79    "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
80    "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include",
81    "//foundation/ability/ability_runtime/services/abilitymgr/include",
82    "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native",
83  ]
84
85  public_configs = [ ":contactsapi_public_config" ]
86
87  deps = [
88    ":contact_abc",
89    ":contact_js",
90  ]
91
92  sanitize = {
93    cfi = true
94    debug = false
95  }
96
97  external_deps = [
98    "ability_base:zuri",
99    "ability_runtime:abilitykit_native",
100    "ability_runtime:app_context",
101    "ability_runtime:napi_base_context",
102    "c_utils:utils",
103    "data_share:datashare_consumer",
104    "napi:ace_napi",
105    "relational_store:native_dataability",
106    "relational_store:native_rdb",
107  ]
108
109  defines = [
110    "CONTACTSDATA_LOG_TAG = \"ContactsApi\"",
111    "LOG_DOMAIN = 0xD001F09",
112  ]
113
114  if (is_standard_system) {
115    external_deps += [ "hiviewdfx_hilog_native:libhilog" ]
116  } else {
117    external_deps += [ "hilog:libhilog" ]
118  }
119  public_deps = []
120  relative_install_dir = "module"
121  part_name = "contactsdata_hap"
122  subsystem_name = "applications"
123}
124## Build contactsapi.so }}}
125