1# Copyright (c) 2021-2022 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/default_app", 22 "include/free_install", 23 "include/distributed_manager", 24 "include/quick_fix", 25 "include/sandbox_app", 26 "include/quick_fix/state/include", 27 "//base/powermgr/power_manager/interfaces/innerkits/native/include", 28 "//utils/system/safwk/native/include", 29 "../../interfaces/inner_api/appexecfwk_base/include", 30 ] 31 32 include_dirs += bundle_mgr_impl_include_dirs 33 34 if (bundle_framework_free_install) { 35 include_dirs += [ "//base/sensors/sensor/interfaces/native/include" ] 36 } 37 38 defines = [ 39 "APP_LOG_TAG = \"BundleMgrService\"", 40 "LOG_DOMAIN = 0xD001120", 41 ] 42} 43 44config("rdb_config") { 45 include_dirs = [ "include/rdb" ] 46} 47 48config("app_control_config") { 49 include_dirs = [ "include/app_control" ] 50} 51 52config("bundlemgr_parse_config") { 53 include_dirs = [ 54 "//third_party/json/include", 55 "//third_party/zlib/contrib/minizip", 56 "//third_party/zlib", 57 ] 58} 59 60bundlemgr_parser_common_config = [ 61 ":bundlemgr_common_config", 62 ":bundlemgr_parse_config", 63] 64 65ohos_source_set("parser_common") { 66 sources = [ 67 "src/base_extractor.cpp", 68 "src/zip_file.cpp", 69 ] 70 71 public_configs = bundlemgr_parser_common_config 72 73 deps = [ 74 "${common_path}:libappexecfwk_common", 75 "//third_party/zlib:shared_libz", 76 ] 77 78 external_deps = [ 79 "bundle_framework:appexecfwk_base", 80 "c_utils:utils", 81 "hiviewdfx_hilog_native:libhilog", 82 ] 83 84 part_name = "bundle_framework" 85} 86 87ohos_source_set("rpcid_decode") { 88 include_dirs = [ "include/rpcid_decode" ] 89 90 sources = [ "src/rpcid_decode/syscap_tool.c" ] 91 92 external_deps = [ 93 "c_utils:utils", 94 "hiviewdfx_hilog_native:libhilog", 95 ] 96 97 part_name = "bundle_framework" 98} 99 100ohos_source_set("bundle_parser") { 101 sources = [ 102 "include/bundle_extractor.h", 103 "include/bundle_parser.h", 104 "include/bundle_profile.h", 105 "include/default_permission_profile.h", 106 "include/module_profile.h", 107 "src/bundle_extractor.cpp", 108 "src/bundle_parser.cpp", 109 "src/bundle_profile.cpp", 110 "src/default_permission_profile.cpp", 111 "src/module_profile.cpp", 112 "src/pre_bundle_profile.cpp", 113 ] 114 115 if (bundle_framework_quick_fix) { 116 sources += [ 117 "include/quick_fix/patch_extractor.h", 118 "include/quick_fix/patch_parser.h", 119 "include/quick_fix/patch_profile.h", 120 "src/quick_fix/patch_extractor.cpp", 121 "src/quick_fix/patch_parser.cpp", 122 "src/quick_fix/patch_profile.cpp", 123 ] 124 } 125 126 public_configs = bundlemgr_parser_common_config 127 cflags = [] 128 if (target_cpu == "arm") { 129 cflags += [ "-DBINDER_IPC_32BIT" ] 130 } 131 deps = [ 132 ":parser_common", 133 ":rpcid_decode", 134 "${common_path}:libappexecfwk_common", 135 ] 136 137 external_deps = [ 138 "ability_base:want", 139 "access_token:libaccesstoken_sdk", 140 "bundle_framework:appexecfwk_base", 141 "c_utils:utils", 142 "hiviewdfx_hilog_native:libhilog", 143 "init:libbegetutil", 144 "ipc:ipc_single", 145 ] 146 147 defines = [] 148 if (use_pre_bundle_profile) { 149 defines += [ "USE_PRE_BUNDLE_PROFILE" ] 150 } 151 152 part_name = "bundle_framework" 153} 154 155group("bms_target") { 156 deps = [ 157 ":installs", 158 ":installs.cfg", 159 ":libbms", 160 ] 161} 162 163ohos_shared_library("libbms") { 164 use_exceptions = true 165 visibility = [ 166 "//base/*", 167 "//foundation/*", 168 ] 169 170 sources = [ 171 "src/account_helper.cpp", 172 "src/bms_param.cpp", 173 "src/bundle_common_event_mgr.cpp", 174 "src/bundle_data_mgr.cpp", 175 "src/bundle_data_storage.cpp", 176 "src/bundle_event_callback_death_recipient.cpp", 177 "src/bundle_mgr_host_impl.cpp", 178 "src/bundle_mgr_service.cpp", 179 "src/bundle_mgr_service_event_handler.cpp", 180 "src/bundle_scanner.cpp", 181 "src/bundle_state_storage.cpp", 182 "src/bundle_status_callback_death_recipient.cpp", 183 "src/bundle_user_mgr_host_impl.cpp", 184 "src/hidump_helper.cpp", 185 "src/system_ability_helper.cpp", 186 ] 187 188 sources += bundle_install_sources 189 190 sources += bundle_mgr_impl_sources 191 192 defines = [ 193 "APP_LOG_TAG = \"BundleMgrService\"", 194 "LOG_DOMAIN = 0xD001120", 195 ] 196 197 if (is_emulator) { 198 defines += [ "X86_EMULATOR_MODE" ] 199 } 200 201 configs = [ ":bundlemgr_common_config" ] 202 cflags = [ 203 "-fvisibility=hidden", 204 "-fdata-sections", 205 "-ffunction-sections", 206 "-Wno-non-c-typedef-for-linkage", 207 "-Os", 208 ] 209 210 cflags_cc = [ 211 "-fvisibility-inlines-hidden", 212 "-Wno-non-c-typedef-for-linkage", 213 "-Os", 214 ] 215 if (target_cpu == "arm") { 216 cflags += [ "-DBINDER_IPC_32BIT" ] 217 } 218 deps = [ 219 ":bundle_parser", 220 ":parser_common", 221 "${common_path}:libappexecfwk_common", 222 "//third_party/zlib:shared_libz", 223 ] 224 225 version_script = "libbms.map" 226 external_deps = [ 227 "ability_base:want", 228 "access_token:libaccesstoken_sdk", 229 "appverify:libhapverify", 230 "bundle_framework:appexecfwk_base", 231 "bundle_framework:appexecfwk_core", 232 "common_event_service:cesfwk_innerkits", 233 "device_info_manager:distributed_device_profile_client", 234 "eventhandler:libeventhandler", 235 "hitrace_native:hitrace_meter", 236 "hiviewdfx_hilog_native:libhilog", 237 "init:libbegetutil", 238 "ipc:ipc_core", 239 "safwk:system_ability_fwk", 240 "samgr:samgr_proxy", 241 "syscap_codec:syscap_interface_shared", 242 ] 243 244 if (distributed_bundle_framework) { 245 external_deps += [ "distributed_bundle_framework:dbms_fwk" ] 246 defines += [ "DISTRIBUTED_BUNDLE_FRAMEWORK" ] 247 } 248 249 if (bundle_framework_sandbox_app) { 250 sources += sandbox_app 251 defines += [ "BUNDLE_FRAMEWORK_SANDBOX_APP" ] 252 } 253 254 if (ability_runtime_enable) { 255 external_deps += [ "ability_runtime:ability_manager" ] 256 defines += [ "ABILITY_RUNTIME_ENABLE" ] 257 } 258 259 if (account_enable) { 260 external_deps += [ "os_account:os_account_innerkits" ] 261 defines += [ "ACCOUNT_ENABLE" ] 262 } 263 264 if (bundle_framework_free_install) { 265 sources += aging 266 sources += free_install 267 sources += distributed_manager 268 external_deps += [ 269 "ability_runtime:ability_manager", 270 "ability_runtime:app_manager", 271 "battery_manager:batterysrv_client", 272 "device_usage_statistics:usagestatsinner", 273 "display_manager:displaymgr", 274 ] 275 defines += [ "BUNDLE_FRAMEWORK_FREE_INSTALL" ] 276 } 277 278 if (bundle_framework_default_app) { 279 sources += default_app 280 defines += [ "BUNDLE_FRAMEWORK_DEFAULT_APP" ] 281 } 282 283 if (bundle_framework_quick_fix) { 284 sources += quick_fix 285 defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ] 286 } 287 288 if (configpolicy_enable) { 289 external_deps += [ "config_policy:configpolicy_util" ] 290 defines += [ "CONFIG_POLOCY_ENABLE" ] 291 } 292 293 if (device_manager_enable) { 294 sources += [ "src/bms_device_manager.cpp" ] 295 external_deps += [ "device_manager:devicemanagersdk" ] 296 defines += [ "DEVICE_MANAGER_ENABLE" ] 297 } 298 299 if (global_resmgr_enable) { 300 defines += [ "GLOBAL_RESMGR_ENABLE" ] 301 external_deps += [ "resource_management:global_resmgr" ] 302 } 303 304 if (global_i18n_enable) { 305 defines += [ "GLOBAL_I18_ENABLE" ] 306 external_deps += [ "i18n:intl_util" ] 307 } 308 309 if (hicollie_enable) { 310 external_deps += [ "hicollie_native:libhicollie" ] 311 defines += [ "HICOLLIE_ENABLE" ] 312 } 313 314 if (hisysevent_enable) { 315 sources += [ "src/inner_event_report.cpp" ] 316 external_deps += [ "hisysevent_native:libhisysevent" ] 317 defines += [ "HISYSEVENT_ENABLE" ] 318 } 319 320 if (use_pre_bundle_profile) { 321 defines += [ "USE_PRE_BUNDLE_PROFILE" ] 322 } 323 324 if (bms_rdb_enable) { 325 configs += [ ":rdb_config" ] 326 defines += [ "BMS_RDB_ENABLE" ] 327 external_deps += [ "relational_store:native_rdb" ] 328 sources += [ 329 "src/bundle_data_storage_rdb.cpp", 330 "src/preinstall_data_storage_rdb.cpp", 331 "src/rdb/bms_rdb_open_callback.cpp", 332 "src/rdb/rdb_data_manager.cpp", 333 ] 334 } else { 335 sources += [ 336 "src/bundle_data_storage_database.cpp", 337 "src/kvstore_death_recipient_callback.cpp", 338 "src/preinstall_data_storage.cpp", 339 ] 340 } 341 342 if (bundle_framework_app_control) { 343 configs += [ ":app_control_config" ] 344 defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ] 345 sources += app_control 346 } 347 348 subsystem_name = "bundlemanager" 349 part_name = "bundle_framework" 350} 351 352ohos_executable("installs") { 353 sources = [ 354 "src/bundle_extractor.cpp", 355 "src/installd/installd_main.cpp", 356 "src/system_ability_helper.cpp", 357 ] 358 359 sources += install_daemon_sources 360 361 defines = [ "APP_LOG_TAG = \"BundleMgrService\"" ] 362 363 configs = [ ":bundlemgr_common_config" ] 364 cflags = [] 365 if (target_cpu == "arm") { 366 cflags += [ "-DBINDER_IPC_32BIT" ] 367 } 368 deps = [ 369 ":parser_common", 370 "${common_path}:libappexecfwk_common", 371 ] 372 373 external_deps = [ 374 "hiviewdfx_hilog_native:libhilog", 375 "init:libbegetutil", 376 "ipc:ipc_single", 377 "samgr:samgr_proxy", 378 ] 379 380 if (build_selinux) { 381 external_deps += [ "selinux:libhap_restorecon" ] 382 cflags += [ "-DWITH_SELINUX" ] 383 } 384 385 install_enable = true 386 subsystem_name = "bundlemanager" 387 part_name = "bundle_framework" 388} 389 390ohos_prebuilt_etc("installs.cfg") { 391 source = "installs.cfg" 392 relative_install_dir = "init" 393 subsystem_name = "bundlemanager" 394 part_name = "bundle_framework" 395} 396