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