1# Copyright (c) 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/ohos.gni")
15import("//foundation/distributeddatamgr/data_share/datashare.gni")
16
17config("ability_config") {
18  visibility = [ ":*" ]
19  include_dirs = [
20    "common/include",
21    "consumer/include",
22    "provider/include",
23    "${datashare_native_consumer_path}/include",
24    "${datashare_native_provider_path}/include",
25    "${datashare_native_proxy_path}/include",
26  ]
27
28  cflags = []
29  if (target_cpu == "arm") {
30    cflags += [ "-DBINDER_IPC_32BIT" ]
31  }
32}
33
34config("datashare_public_config") {
35  visibility = [ ":*" ]
36  include_dirs = [
37    "common/include",
38    "consumer/include",
39    "provider/include",
40    "${datashare_common_native_path}/include",
41    "${datashare_native_consumer_path}/controller/common",
42    "${datashare_native_consumer_path}/controller/provider/include",
43    "${datashare_native_consumer_path}/controller/service/include",
44    "${datashare_native_consumer_path}/include",
45    "${datashare_native_provider_path}/include",
46    "${datashare_native_proxy_path}/include",
47  ]
48}
49
50datashare_consumer_sources = [
51  "${datashare_common_native_path}/src/call_reporter.cpp",
52  "${datashare_common_native_path}/src/datashare_string_utils.cpp",
53  "${datashare_native_consumer_path}/controller/provider/src/ext_special_controller.cpp",
54  "${datashare_native_consumer_path}/controller/provider/src/general_controller_provider_impl.cpp",
55  "${datashare_native_consumer_path}/controller/service/src/general_controller_service_impl.cpp",
56  "${datashare_native_consumer_path}/controller/service/src/persistent_data_controller.cpp",
57  "${datashare_native_consumer_path}/controller/service/src/published_data_controller.cpp",
58  "${datashare_native_consumer_path}/src/datashare_connection.cpp",
59  "${datashare_native_consumer_path}/src/datashare_helper.cpp",
60  "${datashare_native_consumer_path}/src/datashare_helper_impl.cpp",
61  "${datashare_native_consumer_path}/src/datashare_proxy.cpp",
62  "${datashare_native_proxy_path}/src/ams_mgr_proxy.cpp",
63  "${datashare_native_proxy_path}/src/data_proxy_observer_stub.cpp",
64  "${datashare_native_proxy_path}/src/data_share_manager_impl.cpp",
65  "${datashare_native_proxy_path}/src/data_share_service_proxy.cpp",
66  "${datashare_native_proxy_path}/src/idata_share_client_death_observer.cpp",
67  "${datashare_native_proxy_path}/src/published_data_subscriber_manager.cpp",
68  "${datashare_native_proxy_path}/src/rdb_subscriber_manager.cpp",
69]
70
71datashare_consumer_external_deps = [
72  "ability_base:want",
73  "ability_base:zuri",
74  "ability_runtime:app_context",
75  "ability_runtime:extension_manager",
76  "c_utils:utils",
77  "common_event_service:cesfwk_innerkits",
78  "hilog:libhilog",
79  "hisysevent:libhisysevent",
80  "hitrace:hitrace_meter",
81  "hitrace:libhitracechain",
82  "ipc:ipc_single",
83  "ipc:rpc",
84  "samgr:samgr_proxy",
85]
86
87config("permission_config") {
88  visibility = [ ":*" ]
89  include_dirs = [
90    "common/include",
91    "permission/include",
92    "${datashare_common_native_path}/include",
93    "${datashare_native_permission_path}/include",
94  ]
95}
96
97config("permission_public_config") {
98  visibility = [ ":*" ]
99  include_dirs = [
100    "common/include",
101    "permission/include",
102  ]
103}
104
105ohos_shared_library("datashare_consumer") {
106  branch_protector_ret = "pac_ret"
107  sanitize = {
108    ubsan = true
109    boundary_sanitize = true
110    cfi = true
111    cfi_cross_dso = true
112    debug = false
113  }
114  include_dirs = [ "${datashare_common_native_path}/include" ]
115
116  sources = datashare_consumer_sources
117  configs = [ ":ability_config" ]
118  public_configs = [ ":datashare_public_config" ]
119  version_script = "consumer/libdatashare_consumer.map"
120  innerapi_tags = [
121    "platformsdk",
122    "sasdk",
123  ]
124  deps = [ "${datashare_innerapi_path}/common:datashare_common" ]
125
126  external_deps = datashare_consumer_external_deps
127
128  public_external_deps = [
129    "ability_runtime:dataobs_manager",
130    "kv_store:distributeddata_inner",
131  ]
132
133  subsystem_name = "distributeddatamgr"
134  part_name = "data_share"
135}
136
137ohos_shared_library("datashare_permission") {
138  branch_protector_ret = "pac_ret"
139  sanitize = {
140    ubsan = true
141    boundary_sanitize = true
142    cfi = true
143    cfi_cross_dso = true
144    debug = false
145  }
146  include_dirs = []
147
148  sources = [
149    "${datashare_common_native_path}/src/datashare_string_utils.cpp",
150    "${datashare_native_permission_path}/src/data_share_called_config.cpp",
151    "${datashare_native_permission_path}/src/data_share_permission.cpp",
152  ]
153  configs = [ ":permission_config" ]
154  public_configs = [ ":permission_public_config" ]
155  version_script = "permission/libdatashare_permission.map"
156  innerapi_tags = [ "platformsdk" ]
157  deps = [ "${datashare_innerapi_path}/common:datashare_common" ]
158
159  external_deps = [
160    "ability_base:zuri",
161    "ability_runtime:app_context",
162    "ability_runtime:runtime",
163    "access_token:libaccesstoken_sdk",
164    "bundle_framework:appexecfwk_base",
165    "bundle_framework:appexecfwk_core",
166    "bundle_framework:libappexecfwk_common",
167    "c_utils:utils",
168    "common_event_service:cesfwk_innerkits",
169    "hilog:libhilog",
170    "ipc:ipc_single",
171    "samgr:samgr_proxy",
172  ]
173
174  subsystem_name = "distributeddatamgr"
175  part_name = "data_share"
176}
177
178ohos_shared_library("datashare_provider") {
179  branch_protector_ret = "pac_ret"
180  sanitize = {
181    ubsan = true
182    boundary_sanitize = true
183    cfi = true
184    cfi_cross_dso = true
185    debug = false
186  }
187  include_dirs = [ "${datashare_common_napi_path}/include" ]
188
189  sources = [
190    "${datashare_common_native_path}/src/datashare_string_utils.cpp",
191    "${datashare_native_provider_path}/src/datashare_ext_ability.cpp",
192    "${datashare_native_provider_path}/src/datashare_ext_ability_context.cpp",
193    "${datashare_native_provider_path}/src/datashare_stub.cpp",
194    "${datashare_native_provider_path}/src/datashare_stub_impl.cpp",
195    "${datashare_native_provider_path}/src/datashare_uv_queue.cpp",
196    "${datashare_native_provider_path}/src/js_datashare_ext_ability.cpp",
197    "${datashare_native_provider_path}/src/js_datashare_ext_ability_context.cpp",
198  ]
199  configs = [ ":ability_config" ]
200  public_configs = [ ":datashare_public_config" ]
201  version_script = "provider/libdatashare_provider.map"
202  innerapi_tags = [ "platformsdk" ]
203  deps = [
204    "${datashare_innerapi_path}/common:datashare_common",
205    "${datashare_napi_path}/dataShare:datashare_jscommon",
206  ]
207
208  external_deps = [
209    "ability_base:want",
210    "ability_base:zuri",
211    "ability_runtime:ability_context_native",
212    "ability_runtime:abilitykit_native",
213    "ability_runtime:app_context",
214    "ability_runtime:runtime",
215    "access_token:libaccesstoken_sdk",
216    "c_utils:utils",
217    "common_event_service:cesfwk_innerkits",
218    "hilog:libhilog",
219    "hisysevent:libhisysevent",
220    "ipc:ipc_napi",
221    "ipc:ipc_single",
222    "kv_store:distributeddata_inner",
223    "napi:ace_napi",
224    "samgr:samgr_proxy",
225  ]
226
227  public_external_deps = [ "ability_runtime:dataobs_manager" ]
228
229  subsystem_name = "distributeddatamgr"
230  part_name = "data_share"
231}
232
233ohos_shared_library("datashare_ext_ability_module") {
234  branch_protector_ret = "pac_ret"
235  sanitize = {
236    ubsan = true
237    boundary_sanitize = true
238    cfi = true
239    cfi_cross_dso = true
240    debug = false
241  }
242  include_dirs = [ "${datashare_native_provider_path}/include" ]
243
244  sources = [ "${datashare_native_provider_path}/src/datashare_ext_ability_module_loader.cpp" ]
245
246  configs = [ ":ability_config" ]
247  public_configs = [ ":datashare_public_config" ]
248
249  deps = [ ":datashare_provider" ]
250
251  external_deps = [
252    "ability_base:want",
253    "ability_runtime:abilitykit_native",
254    "ability_runtime:runtime",
255    "c_utils:utils",
256    "common_event_service:cesfwk_innerkits",
257    "hilog:libhilog",
258    "napi:ace_napi",
259  ]
260
261  relative_install_dir = "extensionability/"
262  subsystem_name = "distributeddatamgr"
263  part_name = "data_share"
264}
265
266ohos_static_library("datashare_consumer_static") {
267  branch_protector_ret = "pac_ret"
268  sanitize = {
269    ubsan = true
270    boundary_sanitize = true
271    cfi = true
272    cfi_cross_dso = true
273    debug = false
274  }
275  include_dirs = [ "${datashare_common_native_path}/include" ]
276
277  sources = datashare_consumer_sources
278  configs = [ ":ability_config" ]
279  public_configs = [ ":datashare_public_config" ]
280  deps = [ "${datashare_innerapi_path}/common:datashare_common_static" ]
281
282  external_deps = datashare_consumer_external_deps
283
284  public_external_deps = [ "kv_store:distributeddata_inner" ]
285
286  subsystem_name = "distributeddatamgr"
287  part_name = "data_share"
288}
289