• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("../../appexecfwk.gni")
16import("appexecfwk_bundlemgr.gni")
17
18config("bundlemgr_common_config") {
19  include_dirs = [
20    "include",
21    "include/aot",
22    "include/app_provision_info",
23    "include/app_service_fwk",
24    "include/bundlemgr",
25    "include/bms_extension",
26    "include/bundle_resource",
27    "include/clone",
28    "include/common",
29    "include/default_app",
30    "include/free_install",
31    "include/distributed_manager",
32    "include/driver",
33    "include/extend_resource",
34    "include/first_install_data_mgr",
35    "include/uninstall_data_mgr",
36    "include/overlay",
37    "include/quick_fix",
38    "include/sandbox_app",
39    "include/navigation",
40    "include/shared",
41    "include/quick_fix/state/include",
42    "include/utd",
43    "include/verify",
44    "include/plugin",
45    "../../interfaces/inner_api/appexecfwk_base/include",
46    "../../interfaces/inner_api/bundlemgr_extension/include",
47  ]
48
49  include_dirs += bundle_mgr_impl_include_dirs
50
51  defines = [
52    "APP_LOG_TAG = \"BMS\"",
53    "LOG_DOMAIN = 0xD001120",
54  ]
55}
56
57config("rdb_config") {
58  include_dirs = [ "include/rdb" ]
59}
60
61config("app_control_config") {
62  include_dirs = [ "include/app_control" ]
63}
64
65config("overlay_installation_config") {
66  include_dirs = [ "include/overlay" ]
67}
68
69config("user_auth_config") {
70  include_dirs = [ "include/user_auth" ]
71}
72
73bundlemgr_parser_common_config = [ ":bundlemgr_common_config" ]
74
75ohos_source_set("parser_common") {
76  branch_protector_ret = "pac_ret"
77
78  sanitize = {
79    boundary_sanitize = true
80    cfi = true
81    cfi_cross_dso = true
82    debug = false
83    integer_overflow = true
84    ubsan = true
85  }
86
87  sources = [
88    "src/base_extractor.cpp",
89    "src/zip_file.cpp",
90  ]
91
92  public_configs = bundlemgr_parser_common_config
93
94  deps = [
95    "${base_path}:appexecfwk_base",
96    "${common_path}:libappexecfwk_common",
97    "${extension_path}:bundlemgr_extension",
98  ]
99
100  external_deps = [
101    "c_utils:utils",
102    "hilog:libhilog",
103    "zlib:shared_libz",
104  ]
105
106  public_external_deps = [
107    "json:nlohmann_json_static",
108    "zlib:libz",
109  ]
110
111  part_name = "bundle_framework"
112  subsystem_name = "bundlemanager"
113}
114
115ohos_source_set("rpcid_decode") {
116  branch_protector_ret = "pac_ret"
117
118  sanitize = {
119    boundary_sanitize = true
120    cfi = true
121    cfi_cross_dso = true
122    debug = false
123    integer_overflow = true
124    ubsan = true
125  }
126
127  include_dirs = [ "include/rpcid_decode" ]
128
129  sources = [ "src/rpcid_decode/syscap_tool.c" ]
130
131  external_deps = [
132    "c_utils:utils",
133    "hilog:libhilog",
134  ]
135
136  part_name = "bundle_framework"
137  subsystem_name = "bundlemanager"
138}
139
140ohos_source_set("bundle_parser") {
141  branch_protector_ret = "pac_ret"
142
143  sanitize = {
144    boundary_sanitize = true
145    cfi = true
146    cfi_cross_dso = true
147    debug = false
148    integer_overflow = true
149    ubsan = true
150  }
151
152  sources = [
153    "include/bundle_extractor.h",
154    "include/bundle_parser.h",
155    "include/bundle_profile.h",
156    "include/default_permission_profile.h",
157    "include/module_profile.h",
158    "src/bundle_extractor.cpp",
159    "src/bundle_parser.cpp",
160    "src/bundle_profile.cpp",
161    "src/default_permission_profile.cpp",
162    "src/module_profile.cpp",
163    "src/pre_bundle_profile.cpp",
164  ]
165
166  if (bundle_framework_quick_fix) {
167    sources += [
168      "include/quick_fix/patch_extractor.h",
169      "include/quick_fix/patch_parser.h",
170      "include/quick_fix/patch_profile.h",
171      "src/quick_fix/patch_extractor.cpp",
172      "src/quick_fix/patch_parser.cpp",
173      "src/quick_fix/patch_profile.cpp",
174    ]
175  }
176
177  public_configs = bundlemgr_parser_common_config
178
179  cflags = [ "-fstack-protector-strong" ]
180
181  if (target_cpu == "arm") {
182    cflags += [ "-DBINDER_IPC_32BIT" ]
183  }
184  deps = [
185    ":parser_common",
186    ":rpcid_decode",
187    "${base_path}:appexecfwk_base",
188    "${common_path}:libappexecfwk_common",
189    "${extension_path}:bundlemgr_extension",
190  ]
191
192  external_deps = [
193    "ability_base:want",
194    "access_token:libaccesstoken_sdk",
195    "c_utils:utils",
196    "hilog:libhilog",
197    "init:libbegetutil",
198    "ipc:ipc_single",
199  ]
200
201  public_external_deps = [
202    "json:nlohmann_json_static",
203    "zlib:libz",
204  ]
205
206  defines = []
207  if (use_pre_bundle_profile) {
208    defines += [ "USE_PRE_BUNDLE_PROFILE" ]
209  }
210
211  if (bundle_framework_overlay_install) {
212    defines += [ "BUNDLE_FRAMEWORK_OVERLAY_INSTALLATION" ]
213  }
214
215  if (is_emulator) {
216    defines += [ "X86_EMULATOR_MODE" ]
217  }
218  part_name = "bundle_framework"
219  subsystem_name = "bundlemanager"
220}
221
222group("bms_target") {
223  deps = [
224    ":bundle_tool_libs",
225    ":installs",
226    ":installs.cfg",
227    ":libbms",
228  ]
229}
230
231ohos_shared_library("libbms") {
232  branch_protector_ret = "pac_ret"
233
234  sanitize = {
235    boundary_sanitize = true
236    cfi = true
237    cfi_cross_dso = true
238    debug = false
239    integer_overflow = true
240    ubsan = true
241  }
242
243  use_exceptions = true
244  visibility = [
245    "//base/*",
246    "//foundation/*",
247  ]
248
249  sources = bundle_mgr_source
250
251  sources += bundle_install_sources
252
253  sources += bundle_mgr_impl_sources
254
255  defines = [
256    "APP_LOG_TAG = \"BMS\"",
257    "LOG_DOMAIN = 0xD001120",
258  ]
259
260  if (is_emulator) {
261    defines += [ "X86_EMULATOR_MODE" ]
262  }
263
264  if (build_variant == "user") {
265    defines += [ "BUILD_VARIANT_USER" ]
266  }
267
268  configs = [ ":bundlemgr_common_config" ]
269  cflags = [
270    "-fvisibility=hidden",
271    "-fdata-sections",
272    "-ffunction-sections",
273    "-Wno-non-c-typedef-for-linkage",
274    "-Os",
275    "-fstack-protector-strong",
276  ]
277
278  cflags_cc = [
279    "-fvisibility-inlines-hidden",
280    "-Wno-non-c-typedef-for-linkage",
281    "-Os",
282    "-fstack-protector-strong",
283  ]
284  if (target_cpu == "arm") {
285    cflags += [ "-DBINDER_IPC_32BIT" ]
286  }
287  deps = [
288    ":bundle_parser",
289    ":parser_common",
290    "${base_path}:appexecfwk_base",
291    "${common_path}:libappexecfwk_common",
292    "${core_path}:appexecfwk_core",
293    "${extension_path}:bundlemgr_extension",
294  ]
295
296  version_script = "libbms.map"
297  external_deps = [
298    "ability_base:want",
299    "ability_runtime:ability_connect_callback_stub",
300    "access_token:el5_filekey_manager_sdk",
301    "access_token:libaccesstoken_sdk",
302    "access_token:libprivacy_sdk",
303    "access_token:libtokenid_sdk",
304    "appspawn:appspawn_client",
305    "appverify:libhapverify",
306    "common_event_service:cesfwk_innerkits",
307    "eventhandler:libeventhandler",
308    "ffrt:libffrt",
309    "hilog:libhilog",
310    "hitrace:hitrace_meter",
311    "init:libbegetutil",
312    "ipc:ipc_single",
313    "os_account:libaccountkits",
314    "safwk:system_ability_fwk",
315    "samgr:samgr_proxy",
316    "syscap_codec:syscap_interface_shared",
317    "zlib:shared_libz",
318  ]
319
320  if (bundle_framework_power_mgr_enable) {
321    external_deps += aot_external_deps
322  }
323
324  if (storage_service_enable) {
325    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
326    defines += [ "STORAGE_SERVICE_ENABLE" ]
327  }
328
329  if (window_enable) {
330    external_deps += [ "window_manager:libwsutils" ]
331    defines += [ "WINDOW_ENABLE" ]
332  }
333
334  if (distributed_bundle_framework) {
335    external_deps += [ "distributed_bundle_framework:dbms_fwk" ]
336    defines += [ "DISTRIBUTED_BUNDLE_FRAMEWORK" ]
337  }
338
339  if (bundle_framework_sandbox_app) {
340    sources += sandbox_app
341    defines += [ "BUNDLE_FRAMEWORK_SANDBOX_APP" ]
342
343    if (dlp_permission_enable) {
344      external_deps += [ "dlp_permission_service:libdlp_permission_sdk" ]
345      defines += [ "DLP_PERMISSION_ENABLE" ]
346    }
347  }
348
349  if (ability_runtime_enable) {
350    external_deps += [
351      "ability_runtime:ability_manager",
352      "ability_runtime:app_manager",
353    ]
354    defines += [ "ABILITY_RUNTIME_ENABLE" ]
355  }
356
357  if (account_enable) {
358    external_deps += [ "os_account:os_account_innerkits" ]
359    defines += [ "ACCOUNT_ENABLE" ]
360  }
361
362  if (bundle_framework_free_install) {
363    sources += aging
364    sources += free_install
365    sources += distributed_manager
366    external_deps += [
367      "ability_runtime:ability_manager",
368      "ability_runtime:app_manager",
369      "battery_manager:batterysrv_client",
370      "display_manager:displaymgr",
371      "power_manager:powermgr_client",
372    ]
373    defines += [ "BUNDLE_FRAMEWORK_FREE_INSTALL" ]
374  } else {
375    external_deps += [
376      "ability_runtime:ability_manager",
377      "ability_runtime:app_manager",
378    ]
379  }
380
381  if (device_usage_statistics_enabled) {
382    external_deps += [ "device_usage_statistics:usagestatsinner" ]
383    defines += [ "DEVICE_USAGE_STATISTICS_ENABLED" ]
384  }
385
386  if (bundle_framework_power_mgr_enable) {
387    defines += [ "BUNDLE_FRAMEWORK_POWER_MGR_ENABLE" ]
388  }
389
390  if (bundle_framework_default_app) {
391    sources += default_app
392    defines += [ "BUNDLE_FRAMEWORK_DEFAULT_APP" ]
393  }
394
395  if (bundle_framework_quick_fix) {
396    sources += quick_fix
397    defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ]
398  }
399
400  if (configpolicy_enable) {
401    external_deps += [ "config_policy:configpolicy_util" ]
402    defines += [ "CONFIG_POLOCY_ENABLE" ]
403  }
404
405  if (global_resmgr_enable) {
406    defines += [ "GLOBAL_RESMGR_ENABLE" ]
407    external_deps += [ "resource_management:global_resmgr" ]
408  }
409
410  if (global_i18n_enable) {
411    defines += [ "GLOBAL_I18_ENABLE" ]
412    external_deps += [ "i18n:intl_util" ]
413  }
414
415  if (hicollie_enable) {
416    external_deps += [ "hicollie:libhicollie" ]
417    defines += [ "HICOLLIE_ENABLE" ]
418  }
419
420  if (hisysevent_enable) {
421    sources += [ "src/inner_event_report.cpp" ]
422    external_deps += [ "hisysevent:libhisysevent" ]
423    defines += [ "HISYSEVENT_ENABLE" ]
424  }
425
426  if (use_pre_bundle_profile) {
427    defines += [ "USE_PRE_BUNDLE_PROFILE" ]
428  }
429
430  if (bundle_framework_overlay_install) {
431    configs += [ ":overlay_installation_config" ]
432    sources += overlay_installation
433    defines += [ "BUNDLE_FRAMEWORK_OVERLAY_INSTALLATION" ]
434  }
435
436  configs += [ ":rdb_config" ]
437  external_deps += [ "relational_store:native_rdb" ]
438  sources += [
439    "src/bundle_data_storage_rdb.cpp",
440    "src/preinstall_data_storage_rdb.cpp",
441    "src/rdb/bms_rdb_open_callback.cpp",
442    "src/rdb/rdb_data_manager.cpp",
443  ]
444
445  if (bundle_framework_app_control) {
446    configs += [ ":app_control_config" ]
447    defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ]
448    sources += app_control
449  }
450
451  if (bundle_framework_bundle_resource) {
452    defines += [ "BUNDLE_FRAMEWORK_BUNDLE_RESOURCE" ]
453    external_deps += [ "ability_base:configuration" ]
454    if (bundle_framework_graphics) {
455      defines += [ "BUNDLE_FRAMEWORK_GRAPHICS" ]
456      external_deps += [
457        "ace_engine:drawable_descriptor",
458        "image_framework:image_native",
459      ]
460    }
461
462    sources += bundle_resource
463  }
464
465  if (build_variant == "root") {
466    defines += [ "QUOTA_PARAM_SET_ENABLE" ]
467  }
468
469  if (verify_abc_enabled) {
470    defines += [ "VERIFY_ABC_ENABLED" ]
471    external_deps += [ "runtime_core:libarkverifier" ]
472  }
473
474  if (check_eldir_enabled) {
475    defines += [ "CHECK_ELDIR_ENABLED" ]
476  }
477
478  if (udmf_enabled) {
479    defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
480    external_deps += [ "udmf:utd_client" ]
481  }
482
483  if (bms_device_info_manager_part_enabled) {
484    external_deps += [
485      "device_info_manager:distributed_device_profile_common",
486      "device_info_manager:distributed_device_profile_sdk",
487    ]
488    defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
489  }
490
491  if (app_domain_verify_enabled) {
492    external_deps += [
493      "app_domain_verify:app_domain_verify_common",
494      "app_domain_verify:app_domain_verify_mgr_client",
495    ]
496    defines += [ "APP_DOMAIN_VERIFY_ENABLED" ]
497  }
498
499  if (code_signature_enable) {
500    sources += [ "src/aot/aot_sign_data_cache_mgr.cpp" ]
501    defines += [ "CODE_SIGNATURE_ENABLE" ]
502  }
503
504  if (webview_enable) {
505    external_deps += [ "webview:app_fwk_update_service" ]
506    defines += [ "WEBVIEW_ENABLE" ]
507  }
508
509  if (user_auth_framework_impl_enabled) {
510    external_deps += [ "user_auth_framework:userauth_client" ]
511    defines += [ "BMS_USER_AUTH_FRAMEWORK_ENABLED" ]
512    configs += [ ":user_auth_config" ]
513    sources += user_auth
514  }
515
516  subsystem_name = "bundlemanager"
517  part_name = "bundle_framework"
518}
519
520ohos_shared_library("installs") {
521  branch_protector_ret = "pac_ret"
522
523  sanitize = {
524    boundary_sanitize = true
525    cfi = true
526    cfi_cross_dso = true
527    debug = false
528    integer_overflow = true
529    ubsan = true
530  }
531
532  sources = [
533    "src/bundle_extractor.cpp",
534    "src/system_ability_helper.cpp",
535  ]
536
537  use_exceptions = true
538  visibility = [
539    "//base/*",
540    "//foundation/*",
541  ]
542
543  sources += install_daemon_sources
544
545  defines = [ "APP_LOG_TAG = \"BMS\"" ]
546
547  configs = [ ":bundlemgr_common_config" ]
548
549  cflags = [
550    "-Os",
551    "-fstack-protector-strong",
552  ]
553
554  cflags_cc = cflags
555
556  if (target_cpu == "arm") {
557    cflags += [ "-DBINDER_IPC_32BIT" ]
558  }
559  deps = [
560    ":parser_common",
561    "${common_path}:libappexecfwk_common",
562  ]
563
564  external_deps = [
565    "access_token:el5_filekey_manager_sdk",
566    "appspawn:hnpapi",
567    "bounds_checking_function:libsec_shared",
568    "eventhandler:libeventhandler",
569    "ffrt:libffrt",
570    "hilog:libhilog",
571    "hitrace:hitrace_meter",
572    "init:libbegetutil",
573    "ipc:ipc_single",
574    "safwk:system_ability_fwk",
575    "samgr:samgr_proxy",
576    "selinux_adapter:librestorecon",
577    "storage_service:storage_manager_acl",
578  ]
579
580  if (code_signature_enable) {
581    external_deps += [
582      "code_signature:libcode_sign_utils",
583      "ets_runtime:libcompiler_service",
584    ]
585    defines += [ "CODE_SIGNATURE_ENABLE" ]
586  }
587
588  if (code_encryption_enable) {
589    defines += [ "CODE_ENCRYPTION_ENABLE" ]
590  }
591
592  if (configpolicy_enable) {
593    external_deps += [ "config_policy:configpolicy_util" ]
594    defines += [ "CONFIG_POLOCY_ENABLE" ]
595  }
596
597  if (build_selinux) {
598    external_deps += [ "selinux_adapter:libhap_restorecon" ]
599    cflags += [ "-DWITH_SELINUX" ]
600  }
601
602  if (dfx_sigdump_handler_enabled) {
603    external_deps += [
604      "faultloggerd:backtrace_local",
605      "faultloggerd:dfx_sigdump_handler",
606      "faultloggerd:libbacktrace_local",
607      "faultloggerd:libdfx_procinfo",
608      "faultloggerd:libfaultloggerd",
609      "faultloggerd:libunwinder",
610    ]
611    defines += [ "DFX_SIGDUMP_HANDLER_ENABLE" ]
612  }
613
614  install_enable = true
615  subsystem_name = "bundlemanager"
616  part_name = "bundle_framework"
617}
618
619ohos_prebuilt_etc("installs.cfg") {
620  source = "installs.cfg"
621  relative_install_dir = "init"
622  subsystem_name = "bundlemanager"
623  part_name = "bundle_framework"
624}
625
626config("bundle_tool_libs_config") {
627  include_dirs = [
628    "include",
629    "include/shared",
630    "include/sandbox_app",
631    "include/rdb",
632    "include/installd",
633    "include/quick_fix",
634    "include/uninstall_data_mgr",
635    "include/navigation",
636  ]
637}
638
639ohos_shared_library("bundle_tool_libs") {
640  branch_protector_ret = "pac_ret"
641  sanitize = {
642    boundary_sanitize = true
643    cfi = true
644    cfi_cross_dso = true
645    debug = false
646    integer_overflow = true
647    ubsan = true
648  }
649  public_configs = [ ":bundle_tool_libs_config" ]
650
651  sources = [ "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp" ]
652
653  deps = [ "${core_path}:appexecfwk_core" ]
654
655  external_deps = [
656    "c_utils:utils",
657    "hilog:libhilog",
658    "ipc:ipc_single",
659  ]
660
661  subsystem_name = "bundlemanager"
662  part_name = "bundle_framework"
663}
664