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