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("../bundletool.gni") 16 17config("tools_bm_config") { 18 include_dirs = [ 19 "include", 20 "include/bundle_tool_callback", 21 ] 22 23 defines = [ 24 "APP_LOG_TAG = \"BMSTool\"", 25 "LOG_DOMAIN = 0xD001123", 26 ] 27} 28 29ohos_source_set("tools_bm_source_set") { 30 sources = [ 31 "${common_path}/log/src/app_log_wrapper.cpp", 32 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 33 "src/bundle_command.cpp", 34 "src/bundle_command_common.cpp", 35 "src/main.cpp", 36 "src/quick_fix_command.cpp", 37 "src/quick_fix_status_callback_host_impl.cpp", 38 "src/shell_command.cpp", 39 "src/status_receiver_impl.cpp", 40 ] 41 42 public_configs = [ ":tools_bm_config" ] 43 44 cflags = [] 45 if (target_cpu == "arm") { 46 cflags += [ "-DBINDER_IPC_32BIT" ] 47 } 48 49 external_deps = [ 50 "ability_base:want", 51 "ability_runtime:app_manager", 52 "ability_runtime:quickfix_manager", 53 "bundle_framework:appexecfwk_base", 54 "bundle_framework:appexecfwk_core", 55 "c_utils:utils", 56 "common_event_service:cesfwk_innerkits", 57 "hilog:libhilog", 58 "init:libbegetutil", 59 "ipc:ipc_core", 60 "os_account:os_account_innerkits", 61 "samgr:samgr_proxy", 62 ] 63 64 public_external_deps = [ 65 "bundle_framework:bundle_napi_common", 66 "bundle_framework:libappexecfwk_common", 67 "json:nlohmann_json_static", 68 ] 69 70 defines = [] 71 if (account_enable_bm) { 72 external_deps += [ "os_account:os_account_innerkits" ] 73 defines += [ "ACCOUNT_ENABLE" ] 74 } 75 76 if (overlay_install_bm) { 77 defines += [ "BUNDLE_FRAMEWORK_OVERLAY_INSTALLATION" ] 78 } 79 80 subsystem_name = "bundlemanager" 81 part_name = "bundle_tool" 82} 83 84ohos_executable("bm") { 85 deps = [ ":tools_bm_source_set" ] 86 87 external_deps = [ "hilog:libhilog" ] 88 89 install_enable = true 90 91 subsystem_name = "bundlemanager" 92 part_name = "bundle_tool" 93} 94 95ohos_source_set("tools_test_bm_source_set") { 96 sources = [ 97 "${common_path}/log/src/app_log_wrapper.cpp", 98 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 99 "src/bundle_command_common.cpp", 100 "src/bundle_test_tool.cpp", 101 "src/bundle_tool_callback/bundle_tool_callback_stub.cpp", 102 "src/main_test_tool.cpp", 103 "src/shell_command.cpp", 104 "src/status_receiver_impl.cpp", 105 ] 106 107 public_configs = [ ":tools_bm_config" ] 108 109 cflags = [] 110 if (target_cpu == "arm") { 111 cflags += [ "-DBINDER_IPC_32BIT" ] 112 } 113 114 use_exceptions = true 115 116 deps = [] 117 118 external_deps = [ 119 "ability_base:want", 120 "bundle_framework:appexecfwk_base", 121 "bundle_framework:appexecfwk_core", 122 "c_utils:utils", 123 "common_event_service:cesfwk_innerkits", 124 "hilog:libhilog", 125 "init:libbegetutil", 126 "ipc:ipc_core", 127 "jsoncpp:jsoncpp", 128 "os_account:os_account_innerkits", 129 "samgr:samgr_proxy", 130 ] 131 132 public_external_deps = [ 133 "bundle_framework:bundle_napi_common", 134 "bundle_framework:libappexecfwk_common", 135 "json:nlohmann_json_static", 136 ] 137 138 defines = [] 139 if (quick_fix_bm) { 140 defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ] 141 sources += [ "src/quick_fix_status_callback_host_impl.cpp" ] 142 } 143 144 if (account_enable_bm) { 145 external_deps += [ "os_account:os_account_innerkits" ] 146 defines += [ "ACCOUNT_ENABLE" ] 147 } 148 149 if (distributed_bundle_framework_bm) { 150 external_deps += [ "distributed_bundle_framework:dbms_fwk" ] 151 defines += [ "DISTRIBUTED_BUNDLE_FRAMEWORK" ] 152 } 153 154 subsystem_name = "bundlemanager" 155 part_name = "bundle_tool" 156} 157 158ohos_executable("bundle_test_tool") { 159 deps = [ ":tools_test_bm_source_set" ] 160 161 install_enable = false 162 163 external_deps = [ "hilog:libhilog" ] 164 165 subsystem_name = "bundlemanager" 166 part_name = "bundle_tool" 167} 168 169group("tools_bm") { 170 deps = [ 171 ":bm", 172 ":bundle_test_tool", 173 ] 174} 175