1# Copyright (c) 2021-2024 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("//build/ohos_var.gni")
16import("//foundation/deviceprofile/device_info_manager/deviceprofile.gni")
17
18device_profile_common_sources =
19    [ "${old_device_profile_path}/common/src/device_profile_utils.cpp" ]
20
21config("device_info_manager_config") {
22  visibility = [ ":*" ]
23  visibility += [ "./test/*" ]
24  include_dirs = [
25    "include",
26    "include/authority",
27    "include/devicemanager",
28    "include/contentsensor",
29    "include/dbstorage",
30    "include/dfx",
31    "include/subscribemanager",
32    "${old_device_profile_path}/common/include",
33    "${old_device_profile_innerkits}/core/include",
34    "${old_device_profile_service}/core/include",
35    "${old_device_profile_path}/radar/include",
36    "${device_profile_service}/include/",
37    "${device_profile_service}/include/contentsensormanager",
38    "${device_profile_service}/include/deviceprofilemanager",
39    "${device_profile_service}/include/deviceprofilemanager/listener",
40    "${device_profile_service}/include/permissionmanager",
41    "${device_profile_service}/include/persistenceadapter/kvadapter",
42    "${device_profile_service}/include/persistenceadapter/rdbadapter",
43    "${device_profile_service}/include/subscribeprofilemanager",
44    "${device_profile_service}/include/trustprofilemanager",
45    "${device_profile_service}/include/utils",
46    "${device_profile_common}/include/constants",
47    "${device_profile_common}/include/interfaces",
48    "${device_profile_common}/include/utils",
49    "${third_party_json}/include",
50  ]
51}
52
53ohos_shared_library("distributed_device_profile") {
54  branch_protector_ret = "pac_ret"
55
56  cflags = [
57    "-fstack-protector-strong",
58    "-D_FORTIFY_SOURCE=2",
59    "-O2",
60  ]
61
62  cflags_cc = cflags
63
64  sanitize = {
65    boundary_sanitize = true
66    integer_overflow = true
67    ubsan = true
68    cfi = true
69    cfi_cross_dso = true
70    debug = false
71  }
72
73  install_enable = true
74  sources = [
75    "src/authority/authority_manager.cpp",
76    "src/authority/trust_group_manager.cpp",
77    "src/contentsensor/app_info_collector.cpp",
78    "src/contentsensor/content_collector.cpp",
79    "src/contentsensor/content_sensor_manager.cpp",
80    "src/contentsensor/device_info_collector.cpp",
81    "src/contentsensor/pasteboard_info_collector.cpp",
82    "src/contentsensor/storage_info_collector.cpp",
83    "src/contentsensor/syscap_info_collector.cpp",
84    "src/contentsensor/system_info_collector.cpp",
85    "src/dbstorage/device_profile_storage.cpp",
86    "src/dbstorage/device_profile_storage_manager.cpp",
87    "src/dbstorage/kvstore_death_recipient_dp.cpp",
88    "src/dbstorage/online_sync_table.cpp",
89    "src/dbstorage/sync_coordinator.cpp",
90    "src/devicemanager/device_info.cpp",
91    "src/devicemanager/dp_device_manager.cpp",
92    "src/dfx/device_profile_dumper.cpp",
93    "src/distributed_device_profile_service.cpp",
94    "src/distributed_device_profile_stub.cpp",
95    "src/profile_change_notification.cpp",
96    "src/service_characteristic_profile.cpp",
97    "src/subscribemanager/profile_change_handler.cpp",
98    "src/subscribemanager/profile_event_handler.cpp",
99    "src/subscribemanager/profile_event_handler_factory.cpp",
100    "src/subscribemanager/profile_event_notifier_proxy.cpp",
101    "src/subscribemanager/profile_sync_handler.cpp",
102    "src/subscribemanager/subscribe_info.cpp",
103    "src/subscribemanager/subscribe_info_checker.cpp",
104    "src/subscribemanager/subscribe_manager.cpp",
105    "src/subscribemanager/subscriber_death_recipient.cpp",
106    "src/sync_options.cpp",
107  ]
108  sources += device_profile_common_sources
109
110  configs = [
111    ":device_info_manager_config",
112    "${old_device_profile_test}/resource:coverage_flags",
113  ]
114
115  deps = [
116    "${device_profile_common}:distributed_device_profile_common",
117    "${device_profile_service}:distributed_device_profile_svr",
118    "${old_device_profile_path}/radar:deviceprofileradar",
119  ]
120
121  external_deps = [
122    "access_token:libaccesstoken_sdk",
123    "c_utils:utils",
124    "device_auth:deviceauth_sdk",
125    "device_manager:devicemanagersdk",
126    "dmsfwk:common_sdk",
127    "eventhandler:libeventhandler",
128    "hilog:libhilog",
129    "hisysevent:libhisysevent",
130    "hitrace:hitrace_meter",
131    "init:libbegetutil",
132    "ipc:ipc_core",
133    "kv_store:distributeddata_inner",
134    "relational_store:native_rdb",
135    "safwk:system_ability_fwk",
136    "samgr:samgr_proxy",
137    "syscap_codec:syscap_interface_shared",
138  ]
139
140  part_name = "device_info_manager"
141  subsystem_name = "deviceprofile"
142}
143
144group("unittest") {
145  testonly = true
146  deps = [ "test:unittest" ]
147}
148