1# Copyright (c) 2022-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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16} else {
17  import("//build/ohos.gni")
18}
19
20import("//foundation/distributedhardware/device_manager/device_manager.gni")
21
22if (defined(ohos_lite)) {
23  if (ohos_kernel_type == "linux") {
24    shared_library("devicemanagerserviceimpl") {
25      include_dirs = [
26        "include",
27        "include/ability",
28        "include/adapter",
29        "include/credential",
30        "include/dependency/hichain",
31        "include/dependency/softbus",
32        "include/devicestate",
33        "${common_path}/include",
34        "${common_path}/include/ipc",
35        "${common_path}/include/ipc/model",
36        "${common_path}/include/dfx",
37        "${common_path}/include/dfx/lite",
38        "${devicemanager_path}/commondependency/include",
39        "${innerkits_path}/native_cpp/include",
40        "${devicemanager_path}/radar/include",
41        "${utils_path}/include",
42        "${utils_path}/include/appInfo/lite",
43        "${utils_path}/include/crypto",
44        "${utils_path}/include/fwkload/lite",
45        "${utils_path}/include/timer/lite",
46        "//third_party/json/include",
47        "${services_path}/include",
48        "${services_path}/include/ipc/lite",
49        "${interfaces_path}/c/ipc/include",
50        "//foundation/distributedshedule/samgr_lite/interfaces/kits/samgr",
51        "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
52        "//commonlibrary/c_utils/base/include",
53        "${softbuscache_parh}/include",
54      ]
55
56      sources = [
57        "${devicemanager_path}/commondependency/src/multiple_user_connector.cpp",
58        "src/ability/lite/dm_ability_manager.cpp",
59        "src/adapter/lite/dm_adapter_manager.cpp",
60        "src/credential/dm_credential_manager.cpp",
61        "src/dependency/hichain/hichain_auth_connector.cpp",
62        "src/dependency/hichain/hichain_connector.cpp",
63        "src/dependency/hichain/mine_hichain_connector.cpp",
64        "src/dependency/softbus/softbus_connector.cpp",
65        "src/device_manager_service_impl_lite.cpp",
66        "src/devicestate/dm_device_state_manager.cpp",
67      ]
68
69      defines = [
70        "LITE_DEVICE",
71        "DH_LOG_ENABLE",
72        "DH_LOG_TAG=\"devicemanagerserviceimpl\"",
73        "LOG_DOMAIN=0xD004110",
74      ]
75
76      deps = [
77        "${devicemanager_path}/radar:devicemanagerradar",
78        "${softbuscache_parh}:dmdevicecache",
79        "${utils_path}:devicemanagerutils",
80        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
81        "//base/security/device_auth/services:deviceauth_sdk",
82        "//base/startup/init/interfaces/innerkits:libbegetutil",
83        "//commonlibrary/utils_lite:utils",
84        "//foundation/communication/dsoftbus:dsoftbus",
85        "//foundation/systemabilitymgr/safwk_lite:safwk_lite",
86        "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
87        "//third_party/bounds_checking_function:libsec_shared",
88      ]
89
90      cflags = [
91        "-Wall",
92        "-O2",
93        "-Wdate-time",
94        "-Wextra",
95        "-Wfloat-equal",
96        "-Wshadow",
97      ]
98
99      cflags_cc = cflags
100    }
101  }
102} else if (!support_jsapi) {
103  group("devicemanagerserviceimpl") {
104    deps = []
105  }
106} else {
107  config("devicemanagerserviceimpl_config") {
108    include_dirs = [
109      "include",
110      "include/config",
111      "include/adapter",
112      "include/authentication",
113      "include/authentication/showconfirm/standard",
114      "include/ability",
115      "include/credential",
116      "include/devicestate",
117      "include/discovery",
118      "include/publish",
119      "include/dependency/commonevent",
120      "include/dependency/deviceprofile",
121      "include/dependency/multipleuser",
122      "include/dependency/hichain",
123      "include/dependency/softbus",
124      "${common_path}/include",
125      "${common_path}/include/dfx",
126      "${common_path}/include/dfx/standard",
127      "${common_path}/include/ipc",
128      "${common_path}/include/ipc/model",
129      "${devicemanager_path}/commondependency/include",
130      "${devicemanager_path}/radar/include",
131      "${innerkits_path}/native_cpp/include",
132      "${utils_path}/include",
133      "${utils_path}/include/appInfo/standard",
134      "${utils_path}/include/crypto",
135      "${utils_path}/include/dfx",
136      "${utils_path}/include/dfx/standard",
137      "${utils_path}/include/fwkload/standard",
138      "${utils_path}/include/permission/standard",
139      "${utils_path}/include/timer",
140      "${services_path}/include",
141      "${services_path}/include/ipc/standard",
142      "${softbuscache_parh}/include",
143    ]
144  }
145
146  ohos_shared_library("devicemanagerserviceimpl") {
147    branch_protector_ret = "pac_ret"
148
149    sanitize = {
150      boundary_sanitize = true
151      cfi = true
152      cfi_cross_dso = true
153      debug = false
154      integer_overflow = true
155      ubsan = true
156    }
157
158    sources = [
159      "src/ability/standard/dm_ability_manager.cpp",
160      "src/ability/standard/dm_dialog_manager.cpp",
161      "src/adapter/standard/dm_adapter_manager.cpp",
162      "src/authentication/auth_message_processor.cpp",
163      "src/authentication/auth_request_state.cpp",
164      "src/authentication/auth_response_state.cpp",
165      "src/authentication/auth_ui_state_manager.cpp",
166      "src/authentication/dm_auth_manager.cpp",
167      "src/authentication/showconfirm/standard/show_confirm.cpp",
168      "src/config/dm_config_manager.cpp",
169      "src/credential/dm_credential_manager.cpp",
170      "src/dependency/commonevent/dm_common_event_manager.cpp",
171      "src/dependency/hichain/hichain_auth_connector.cpp",
172      "src/dependency/hichain/hichain_connector.cpp",
173      "src/dependency/hichain/mine_hichain_connector.cpp",
174      "src/dependency/softbus/softbus_connector.cpp",
175      "src/dependency/softbus/softbus_session.cpp",
176      "src/device_manager_service_impl.cpp",
177      "src/devicestate/dm_device_state_manager.cpp",
178      "src/discovery/dm_discovery_filter.cpp",
179      "src/discovery/dm_discovery_manager.cpp",
180      "src/publish/dm_publish_manager.cpp",
181    ]
182
183    public_configs = [ ":devicemanagerserviceimpl_config" ]
184
185    defines = [
186      "HI_LOG_ENABLE",
187      "DH_LOG_TAG=\"devicemanagerserviceimpl\"",
188      "LOG_DOMAIN=0xD004110",
189    ]
190
191    deps = [
192      "${devicemanager_path}/commondependency:devicemanagerdependency",
193      "${devicemanager_path}/radar:devicemanagerradar",
194      "${innerkits_path}/native_cpp:devicemanagersdk",
195      "${softbuscache_parh}:dmdevicecache",
196      "${utils_path}:devicemanagerutils",
197    ]
198
199    external_deps = [
200      "ability_base:want",
201      "ability_runtime:ability_manager",
202      "access_token:libaccesstoken_sdk",
203      "bundle_framework:appexecfwk_base",
204      "bundle_framework:appexecfwk_core",
205      "c_utils:utils",
206      "common_event_service:cesfwk_core",
207      "common_event_service:cesfwk_innerkits",
208      "device_auth:deviceauth_sdk",
209      "device_info_manager:distributed_device_profile_common",
210      "device_info_manager:distributed_device_profile_sdk",
211      "dsoftbus:softbus_client",
212      "ffrt:libffrt",
213      "hilog:libhilog",
214      "init:libbegetutil",
215      "ipc:ipc_core",
216      "os_account:libaccountkits",
217      "resource_management:resmgr_napi_core",
218      "samgr:samgr_proxy",
219    ]
220
221    if (support_screenlock && device_manager_feature_product == "default") {
222      defines += [ "SUPPORT_SCREENLOCK" ]
223      external_deps += [ "screenlock_mgr:screenlock_client" ]
224    }
225
226    public_external_deps = [ "json:nlohmann_json_static" ]
227
228    subsystem_name = "distributedhardware"
229
230    part_name = "device_manager"
231  }
232}
233