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 ] 69} 70 71ohos_static_library("libthreadpool") { 72 sources = [ "${updater_path}/services/script/threadpool/threadpool.cpp" ] 73 74 include_dirs = [ 75 "${updater_path}/interfaces/kits/include", 76 "${updater_path}/services/common", 77 "${updater_path}/services/include", 78 "${updater_path}/services/include/log", 79 "${updater_path}/services/include/script", 80 "${updater_path}/services/include/package", 81 "${updater_path}/services/script/script_manager", 82 "${updater_path}/services/script/threadpool", 83 "${updater_path}/utils/include", 84 ] 85 86 subsystem_name = "updater" 87 part_name = "updater" 88} 89 90ohos_static_library("libupdaterscript") { 91 sources = [ 92 "$root_out_dir/updater/updater/yacc/lexer.cpp", 93 "$root_out_dir/updater/updater/yacc/parser.cpp", 94 "./script_instruction/script_basicinstruction.cpp", 95 "./script_instruction/script_instructionhelper.cpp", 96 "./script_instruction/script_loadscript.cpp", 97 "./script_instruction/script_registercmd.cpp", 98 "./script_instruction/script_updateprocesser.cpp", 99 "./script_interpreter/script_context.cpp", 100 "./script_interpreter/script_expression.cpp", 101 "./script_interpreter/script_function.cpp", 102 "./script_interpreter/script_interpreter.cpp", 103 "./script_interpreter/script_param.cpp", 104 "./script_interpreter/script_scanner.cpp", 105 "./script_interpreter/script_statement.cpp", 106 "./script_manager/script_managerImpl.cpp", 107 "./script_manager/script_utils.cpp", 108 ] 109 configs = [ ":script_config" ] 110 111 public_configs = [ ":libupdaterscript_exported_headers" ] 112 113 external_deps = [ 114 "bounds_checking_function:libsec_static", 115 "c_utils:utilsbase", 116 ] 117 deps = [ 118 "${updater_path}/services/script:gen_yacc", 119 "${updater_path}/services/script:libthreadpool", 120 ] 121 122 subsystem_name = "updater" 123 part_name = "updater" 124} 125