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