1fb299fa2Sopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd.
2fb299fa2Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3fb299fa2Sopenharmony_ci# you may not use this file except in compliance with the License.
4fb299fa2Sopenharmony_ci# You may obtain a copy of the License at
5fb299fa2Sopenharmony_ci#
6fb299fa2Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0
7fb299fa2Sopenharmony_ci#
8fb299fa2Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9fb299fa2Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10fb299fa2Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11fb299fa2Sopenharmony_ci# See the License for the specific language governing permissions and
12fb299fa2Sopenharmony_ci# limitations under the License.
13fb299fa2Sopenharmony_ci
14fb299fa2Sopenharmony_ciimport("//base/update/updater/updater_default_cfg.gni")
15fb299fa2Sopenharmony_ciimport("//build/ohos.gni")
16fb299fa2Sopenharmony_ci
17fb299fa2Sopenharmony_ciupdater_path = rebase_path("${updater_absolutely_path}", ".")
18fb299fa2Sopenharmony_ci
19fb299fa2Sopenharmony_ciconfig("libutils_exported_headers") {
20fb299fa2Sopenharmony_ci  visibility = [ ":*" ]
21fb299fa2Sopenharmony_ci  if (updater_sign_on_server) {
22fb299fa2Sopenharmony_ci    defines = [ "SIGN_ON_SERVER" ]
23fb299fa2Sopenharmony_ci  }
24fb299fa2Sopenharmony_ci  include_dirs = [
25fb299fa2Sopenharmony_ci    "${updater_path}/services/include",
26fb299fa2Sopenharmony_ci    "${updater_path}/utils/include",
27fb299fa2Sopenharmony_ci    "${updater_path}/utils/json",
28fb299fa2Sopenharmony_ci  ]
29fb299fa2Sopenharmony_ci}
30fb299fa2Sopenharmony_ci
31fb299fa2Sopenharmony_ciohos_static_library("libutils") {
32fb299fa2Sopenharmony_ci  sources = [
33fb299fa2Sopenharmony_ci    "json/json_node.cpp",
34fb299fa2Sopenharmony_ci    "partition_utils.cpp",
35fb299fa2Sopenharmony_ci    "utils.cpp",
36fb299fa2Sopenharmony_ci    "utils_common.cpp",
37fb299fa2Sopenharmony_ci    "utils_fs.cpp",
38fb299fa2Sopenharmony_ci  ]
39fb299fa2Sopenharmony_ci
40fb299fa2Sopenharmony_ci  include_dirs = [
41fb299fa2Sopenharmony_ci    "include",
42fb299fa2Sopenharmony_ci    "${updater_path}/interfaces/kits/include/",
43fb299fa2Sopenharmony_ci    "${updater_path}/services/common/",
44fb299fa2Sopenharmony_ci    "${updater_path}/services/include/",
45fb299fa2Sopenharmony_ci  ]
46fb299fa2Sopenharmony_ci
47fb299fa2Sopenharmony_ci  public_configs = [ ":libutils_exported_headers" ]
48fb299fa2Sopenharmony_ci
49fb299fa2Sopenharmony_ci  deps = []
50fb299fa2Sopenharmony_ci  external_deps = [
51fb299fa2Sopenharmony_ci    "bounds_checking_function:libsec_static",
52fb299fa2Sopenharmony_ci    "cJSON:cjson_static",
53fb299fa2Sopenharmony_ci    "init:libbegetutil_static",
54fb299fa2Sopenharmony_ci    "init:libfsmanager_static_real",
55fb299fa2Sopenharmony_ci  ]
56fb299fa2Sopenharmony_ci
57fb299fa2Sopenharmony_ci  if (build_selinux) {
58fb299fa2Sopenharmony_ci    external_deps += [
59fb299fa2Sopenharmony_ci      "selinux:libselinux_static",
60fb299fa2Sopenharmony_ci      "selinux_adapter:librestorecon_static",
61fb299fa2Sopenharmony_ci    ]
62fb299fa2Sopenharmony_ci    cflags = [ "-DWITH_SELINUX" ]
63fb299fa2Sopenharmony_ci  }
64fb299fa2Sopenharmony_ci
65fb299fa2Sopenharmony_ci  subsystem_name = "updater"
66fb299fa2Sopenharmony_ci  part_name = "updater"
67fb299fa2Sopenharmony_ci}
68fb299fa2Sopenharmony_ci
69fb299fa2Sopenharmony_ciohos_static_library("libutils_fs") {
70fb299fa2Sopenharmony_ci  sources = [ "utils_fs.cpp" ]
71fb299fa2Sopenharmony_ci
72fb299fa2Sopenharmony_ci  include_dirs = [
73fb299fa2Sopenharmony_ci    "include",
74fb299fa2Sopenharmony_ci    "${updater_path}/services/include/",
75fb299fa2Sopenharmony_ci  ]
76fb299fa2Sopenharmony_ci
77fb299fa2Sopenharmony_ci  public_configs = [ ":libutils_exported_headers" ]
78fb299fa2Sopenharmony_ci
79fb299fa2Sopenharmony_ci  subsystem_name = "updater"
80fb299fa2Sopenharmony_ci  part_name = "updater"
81fb299fa2Sopenharmony_ci}
82fb299fa2Sopenharmony_ci
83fb299fa2Sopenharmony_ciohos_static_library("libutils_json") {
84fb299fa2Sopenharmony_ci  sources = [ "json/json_node.cpp" ]
85fb299fa2Sopenharmony_ci
86fb299fa2Sopenharmony_ci  include_dirs = [
87fb299fa2Sopenharmony_ci    "include",
88fb299fa2Sopenharmony_ci    "${updater_path}/services/include/",
89fb299fa2Sopenharmony_ci  ]
90fb299fa2Sopenharmony_ci
91fb299fa2Sopenharmony_ci  public_configs = [ ":libutils_exported_headers" ]
92fb299fa2Sopenharmony_ci
93fb299fa2Sopenharmony_ci  external_deps = [ "cJSON:cjson" ]
94fb299fa2Sopenharmony_ci
95fb299fa2Sopenharmony_ci  subsystem_name = "updater"
96fb299fa2Sopenharmony_ci  part_name = "updater"
97fb299fa2Sopenharmony_ci}
98fb299fa2Sopenharmony_ci
99fb299fa2Sopenharmony_ciohos_static_library("libutils_common") {
100fb299fa2Sopenharmony_ci  sources = [ "utils_common.cpp" ]
101fb299fa2Sopenharmony_ci
102fb299fa2Sopenharmony_ci  include_dirs = [
103fb299fa2Sopenharmony_ci    "include",
104fb299fa2Sopenharmony_ci    "${updater_path}/services/include/",
105fb299fa2Sopenharmony_ci  ]
106fb299fa2Sopenharmony_ci
107fb299fa2Sopenharmony_ci  subsystem_name = "updater"
108fb299fa2Sopenharmony_ci  part_name = "updater"
109fb299fa2Sopenharmony_ci}
110fb299fa2Sopenharmony_ci
111fb299fa2Sopenharmony_ciohos_executable("updater_reboot") {
112fb299fa2Sopenharmony_ci  sources = [ "updater_reboot.cpp" ]
113fb299fa2Sopenharmony_ci
114fb299fa2Sopenharmony_ci  include_dirs = [
115fb299fa2Sopenharmony_ci    "include",
116fb299fa2Sopenharmony_ci    "${updater_path}/interfaces/kits/include/",
117fb299fa2Sopenharmony_ci    "${updater_path}/services/include/",
118fb299fa2Sopenharmony_ci  ]
119fb299fa2Sopenharmony_ci
120fb299fa2Sopenharmony_ci  deps = [
121fb299fa2Sopenharmony_ci    "${updater_path}/interfaces/kits/misc_info:libmiscinfo",
122fb299fa2Sopenharmony_ci    "${updater_path}/services/fs_manager:libfsmanager",
123fb299fa2Sopenharmony_ci    "${updater_path}/utils:libutils",
124fb299fa2Sopenharmony_ci  ]
125fb299fa2Sopenharmony_ci  install_images = [ "updater" ]
126fb299fa2Sopenharmony_ci  install_enable = true
127fb299fa2Sopenharmony_ci  part_name = "updater"
128fb299fa2Sopenharmony_ci  subsystem_name = "updater"
129fb299fa2Sopenharmony_ci}
130fb299fa2Sopenharmony_ci
131fb299fa2Sopenharmony_ciohos_executable("write_updater") {
132fb299fa2Sopenharmony_ci  sources = [ "write_updater.cpp" ]
133fb299fa2Sopenharmony_ci
134fb299fa2Sopenharmony_ci  include_dirs = [
135fb299fa2Sopenharmony_ci    "include",
136fb299fa2Sopenharmony_ci    "${updater_path}/interfaces/kits/include/",
137fb299fa2Sopenharmony_ci    "${updater_path}/services/include/",
138fb299fa2Sopenharmony_ci  ]
139fb299fa2Sopenharmony_ci
140fb299fa2Sopenharmony_ci  deps = [ "${updater_path}/interfaces/kits/misc_info:libmiscinfo" ]
141fb299fa2Sopenharmony_ci  external_deps = [
142fb299fa2Sopenharmony_ci    "bounds_checking_function:libsec_static",
143fb299fa2Sopenharmony_ci    "init:libbegetutil_static",
144fb299fa2Sopenharmony_ci  ]
145fb299fa2Sopenharmony_ci
146fb299fa2Sopenharmony_ci  install_enable = true
147fb299fa2Sopenharmony_ci  part_name = "updater"
148fb299fa2Sopenharmony_ci  subsystem_name = "updater"
149fb299fa2Sopenharmony_ci}
150