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