• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2023 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("os_account_service.gni")
16
17ohos_prebuilt_etc("accountmgr.init") {
18  source = "accountmgr.cfg"
19  relative_install_dir = "init"
20  subsystem_name = "account"
21  part_name = "os_account"
22}
23
24ohos_prebuilt_etc("osaccount_constraint") {
25  source = "osaccount_constraints.json"
26  relative_install_dir = "account"
27  subsystem_name = "account"
28  part_name = "os_account"
29}
30
31ohos_prebuilt_etc("constraints_list_collection") {
32  source = "constraints_list_collection.json"
33  relative_install_dir = "account"
34  subsystem_name = "account"
35  part_name = "os_account"
36}
37
38config("accountmgr_config") {
39  include_dirs = [
40    "./include",
41    "./include/ability_manager_adapter",
42    "./include/appaccount",
43    "./include/osaccount",
44    "${innerkits_path}/include",
45    "${os_account_dfx_path}/hidumper_adapter",
46    "${app_account_interfaces_native_path}/include",
47    "${os_account_dfx_path}/hisysevent_adapter",
48    "${os_account_dfx_path}/hitrace_adapter",
49    "${app_account_innerkits_native_path}/include",
50    "//third_party/json/include",
51  ]
52}
53
54config("account_iam_config") {
55  include_dirs = [ "${account_iam_interfaces_native_path}/include" ]
56}
57
58config("domain_account_config") {
59  include_dirs = [
60    "include/domain_account",
61    "${domain_account_framework_path}/include",
62    "${domain_account_interfaces_native_path}/include",
63  ]
64}
65
66config("ability_manager_config") {
67  include_dirs = [
68    "${ability_runtime_path}/interfaces/inner_api/ability_manager/include",
69    "${ability_runtime_path}/ability_base/interfaces/inner_api/want/include",
70    "${ability_runtime_path}/services/abilitymgr/include",
71    "${ability_runtime_path}/services/common/include",
72  ]
73}
74
75config("accountmgr_public_config") {
76  visibility = [ ":*" ]
77
78  include_dirs = [
79    "${services_path}/accountmgr/include",
80    "${services_path}/accountmgr/include/appaccount",
81    "${services_path}/accountmgr/include/osaccount",
82    "${services_path}/accountmgr/include/domain_account",
83  ]
84
85  if (has_user_auth_part) {
86    include_dirs += [ "${services_path}/accountmgr/include/account_iam" ]
87  }
88}
89
90config("bundle_manager_config") {
91  include_dirs = [
92    "${services_path}/accountmgr/include/bundle_manager_adapter",
93    "${bundle_framework_path}/common/log/include",
94    "${bundle_framework_path}/interfaces/inner_api/appexecfwk_core/include",
95  ]
96}
97
98ability_manager_sources = [
99  "${ability_runtime_path}/services/abilitymgr/src/ability_connect_callback_stub.cpp",
100  "${ability_runtime_path}/services/abilitymgr/src/stop_user_callback_stub.cpp",
101  "src/ability_manager_adapter/ability_manager_adapter.cpp",
102]
103
104if (has_kv_store_part) {
105  app_account_sources = [
106    "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_proxy.cpp",
107    "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_stub.cpp",
108    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_proxy.cpp",
109    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_service.cpp",
110    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_stub.cpp",
111    "${app_account_innerkits_native_path}/src/app_account_common.cpp",
112    "${app_account_innerkits_native_path}/src/app_account_info.cpp",
113    "${app_account_innerkits_native_path}/src/app_account_subscribe_info.cpp",
114    "src/appaccount/app_account_app_state_observer.cpp",
115    "src/appaccount/app_account_authenticator_callback.cpp",
116    "src/appaccount/app_account_authenticator_manager.cpp",
117    "src/appaccount/app_account_authenticator_proxy.cpp",
118    "src/appaccount/app_account_authenticator_session.cpp",
119    "src/appaccount/app_account_authenticator_session_manager.cpp",
120    "src/appaccount/app_account_authorization_extension_proxy.cpp",
121    "src/appaccount/app_account_check_labels_callback.cpp",
122    "src/appaccount/app_account_check_labels_session.cpp",
123    "src/appaccount/app_account_common_event_observer.cpp",
124    "src/appaccount/app_account_common_event_subscriber.cpp",
125    "src/appaccount/app_account_control_manager.cpp",
126    "src/appaccount/app_account_data_storage.cpp",
127    "src/appaccount/app_account_event_proxy.cpp",
128    "src/appaccount/app_account_manager_service.cpp",
129    "src/appaccount/app_account_stub.cpp",
130    "src/appaccount/app_account_subscribe_death_recipient.cpp",
131    "src/appaccount/app_account_subscribe_manager.cpp",
132    "src/appaccount/inner_app_account_manager.cpp",
133  ]
134}
135
136if (has_user_auth_part) {
137  account_iam_sources = [
138    "src/account_iam/account_iam_callback.cpp",
139    "src/account_iam/account_iam_client_callback_proxy.cpp",
140    "src/account_iam/account_iam_mgr_stub.cpp",
141    "src/account_iam/account_iam_service.cpp",
142    "src/account_iam/inner_account_iam_manager.cpp",
143  ]
144}
145
146bundle_manager_sources = [
147  "${bundle_framework_path}/common/log/src/app_log_wrapper.cpp",
148  "src/bundle_manager_adapter/bundle_manager_adapter.cpp",
149  "src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp",
150  "src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp",
151]
152
153ohos_shared_library("accountmgr") {
154  branch_protector_ret = "pac_ret"
155
156  sanitize = {
157    cfi = true
158    cfi_cross_dso = true
159    debug = false
160    blocklist = "${os_account_path}/cfi_blocklist.txt"
161  }
162
163  visibility = [ "${os_account_path}/*" ]
164  cflags = [ "-pipe" ]
165  if (!use_clang_coverage) {
166    version_script = "libaccountmgr.map"
167  }
168  cflags_cc = [
169    "-Wdate-time",
170    "-Wformat=2",
171    "-Wfloat-equal",
172    "-Wshadow",
173  ]
174  if (os_account_multiple_active_accounts) {
175    cflags += [ "-DENABLE_MULTIPLE_ACTIVE_ACCOUNTS" ]
176  }
177
178  if (os_account_support_deactivate_main_os_account) {
179    cflags += [ "-DSUPPROT_STOP_MAIN_OS_ACCOUNT" ]
180  }
181
182  if (os_account_distributed_feature) {
183    cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ]
184  }
185
186  if (os_account_enable_multiple_os_accounts || use_clang_coverage) {
187    cflags += [ "-DENABLE_MULTIPLE_OS_ACCOUNTS" ]
188  }
189
190  if (os_account_enable_default_admin_name) {
191    cflags += [ "-DENABLE_DEFAULT_ADMIN_NAME" ]
192  }
193
194  if (os_account_enable_account_short_name) {
195    cflags += [ "-DENABLE_ACCOUNT_SHORT_NAME" ]
196  }
197
198  sources = [
199    "${common_path}/utils/src/account_permission_manager.cpp",
200    "${domain_account_framework_path}/src/domain_account_callback_proxy.cpp",
201    "${domain_account_framework_path}/src/domain_account_callback_service.cpp",
202    "${domain_account_framework_path}/src/domain_account_callback_stub.cpp",
203    "${domain_account_framework_path}/src/domain_account_common.cpp",
204    "${innerkits_native_path}/src/account_info_parcel.cpp",
205    "${os_account_core_path}/src/os_account_event_proxy.cpp",
206    "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp",
207    "${os_account_dfx_path}/hisysevent_adapter/hisysevent_adapter.cpp",
208    "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp",
209  ]
210  sources += account_service_sources
211  sources += ability_manager_sources
212  sources += bundle_manager_sources
213
214  defines = [
215    "ACCOUNT_LOG_TAG = \"AccountMgrService\"",
216    "LOG_DOMAIN = 0xD001B00",
217  ]
218
219  configs = [
220    ":accountmgr_config",
221    ":ability_manager_config",
222    ":bundle_manager_config",
223    ":domain_account_config",
224    "${account_coverage_config_path}:coverage_flags",
225  ]
226
227  public_configs = [
228    ":accountmgr_public_config",
229    ":domain_account_config",
230  ]
231
232  use_exceptions = true
233
234  deps = [
235    "${common_path}:libaccount_common",
236    "${os_account_innerkits_native_path}:os_account_innerkits",
237    "//third_party/mbedtls:mbedtls",
238  ]
239
240  external_deps = [
241    "ability_base:want",
242    "ability_runtime:app_manager",
243    "ability_runtime:wantagent_innerkits",
244    "access_token:libaccesstoken_sdk",
245    "access_token:libtokenid_sdk",
246    "bundle_framework:appexecfwk_base",
247    "c_utils:utils",
248    "hilog:libhilog",
249    "huks:libhukssdk",
250    "init:libbegetutil",
251    "ipc:ipc_single",
252    "safwk:system_ability_fwk",
253    "samgr:samgr_proxy",
254  ]
255
256  if (has_user_auth_part) {
257    cflags_cc += [
258      "-DHAS_USER_AUTH_PART",
259      "-DHAS_USER_IDM_PART",
260    ]
261    configs += [ ":account_iam_config" ]
262    sources += account_iam_sources
263    external_deps += [
264      "access_token:libtoken_setproc",
265      "user_auth_framework:userauth_client",
266    ]
267  }
268
269  if (has_kv_store_part) {
270    cflags_cc += [
271      "-DHAS_APP_ACCOUNT_PART",
272      "-DHAS_KV_STORE_PART",
273    ]
274    sources += app_account_sources
275    sources += [
276      "src/account_data_storage.cpp",
277      "src/osaccount/os_account_data_storage.cpp",
278      "src/osaccount/os_account_database_operator.cpp",
279    ]
280    external_deps += [ "kv_store:distributeddata_inner" ]
281  }
282
283  if (has_storage_service_part && os_account_storage_feature) {
284    cflags += [ "-DHAS_STORAGE_PART" ]
285    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
286  }
287
288  if (build_selinux) {
289    external_deps += [ "selinux_adapter:librestorecon" ]
290    cflags += [ "-DWITH_SELINUX" ]
291  }
292
293  if (has_ces_part) {
294    cflags_cc += [ "-DHAS_CES_PART" ]
295    external_deps += [ "common_event_service:cesfwk_innerkits" ]
296  }
297
298  if (has_hiviewdfx_hisysevent_part) {
299    cflags_cc += [ "-DHAS_HISYSEVENT_PART" ]
300    external_deps += [ "hisysevent:libhisysevent" ]
301  }
302
303  if (use_musl) {
304    cflags_cc += [ "-DUSE_MUSL" ]
305  }
306
307  if (hicollie_enable == true) {
308    external_deps += [ "hicollie:libhicollie" ]
309    cflags_cc += [ "-DHICOLLIE_ENABLE" ]
310  }
311
312  if (security_guard_enabled) {
313    external_deps += [
314      "security_guard:libsg_collect_sdk",
315      "time_service:time_client",
316    ]
317    cflags_cc += [ "-DSECURITY_GUARDE_ENABLE" ]
318  }
319
320  if (has_hiviewdfx_hitrace_part) {
321    external_deps += [ "hitrace:hitrace_meter" ]
322    cflags_cc += [ "-DHAS_HITRACE_PART" ]
323  }
324
325  if (has_asset_part) {
326    external_deps += [ "asset:asset_ndk" ]
327    cflags_cc += [ "-DHAS_ASSET_PART" ]
328  }
329
330  if (build_variant == "user") {
331    cflags_cc += [ "-DIS_RELEASE_VERSION" ]
332  }
333
334  if (!use_clang_coverage) {
335    shlib_type = "sa"
336  }
337  subsystem_name = "account"
338  part_name = "os_account"
339}
340
341group("accountmgr_target") {
342  deps = [
343    ":accountmgr",
344    ":accountmgr.init",
345    ":constraints_list_collection",
346    ":osaccount_constraint",
347  ]
348}
349