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/sqlite/sqlite.gni") 17import("$updateengine_root_path/services/firmware/firmware.gni") 18import("$updateengine_root_path/services/startup/startup.gni") 19 20declare_args() { 21 ability_ability_base_enable = true 22 if (!defined(global_parts_info.ability_ability_base)) { 23 ability_ability_base_enable = false 24 } 25 26 preference_native_preferences_enable = true 27 if (!defined(global_parts_info.distributeddatamgr_preferences)) { 28 preference_native_preferences_enable = false 29 } 30} 31 32sa_sources = [ 33 "$updateengine_root_path/services/callback/src/update_callback_proxy.cpp", 34 "$updateengine_root_path/services/core/ability/adapter/src/config_parse.cpp", 35 "$updateengine_root_path/services/core/ability/adapter/src/device_adapter.cpp", 36 "$updateengine_root_path/services/core/ability/alarm/src/timer_manager.cpp", 37 "$updateengine_root_path/services/core/ability/status_cache/src/status_cache.cpp", 38 "$updateengine_root_path/services/core/ability/utils/src/file_utils.cpp", 39 "$updateengine_root_path/services/core/ability/utils/src/sha256_utils.cpp", 40 "$updateengine_root_path/services/core/ability/utils/src/time_utils_proxy.cpp", 41 "$updateengine_root_path/services/engine/src/progress_thread.cpp", 42 "$updateengine_root_path/services/engine/src/update_service.cpp", 43 "$updateengine_root_path/services/engine/src/update_service_cache.cpp", 44 "$updateengine_root_path/services/engine/src/update_service_impl_firmware.cpp", 45 "$updateengine_root_path/services/engine/src/update_service_impl_manager.cpp", 46 "$updateengine_root_path/services/engine/src/update_service_local_updater.cpp", 47 "$updateengine_root_path/services/engine/src/update_service_restorer.cpp", 48 "$updateengine_root_path/services/engine/src/update_service_stub.cpp", 49 "$updateengine_root_path/services/engine/src/update_service_util_hmos.cpp", 50] 51 52if (ability_ability_base_enable || ability_ability_runtime_enable) { 53 sa_sources += [ 54 "$updateengine_root_path/services/core/ability/alarm/src/alarm_timer_utils.cpp", 55 "$updateengine_root_path/services/core/ability/callback/src/base_callback_utils.cpp", 56 "$updateengine_root_path/services/engine/src/update_notify.cpp", 57 ] 58} else { 59 sa_sources += [ "$updateengine_root_path/services/core/ability/callback/src/base_callback_utils_empty.cpp" ] 60} 61 62if (communication_netmanager_base_enable) { 63 sa_sources += [ 64 "$updateengine_root_path/services/utils/src/dupdate_net_manager.cpp", 65 "$updateengine_root_path/services/utils/src/dupdate_net_observer.cpp", 66 ] 67} else { 68 sa_sources += [ 69 "$updateengine_root_path/services/utils/src/dupdate_net_manager_empty.cpp", 70 ] 71} 72 73if (preference_native_preferences_enable) { 74 sa_sources += [ "$updateengine_root_path/services/core/ability/preference/src/preference_utils.cpp" ] 75} else { 76 sa_sources += [ "$updateengine_root_path/services/core/ability/preference/src/preference_utils_empty.cpp" ] 77} 78 79sa_sources += firmware_src 80sa_sources += sqlite_src 81sa_sources += startup_src 82 83sa_include_dirs = [ 84 "$updateengine_root_path/services/auto_update/include", 85 "$updateengine_root_path/services/bi_report/include", 86 "$updateengine_root_path/services/callback/include", 87 "$updateengine_root_path/services/core/ability/adapter/include", 88 "$updateengine_root_path/services/core/ability/alarm/include", 89 "$updateengine_root_path/services/core/ability/callback/include", 90 "$updateengine_root_path/services/core/ability/common/include", 91 "$updateengine_root_path/services/core/ability/model/include", 92 "$updateengine_root_path/services/core/ability/net/include", 93 "$updateengine_root_path/services/core/ability/preference/include", 94 "$updateengine_root_path/services/core/ability/status_cache/include", 95 "$updateengine_root_path/services/core/ability/utils/include", 96 "$updateengine_root_path/services/engine/include", 97 "$updateengine_root_path/services/osal/include", 98 "$updateengine_root_path/services/service/include", 99 "$updateengine_root_path/services/utils/include", 100 "$updateengine_root_path/interfaces/inner_api/common/include", 101 "$updateengine_root_path/interfaces/inner_api/include", 102] 103 104if (!relational_store_native_rdb_enable) { 105 sa_include_dirs += [ 106 "//base/update/updateservice/services/core/ability/sqlite/core/include", 107 ] 108} 109 110sa_include_dirs += firmware_include 111sa_include_dirs += sqlite_include 112sa_include_dirs += startup_include 113sa_include_dirs += 114 [ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] 115 116sa_deps = [ 117 "$updateengine_root_path/foundations:update_foundations", 118 "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", 119 "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", 120] 121 122sa_deps += firmware_deps 123sa_deps += startup_deps 124 125sa_external_deps = [ 126 "ability_base:session_info", 127 "access_token:libaccesstoken_sdk", 128 "access_token:libtokenid_sdk", 129 "bundle_framework:appexecfwk_core", 130 "cJSON:cjson", 131 "c_utils:utils", # refbase 132 "curl:curl_shared", 133 "hilog:libhilog", 134 "hisysevent:libhisysevent", 135 "init:libbegetutil", 136 "ipc:ipc_core", 137 "json:nlohmann_json_static", 138 "libxml2:libxml2", 139 "mbedtls:mbedtls_shared", 140 "openssl:libcrypto_shared", 141 "openssl:libssl_shared", 142 "safwk:system_ability_fwk", 143 "samgr:samgr_proxy", 144 "updater:libfsmanager", # "fs_manager/mount.h" 145 "updater:libpackage_shared", # "package/package.h" 146 "updater:libupdater_shared", # "updaterkits/updaterkits.h" 147] 148 149if (ability_ability_base_enable) { 150 sa_external_deps += [ 151 "ability_base:base", 152 "ability_base:want", 153 "ability_runtime:wantagent_innerkits", 154 "time_service:time_client", 155 ] 156} 157if (ability_ability_runtime_enable) { 158 sa_external_deps += [ "ability_runtime:extension_manager" ] 159} 160 161if (communication_netmanager_base_enable) { 162 sa_external_deps += [ "netmanager_base:net_conn_manager_if" ] 163} 164 165if (preference_native_preferences_enable) { 166 sa_external_deps += [ "preferences:native_preferences" ] 167} 168 169sa_external_deps += firmware_external_deps 170sa_external_deps += sqlite_external_deps 171sa_external_deps += startup_external_deps 172 173sa_public_deps = [] 174sa_public_deps += startup_public_deps 175 176sa_defines = [ 177 "DUAL_ADAPTER", 178 "UPDATE_SERVICE", 179] 180 181if (ability_ability_base_enable) { 182 sa_defines += [ "ABILITY_BASE_ENABLE" ] 183} 184if (ability_ability_runtime_enable) { 185 sa_defines += [ "ABILITY_RUNTIME_ENABLE" ] 186} 187if (communication_netmanager_base_enable) { 188 sa_defines += [ "NETMANAGER_BASE_ENABLE" ] 189} 190if (preference_native_preferences_enable) { 191 sa_defines += [ "NATIVE_PREFERENCES_ENABLE" ] 192} 193sa_defines += sqlite_defines 194 195sa_cflags = [ 196 "-fPIC", 197 "-Os", 198 "-Werror", 199] 200