# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("../../appexecfwk.gni") import("appexecfwk_bundlemgr.gni") config("bundlemgr_common_config") { include_dirs = [ "include", "include/default_app", "include/free_install", "include/distributed_manager", "include/quick_fix", "include/sandbox_app", "include/quick_fix/state/include", "//base/powermgr/power_manager/interfaces/innerkits/native/include", "//utils/system/safwk/native/include", "../../interfaces/inner_api/appexecfwk_base/include", ] include_dirs += bundle_mgr_impl_include_dirs if (bundle_framework_free_install) { include_dirs += [ "//base/sensors/sensor/interfaces/native/include" ] } defines = [ "APP_LOG_TAG = \"BundleMgrService\"", "LOG_DOMAIN = 0xD001120", ] } config("rdb_config") { include_dirs = [ "include/rdb" ] } config("app_control_config") { include_dirs = [ "include/app_control" ] } config("bundlemgr_parse_config") { include_dirs = [ "//third_party/json/include", "//third_party/zlib/contrib/minizip", "//third_party/zlib", ] } bundlemgr_parser_common_config = [ ":bundlemgr_common_config", ":bundlemgr_parse_config", ] ohos_source_set("parser_common") { sources = [ "src/base_extractor.cpp", "src/zip_file.cpp", ] public_configs = bundlemgr_parser_common_config deps = [ "${common_path}:libappexecfwk_common", "//third_party/zlib:shared_libz", ] external_deps = [ "bundle_framework:appexecfwk_base", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", ] part_name = "bundle_framework" } ohos_source_set("rpcid_decode") { include_dirs = [ "include/rpcid_decode" ] sources = [ "src/rpcid_decode/syscap_tool.c" ] external_deps = [ "c_utils:utils", "hiviewdfx_hilog_native:libhilog", ] part_name = "bundle_framework" } ohos_source_set("bundle_parser") { sources = [ "include/bundle_extractor.h", "include/bundle_parser.h", "include/bundle_profile.h", "include/default_permission_profile.h", "include/module_profile.h", "src/bundle_extractor.cpp", "src/bundle_parser.cpp", "src/bundle_profile.cpp", "src/default_permission_profile.cpp", "src/module_profile.cpp", "src/pre_bundle_profile.cpp", ] if (bundle_framework_quick_fix) { sources += [ "include/quick_fix/patch_extractor.h", "include/quick_fix/patch_parser.h", "include/quick_fix/patch_profile.h", "src/quick_fix/patch_extractor.cpp", "src/quick_fix/patch_parser.cpp", "src/quick_fix/patch_profile.cpp", ] } public_configs = bundlemgr_parser_common_config cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ ":parser_common", ":rpcid_decode", "${common_path}:libappexecfwk_common", ] external_deps = [ "ability_base:want", "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_base", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", "ipc:ipc_single", ] defines = [] if (use_pre_bundle_profile) { defines += [ "USE_PRE_BUNDLE_PROFILE" ] } part_name = "bundle_framework" } group("bms_target") { deps = [ ":installs", ":installs.cfg", ":libbms", ] } ohos_shared_library("libbms") { use_exceptions = true visibility = [ "//base/*", "//foundation/*", ] sources = [ "src/account_helper.cpp", "src/bms_param.cpp", "src/bundle_common_event_mgr.cpp", "src/bundle_data_mgr.cpp", "src/bundle_data_storage.cpp", "src/bundle_event_callback_death_recipient.cpp", "src/bundle_mgr_host_impl.cpp", "src/bundle_mgr_service.cpp", "src/bundle_mgr_service_event_handler.cpp", "src/bundle_scanner.cpp", "src/bundle_state_storage.cpp", "src/bundle_status_callback_death_recipient.cpp", "src/bundle_user_mgr_host_impl.cpp", "src/hidump_helper.cpp", "src/system_ability_helper.cpp", ] sources += bundle_install_sources sources += bundle_mgr_impl_sources defines = [ "APP_LOG_TAG = \"BundleMgrService\"", "LOG_DOMAIN = 0xD001120", ] if (is_emulator) { defines += [ "X86_EMULATOR_MODE" ] } configs = [ ":bundlemgr_common_config" ] cflags = [ "-fvisibility=hidden", "-fdata-sections", "-ffunction-sections", "-Wno-non-c-typedef-for-linkage", "-Os", ] cflags_cc = [ "-fvisibility-inlines-hidden", "-Wno-non-c-typedef-for-linkage", "-Os", ] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ ":bundle_parser", ":parser_common", "${common_path}:libappexecfwk_common", "//third_party/zlib:shared_libz", ] version_script = "libbms.map" external_deps = [ "ability_base:want", "access_token:libaccesstoken_sdk", "appverify:libhapverify", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_innerkits", "device_info_manager:distributed_device_profile_client", "eventhandler:libeventhandler", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", "syscap_codec:syscap_interface_shared", ] if (distributed_bundle_framework) { external_deps += [ "distributed_bundle_framework:dbms_fwk" ] defines += [ "DISTRIBUTED_BUNDLE_FRAMEWORK" ] } if (bundle_framework_sandbox_app) { sources += sandbox_app defines += [ "BUNDLE_FRAMEWORK_SANDBOX_APP" ] } if (ability_runtime_enable) { external_deps += [ "ability_runtime:ability_manager" ] defines += [ "ABILITY_RUNTIME_ENABLE" ] } if (account_enable) { external_deps += [ "os_account:os_account_innerkits" ] defines += [ "ACCOUNT_ENABLE" ] } if (bundle_framework_free_install) { sources += aging sources += free_install sources += distributed_manager external_deps += [ "ability_runtime:ability_manager", "ability_runtime:app_manager", "battery_manager:batterysrv_client", "device_usage_statistics:usagestatsinner", "display_manager:displaymgr", ] defines += [ "BUNDLE_FRAMEWORK_FREE_INSTALL" ] } if (bundle_framework_default_app) { sources += default_app defines += [ "BUNDLE_FRAMEWORK_DEFAULT_APP" ] } if (bundle_framework_quick_fix) { sources += quick_fix defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ] } if (configpolicy_enable) { external_deps += [ "config_policy:configpolicy_util" ] defines += [ "CONFIG_POLOCY_ENABLE" ] } if (device_manager_enable) { sources += [ "src/bms_device_manager.cpp" ] external_deps += [ "device_manager:devicemanagersdk" ] defines += [ "DEVICE_MANAGER_ENABLE" ] } if (global_resmgr_enable) { defines += [ "GLOBAL_RESMGR_ENABLE" ] external_deps += [ "resource_management:global_resmgr" ] } if (global_i18n_enable) { defines += [ "GLOBAL_I18_ENABLE" ] external_deps += [ "i18n:intl_util" ] } if (hicollie_enable) { external_deps += [ "hicollie_native:libhicollie" ] defines += [ "HICOLLIE_ENABLE" ] } if (hisysevent_enable) { sources += [ "src/inner_event_report.cpp" ] external_deps += [ "hisysevent_native:libhisysevent" ] defines += [ "HISYSEVENT_ENABLE" ] } if (use_pre_bundle_profile) { defines += [ "USE_PRE_BUNDLE_PROFILE" ] } if (bms_rdb_enable) { configs += [ ":rdb_config" ] defines += [ "BMS_RDB_ENABLE" ] external_deps += [ "relational_store:native_rdb" ] sources += [ "src/bundle_data_storage_rdb.cpp", "src/preinstall_data_storage_rdb.cpp", "src/rdb/bms_rdb_open_callback.cpp", "src/rdb/rdb_data_manager.cpp", ] } else { sources += [ "src/bundle_data_storage_database.cpp", "src/kvstore_death_recipient_callback.cpp", "src/preinstall_data_storage.cpp", ] } if (bundle_framework_app_control) { configs += [ ":app_control_config" ] defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ] sources += app_control } subsystem_name = "bundlemanager" part_name = "bundle_framework" } ohos_executable("installs") { sources = [ "src/bundle_extractor.cpp", "src/installd/installd_main.cpp", "src/system_ability_helper.cpp", ] sources += install_daemon_sources defines = [ "APP_LOG_TAG = \"BundleMgrService\"" ] configs = [ ":bundlemgr_common_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ ":parser_common", "${common_path}:libappexecfwk_common", ] external_deps = [ "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", "ipc:ipc_single", "samgr:samgr_proxy", ] if (build_selinux) { external_deps += [ "selinux:libhap_restorecon" ] cflags += [ "-DWITH_SELINUX" ] } install_enable = true subsystem_name = "bundlemanager" part_name = "bundle_framework" } ohos_prebuilt_etc("installs.cfg") { source = "installs.cfg" relative_install_dir = "init" subsystem_name = "bundlemanager" part_name = "bundle_framework" }