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 branch_protector_ret = "pac_ret" 31 32 sanitize = { 33 boundary_sanitize = true 34 cfi = true 35 cfi_cross_dso = true 36 debug = false 37 integer_overflow = true 38 ubsan = true 39 } 40 41 sources = [ 42 "src/bundle_command.cpp", 43 "src/bundle_command_common.cpp", 44 "src/main.cpp", 45 "src/quick_fix_command.cpp", 46 "src/quick_fix_status_callback_host_impl.cpp", 47 "src/shell_command.cpp", 48 "src/status_receiver_impl.cpp", 49 ] 50 51 public_configs = [ ":tools_bm_config" ] 52 53 cflags = [ "-fstack-protector-strong" ] 54 cflags_cc = cflags 55 56 if (target_cpu == "arm") { 57 cflags += [ "-DBINDER_IPC_32BIT" ] 58 } 59 60 external_deps = [ 61 "ability_base:want", 62 "ability_runtime:app_manager", 63 "ability_runtime:quickfix_manager", 64 "bundle_framework:appexecfwk_base", 65 "bundle_framework:appexecfwk_core", 66 "bundle_framework:bundle_tool_libs", 67 "c_utils:utils", 68 "common_event_service:cesfwk_innerkits", 69 "hilog:libhilog", 70 "init:libbegetutil", 71 "ipc:ipc_core", 72 "os_account:os_account_innerkits", 73 "samgr:samgr_proxy", 74 ] 75 76 public_external_deps = [ 77 "bundle_framework:bundle_napi_common", 78 "bundle_framework:libappexecfwk_common", 79 "json:nlohmann_json_static", 80 ] 81 82 defines = [] 83 if (account_enable_bm) { 84 external_deps += [ "os_account:os_account_innerkits" ] 85 defines += [ "ACCOUNT_ENABLE" ] 86 } 87 88 if (overlay_install_bm) { 89 defines += [ "BUNDLE_FRAMEWORK_OVERLAY_INSTALLATION" ] 90 } 91 92 subsystem_name = "bundlemanager" 93 part_name = "bundle_tool" 94} 95 96ohos_executable("bm") { 97 deps = [ ":tools_bm_source_set" ] 98 99 external_deps = [ "hilog:libhilog" ] 100 101 install_enable = true 102 103 subsystem_name = "bundlemanager" 104 part_name = "bundle_tool" 105} 106 107ohos_source_set("tools_test_bm_source_set") { 108 branch_protector_ret = "pac_ret" 109 110 sanitize = { 111 boundary_sanitize = true 112 cfi = true 113 cfi_cross_dso = true 114 debug = false 115 integer_overflow = true 116 ubsan = true 117 } 118 119 sources = [ 120 "src/bundle_command_common.cpp", 121 "src/bundle_test_tool.cpp", 122 "src/bundle_tool_callback/bundle_tool_callback_stub.cpp", 123 "src/main_test_tool.cpp", 124 "src/shell_command.cpp", 125 "src/status_receiver_impl.cpp", 126 ] 127 128 public_configs = [ ":tools_bm_config" ] 129 130 cflags = [ "-fstack-protector-strong" ] 131 cflags_cc = cflags 132 133 if (target_cpu == "arm") { 134 cflags += [ "-DBINDER_IPC_32BIT" ] 135 } 136 137 use_exceptions = true 138 139 deps = [] 140 141 external_deps = [ 142 "ability_base:want", 143 "access_token:libaccesstoken_sdk", 144 "access_token:libnativetoken", 145 "access_token:libtoken_setproc", 146 "access_token:libtokenid_sdk", 147 "bundle_framework:appexecfwk_base", 148 "bundle_framework:appexecfwk_core", 149 "bundle_framework:bundle_tool_libs", 150 "c_utils:utils", 151 "common_event_service:cesfwk_innerkits", 152 "hilog:libhilog", 153 "init:libbegetutil", 154 "ipc:ipc_core", 155 "jsoncpp:jsoncpp", 156 "os_account:os_account_innerkits", 157 "samgr:samgr_proxy", 158 ] 159 160 public_external_deps = [ 161 "bundle_framework:bundle_napi_common", 162 "bundle_framework:libappexecfwk_common", 163 "json:nlohmann_json_static", 164 ] 165 166 defines = [] 167 if (quick_fix_bm) { 168 defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ] 169 sources += [ "src/quick_fix_status_callback_host_impl.cpp" ] 170 } 171 172 if (account_enable_bm) { 173 external_deps += [ "os_account:os_account_innerkits" ] 174 defines += [ "ACCOUNT_ENABLE" ] 175 } 176 177 if (distributed_bundle_framework_bm) { 178 external_deps += [ "distributed_bundle_framework:dbms_fwk" ] 179 defines += [ "DISTRIBUTED_BUNDLE_FRAMEWORK" ] 180 } 181 182 subsystem_name = "bundlemanager" 183 part_name = "bundle_tool" 184} 185 186ohos_executable("bundle_test_tool") { 187 deps = [ ":tools_test_bm_source_set" ] 188 189 install_enable = false 190 191 external_deps = [ "hilog:libhilog" ] 192 193 subsystem_name = "bundlemanager" 194 part_name = "bundle_tool" 195} 196 197group("tools_bm") { 198 deps = [ 199 ":bm", 200 ":bundle_test_tool", 201 ] 202} 203