1# Copyright (c) 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("//base/update/updateservice/updateengine.gni") 15import("//build/ohos.gni") 16import("$updateengine_root_path/services/core/ability/log/log.gni") 17import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") 18import("$updateengine_root_path/services/firmware/firmware.gni") 19import("$updateengine_root_path/services/startup/startup.gni") 20 21declare_args() { 22 ability_ability_base_enable = true 23 if (!defined(global_parts_info.ability_ability_base)) { 24 ability_ability_base_enable = false 25 } 26 ability_ability_runtime_enable = true 27 if (!defined(global_parts_info.ability_ability_runtime)) { 28 ability_ability_runtime_enable = false 29 } 30 communication_netmanager_base_enable = true 31 if (!defined(global_parts_info.communication_netmanager_base)) { 32 communication_netmanager_base_enable = false 33 } 34 preference_native_preferences_enable = true 35 if (!defined(global_parts_info.distributeddatamgr_preferences)) { 36 preference_native_preferences_enable = false 37 } 38} 39 40sa_sources = [ 41 "$updateengine_root_path/services/callback/src/update_callback.cpp", 42 "$updateengine_root_path/services/callback/src/update_callback_proxy.cpp", 43 "$updateengine_root_path/services/callback/src/update_callback_stub.cpp", 44 "$updateengine_root_path/services/core/ability/adapter/src/config_parse.cpp", 45 "$updateengine_root_path/services/core/ability/adapter/src/device_adapter.cpp", 46 "$updateengine_root_path/services/core/ability/alarm/src/alarm_manager.cpp", 47 "$updateengine_root_path/services/core/ability/alarm/src/timer_manager.cpp", 48 "$updateengine_root_path/services/core/ability/status_cache/src/status_cache.cpp", 49 "$updateengine_root_path/services/core/ability/utils/src/file_utils.cpp", 50 "$updateengine_root_path/services/core/ability/utils/src/sha256_utils.cpp", 51 "$updateengine_root_path/services/core/ability/utils/src/time_utils_proxy.cpp", 52 "$updateengine_root_path/services/engine/src/message_parcel_helper.cpp", 53 "$updateengine_root_path/services/engine/src/progress_thread.cpp", 54 "$updateengine_root_path/services/engine/src/update_helper.cpp", 55 "$updateengine_root_path/services/engine/src/update_service.cpp", 56 "$updateengine_root_path/services/engine/src/update_service_cache.cpp", 57 "$updateengine_root_path/services/engine/src/update_service_impl_firmware.cpp", 58 "$updateengine_root_path/services/engine/src/update_service_impl_manager.cpp", 59 "$updateengine_root_path/services/engine/src/update_service_local_updater.cpp", 60 "$updateengine_root_path/services/engine/src/update_service_restorer.cpp", 61 "$updateengine_root_path/services/engine/src/update_service_stub.cpp", 62 "$updateengine_root_path/services/engine/src/update_service_util_hmos.cpp", 63 "$updateengine_root_path/services/utils/src/dupdate_timer.c", 64] 65 66if (ability_ability_base_enable || ability_ability_runtime_enable) { 67 sa_sources += [ 68 "$updateengine_root_path/services/core/ability/callback/src/base_callback_utils.cpp", 69 "$updateengine_root_path/services/engine/src/update_notify.cpp", 70 ] 71} else { 72 sa_sources += [ "$updateengine_root_path/services/core/ability/callback/src/base_callback_utils_empty.cpp" ] 73} 74 75if (communication_netmanager_base_enable) { 76 sa_sources += [ 77 "$updateengine_root_path/services/utils/src/dupdate_net_manager.cpp", 78 "$updateengine_root_path/services/utils/src/dupdate_net_observer.cpp", 79 ] 80} else { 81 sa_sources += [ 82 "$updateengine_root_path/services/utils/src/dupdate_net_manager_empty.cpp", 83 ] 84} 85 86if (preference_native_preferences_enable) { 87 sa_sources += [ "$updateengine_root_path/services/core/ability/preference/src/preference_utils.cpp" ] 88} else { 89 sa_sources += [ "$updateengine_root_path/services/core/ability/preference/src/preference_utils_empty.cpp" ] 90} 91 92sa_sources += firmware_src 93sa_sources += sqlite_src 94sa_sources += update_log_src 95sa_sources += startup_src 96 97sa_include_dirs = [ 98 "$updateengine_root_path/services/auto_update/include", 99 "$updateengine_root_path/services/bi_report/include", 100 "$updateengine_root_path/services/callback/include", 101 "$updateengine_root_path/services/core/ability/adapter/include", 102 "$updateengine_root_path/services/core/ability/alarm/include", 103 "$updateengine_root_path/services/core/ability/callback/include", 104 "$updateengine_root_path/services/core/ability/common/include", 105 "$updateengine_root_path/services/core/ability/define/include", 106 "$updateengine_root_path/services/core/ability/model/include", 107 "$updateengine_root_path/services/core/ability/net/include", 108 "$updateengine_root_path/services/core/ability/preference/include", 109 "$updateengine_root_path/services/core/ability/status_cache/include", 110 "$updateengine_root_path/services/core/ability/utils/include", 111 "$updateengine_root_path/services/engine/include", 112 "$updateengine_root_path/services/osal/include", 113 "$updateengine_root_path/services/service/include", 114 "$updateengine_root_path/services/utils/include", 115 "$updateengine_root_path/interfaces/inner_api/include", 116 "//base/update/updater/interfaces/kits/include", # package.h/updaterkits.h 117 "//base/update/updater/services/include", # fs_manager/mount.h 118 "//commonlibrary/utils_lite/include", # OHOS_SUCCESS 119 "//third_party/curl/include", 120 "//utils/native/base/include", # sptr 121 "//utils/system/safwk/native/include", 122 "//third_party/libxml2/include", 123 "//third_party/glib/glib", 124 "//third_party/glib", 125 "//third_party/openssl/include", 126 "//third_party/cJSON/", 127] 128 129if (!ability_ability_base_enable || !ability_ability_runtime_enable) { 130 sa_include_dirs += [ 131 "//foundation/ability/ability_base/interfaces/inner_api/base/include", 132 "//foundation/ability/ability_base/interfaces/kits/native/uri/include", 133 "//foundation/ability/ability_base/interfaces/kits/native/want/include", 134 "//foundation/ability/ability_runtime/frameworks/simulator/common/include", 135 "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", 136 "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include/appmgr", 137 "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native", 138 "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_base/include", 139 ] 140} 141 142if (!preference_native_preferences_enable) { 143 sa_include_dirs += [ 144 "//foundation/distributeddatamgr/preferences/interfaces/inner_api/include", 145 ] 146} 147 148if (!communication_netmanager_base_enable) { 149 sa_include_dirs += [ 150 "//foundation/communication/netmanager_base/interfaces/innerkits/include", 151 "//foundation/communication/netmanager_base/interfaces/innerkits/netconnclient/include", 152 "//foundation/communication/netmanager_base/interfaces/innerkits/netconnclient/include/proxy", 153 ] 154} 155 156if (!relational_store_native_rdb_enable) { 157 sa_include_dirs += [ 158 "//base/update/updateservice/services/core/ability/sqlite/core/include", 159 "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb/include", 160 ] 161} 162 163sa_include_dirs += firmware_include 164sa_include_dirs += sqlite_include 165sa_include_dirs += update_log_include 166sa_include_dirs += startup_include 167 168sa_deps = [ 169 "//base/update/updater/services/fs_manager:libfsmanager", # factory_reset_GetBlockDeviceByMountPoint_"fs_manager/mount.h" 170 "//third_party/cJSON:cjson", 171 "//third_party/curl:curl", 172 "//third_party/glib:glib_packages", 173 "//third_party/jsoncpp:jsoncpp", 174 "//third_party/libxml2:libxml2", 175 "//third_party/mbedtls:mbedtls_shared", 176 "//third_party/openssl:libcrypto_shared", 177 "//third_party/openssl:libssl_shared", 178] 179 180sa_deps += firmware_deps 181sa_deps += update_log_deps 182sa_deps += startup_deps 183 184sa_external_deps = [ 185 "access_token:libaccesstoken_sdk", 186 "access_token:libtokenid_sdk", 187 "c_utils:utils", # refbase 188 "hilog:libhilog", 189 "hisysevent:libhisysevent", 190 "init:libbegetutil", 191 "ipc:ipc_core", 192 "safwk:system_ability_fwk", 193 "samgr:samgr_proxy", 194 "updater:libpackageExt", # "package/package.h" 195 "updater:libupdaterkits", # "updaterkits/updaterkits.h" 196] 197 198if (ability_ability_base_enable) { 199 sa_external_deps += [ 200 "ability_base:base", 201 "ability_base:want", 202 ] 203} 204if (ability_ability_runtime_enable) { 205 sa_external_deps += [ "ability_runtime:ability_manager" ] 206} 207if (communication_netmanager_base_enable) { 208 sa_external_deps += [ "netmanager_base:net_conn_manager_if" ] 209} 210if (preference_native_preferences_enable) { 211 sa_external_deps += [ "preferences:native_preferences" ] 212} 213 214sa_external_deps += firmware_external_deps 215sa_external_deps += sqlite_external_deps 216sa_external_deps += update_log_external_deps 217sa_external_deps += startup_external_deps 218 219sa_public_deps = [] 220sa_public_deps += startup_public_deps 221 222sa_defines = [ 223 "DUAL_ADAPTER", 224 "UPDATE_SERVICE", 225] 226 227if (ability_ability_base_enable) { 228 sa_defines += [ "ABILITY_BASE_ENABLE" ] 229} 230if (ability_ability_runtime_enable) { 231 sa_defines += [ "ABILITY_RUNTIME_ENABLE" ] 232} 233if (communication_netmanager_base_enable) { 234 sa_defines += [ "NETMANAGER_BASE_ENABLE" ] 235} 236if (preference_native_preferences_enable) { 237 sa_defines += [ "NATIVE_PREFERENCES_ENABLE" ] 238} 239sa_defines += sqlite_defines 240 241sa_cflags = [ 242 "-fPIC", 243 "-Os", 244 "-Werror", 245] 246