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_ciyacc_path = "$root_out_dir/updater/updater/yacc"
19fb299fa2Sopenharmony_ciscript_yacc_path = "./script_interpreter/script_yacc.y"
20fb299fa2Sopenharmony_ciscript_lex_path = "./script_interpreter/script_lex.l"
21fb299fa2Sopenharmony_ciaction("gen_yacc") {
22fb299fa2Sopenharmony_ci  script = "${updater_path}/services/script/generate_yacc.py"
23fb299fa2Sopenharmony_ci  inputs = [ script ]
24fb299fa2Sopenharmony_ci  outputs = [
25fb299fa2Sopenharmony_ci    "$root_out_dir/updater/updater/yacc/lexer.cpp",
26fb299fa2Sopenharmony_ci    "$root_out_dir/updater/updater/yacc/parser.cpp",
27fb299fa2Sopenharmony_ci  ]
28fb299fa2Sopenharmony_ci  args = [
29fb299fa2Sopenharmony_ci    "--output",
30fb299fa2Sopenharmony_ci    rebase_path(yacc_path, root_build_dir),
31fb299fa2Sopenharmony_ci    "--bisoninput",
32fb299fa2Sopenharmony_ci    rebase_path(script_yacc_path, root_build_dir),
33fb299fa2Sopenharmony_ci    "--flexinput",
34fb299fa2Sopenharmony_ci    rebase_path(script_lex_path, root_build_dir),
35fb299fa2Sopenharmony_ci  ]
36fb299fa2Sopenharmony_ci}
37fb299fa2Sopenharmony_ci
38fb299fa2Sopenharmony_ciconfig("script_config") {
39fb299fa2Sopenharmony_ci  visibility = [ ":*" ]
40fb299fa2Sopenharmony_ci
41fb299fa2Sopenharmony_ci  include_dirs = [
42fb299fa2Sopenharmony_ci    "${updater_path}/interfaces/kits/include",
43fb299fa2Sopenharmony_ci    "${updater_path}/services/common",
44fb299fa2Sopenharmony_ci    "${updater_path}/services/include",
45fb299fa2Sopenharmony_ci    "${updater_path}/services/include/log",
46fb299fa2Sopenharmony_ci    "${updater_path}/services/include/package",
47fb299fa2Sopenharmony_ci    "${updater_path}/services/include/script",
48fb299fa2Sopenharmony_ci    "${updater_path}/services/include/updater",
49fb299fa2Sopenharmony_ci    "${updater_path}/utils/include",
50fb299fa2Sopenharmony_ci    "script_instruction",
51fb299fa2Sopenharmony_ci    "script_interpreter",
52fb299fa2Sopenharmony_ci    "script_manager",
53fb299fa2Sopenharmony_ci    "threadpool",
54fb299fa2Sopenharmony_ci    "$yacc_path",
55fb299fa2Sopenharmony_ci  ]
56fb299fa2Sopenharmony_ci
57fb299fa2Sopenharmony_ci  configs = [ "//build/config/compiler:exceptions" ]
58fb299fa2Sopenharmony_ci}
59fb299fa2Sopenharmony_ci
60fb299fa2Sopenharmony_ciconfig("libupdaterscript_exported_headers") {
61fb299fa2Sopenharmony_ci  visibility = [ ":*" ]
62fb299fa2Sopenharmony_ci  include_dirs = [
63fb299fa2Sopenharmony_ci    "${updater_path}/services/include/script",
64fb299fa2Sopenharmony_ci    "${updater_path}/services/script/script_instruction",
65fb299fa2Sopenharmony_ci    "${updater_path}/services/script/script_interpreter",
66fb299fa2Sopenharmony_ci    "${updater_path}/services/script/script_manager",
67fb299fa2Sopenharmony_ci    "${updater_path}/services/script/threadpool",
68fb299fa2Sopenharmony_ci  ]
69fb299fa2Sopenharmony_ci}
70fb299fa2Sopenharmony_ci
71fb299fa2Sopenharmony_ciohos_static_library("libthreadpool") {
72fb299fa2Sopenharmony_ci  sources = [ "${updater_path}/services/script/threadpool/threadpool.cpp" ]
73fb299fa2Sopenharmony_ci
74fb299fa2Sopenharmony_ci  include_dirs = [
75fb299fa2Sopenharmony_ci    "${updater_path}/interfaces/kits/include",
76fb299fa2Sopenharmony_ci    "${updater_path}/services/common",
77fb299fa2Sopenharmony_ci    "${updater_path}/services/include",
78fb299fa2Sopenharmony_ci    "${updater_path}/services/include/log",
79fb299fa2Sopenharmony_ci    "${updater_path}/services/include/script",
80fb299fa2Sopenharmony_ci    "${updater_path}/services/include/package",
81fb299fa2Sopenharmony_ci    "${updater_path}/services/script/script_manager",
82fb299fa2Sopenharmony_ci    "${updater_path}/services/script/threadpool",
83fb299fa2Sopenharmony_ci    "${updater_path}/utils/include",
84fb299fa2Sopenharmony_ci  ]
85fb299fa2Sopenharmony_ci
86fb299fa2Sopenharmony_ci  subsystem_name = "updater"
87fb299fa2Sopenharmony_ci  part_name = "updater"
88fb299fa2Sopenharmony_ci}
89fb299fa2Sopenharmony_ci
90fb299fa2Sopenharmony_ciohos_static_library("libupdaterscript") {
91fb299fa2Sopenharmony_ci  sources = [
92fb299fa2Sopenharmony_ci    "$root_out_dir/updater/updater/yacc/lexer.cpp",
93fb299fa2Sopenharmony_ci    "$root_out_dir/updater/updater/yacc/parser.cpp",
94fb299fa2Sopenharmony_ci    "./script_instruction/script_basicinstruction.cpp",
95fb299fa2Sopenharmony_ci    "./script_instruction/script_instructionhelper.cpp",
96fb299fa2Sopenharmony_ci    "./script_instruction/script_loadscript.cpp",
97fb299fa2Sopenharmony_ci    "./script_instruction/script_registercmd.cpp",
98fb299fa2Sopenharmony_ci    "./script_instruction/script_updateprocesser.cpp",
99fb299fa2Sopenharmony_ci    "./script_interpreter/script_context.cpp",
100fb299fa2Sopenharmony_ci    "./script_interpreter/script_expression.cpp",
101fb299fa2Sopenharmony_ci    "./script_interpreter/script_function.cpp",
102fb299fa2Sopenharmony_ci    "./script_interpreter/script_interpreter.cpp",
103fb299fa2Sopenharmony_ci    "./script_interpreter/script_param.cpp",
104fb299fa2Sopenharmony_ci    "./script_interpreter/script_scanner.cpp",
105fb299fa2Sopenharmony_ci    "./script_interpreter/script_statement.cpp",
106fb299fa2Sopenharmony_ci    "./script_manager/script_managerImpl.cpp",
107fb299fa2Sopenharmony_ci    "./script_manager/script_utils.cpp",
108fb299fa2Sopenharmony_ci  ]
109fb299fa2Sopenharmony_ci  configs = [ ":script_config" ]
110fb299fa2Sopenharmony_ci
111fb299fa2Sopenharmony_ci  public_configs = [ ":libupdaterscript_exported_headers" ]
112fb299fa2Sopenharmony_ci
113fb299fa2Sopenharmony_ci  external_deps = [
114fb299fa2Sopenharmony_ci    "bounds_checking_function:libsec_static",
115fb299fa2Sopenharmony_ci    "c_utils:utilsbase",
116fb299fa2Sopenharmony_ci  ]
117fb299fa2Sopenharmony_ci  deps = [
118fb299fa2Sopenharmony_ci    "${updater_path}/services/script:gen_yacc",
119fb299fa2Sopenharmony_ci    "${updater_path}/services/script:libthreadpool",
120fb299fa2Sopenharmony_ci  ]
121fb299fa2Sopenharmony_ci
122fb299fa2Sopenharmony_ci  subsystem_name = "updater"
123fb299fa2Sopenharmony_ci  part_name = "updater"
124fb299fa2Sopenharmony_ci}
125