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 "cJSON:cjson_static", 152 "common_event_service:cesfwk_innerkits", 153 "hilog:libhilog", 154 "init:libbegetutil", 155 "ipc:ipc_core", 156 "jsoncpp:jsoncpp", 157 "os_account:os_account_innerkits", 158 "samgr:samgr_proxy", 159 "selinux_adapter:librestorecon", 160 ] 161 162 public_external_deps = [ 163 "bundle_framework:bundle_napi_common", 164 "bundle_framework:libappexecfwk_common", 165 "json:nlohmann_json_static", 166 ] 167 168 defines = [] 169 if (quick_fix_bm) { 170 defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ] 171 sources += [ "src/quick_fix_status_callback_host_impl.cpp" ] 172 } 173 174 if (account_enable_bm) { 175 external_deps += [ "os_account:os_account_innerkits" ] 176 defines += [ "ACCOUNT_ENABLE" ] 177 } 178 179 if (distributed_bundle_framework_bm) { 180 external_deps += [ "distributed_bundle_framework:dbms_fwk" ] 181 defines += [ "DISTRIBUTED_BUNDLE_FRAMEWORK" ] 182 } 183 184 subsystem_name = "bundlemanager" 185 part_name = "bundle_tool" 186} 187 188ohos_executable("bundle_test_tool") { 189 deps = [ ":tools_test_bm_source_set" ] 190 191 install_enable = false 192 193 external_deps = [ "hilog:libhilog" ] 194 195 subsystem_name = "bundlemanager" 196 part_name = "bundle_tool" 197} 198 199group("tools_bm") { 200 deps = [ 201 ":bm", 202 ":bundle_test_tool", 203 ] 204} 205