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