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("//build/ohos.gni") 15import("//build/test.gni") 16ohos_executable("restool") { 17 sources = [ 18 "src/append_compiler.cpp", 19 "src/cmd_list.cpp", 20 "src/cmd_parser.cpp", 21 "src/config_parser.cpp", 22 "src/factory_resource_compiler.cpp", 23 "src/file_entry.cpp", 24 "src/file_manager.cpp", 25 "src/generic_compiler.cpp", 26 "src/header.cpp", 27 "src/i_resource_compiler.cpp", 28 "src/id_worker.cpp", 29 "src/increment_index.cpp", 30 "src/increment_list.cpp", 31 "src/increment_manager.cpp", 32 "src/json_compiler.cpp", 33 "src/key_parser.cpp", 34 "src/module_combine.cpp", 35 "src/preview_manager.cpp", 36 "src/reference_parser.cpp", 37 "src/resource_append.cpp", 38 "src/resource_directory.cpp", 39 "src/resource_item.cpp", 40 "src/resource_merge.cpp", 41 "src/resource_module.cpp", 42 "src/resource_module_inc.cpp", 43 "src/resource_pack.cpp", 44 "src/resource_table.cpp", 45 "src/resource_util.cpp", 46 "src/restool.cpp", 47 "src/solid_xml_compiler.cpp", 48 "src/sqlite_database.cpp", 49 "src/task_handle.cpp", 50 "src/xml/key_manager.cpp", 51 "src/xml/solid_xml.cpp", 52 "src/xml/xml_converter.cpp", 53 "src/xml/xml_key_node.cpp", 54 ] 55 56 include_dirs = [] 57 include_dirs += [ 58 "include", 59 "//third_party/jsoncpp/include", 60 "//third_party/sqlite/include", 61 "//third_party/bounds_checking_function/include", 62 ] 63 64 deps = [ 65 "//developtools/global_resource_tool/build/bounds_checking_function:restool_bounds_checking_function", 66 "//developtools/global_resource_tool/build/jsoncpp:restool_jsoncpp", 67 "//developtools/global_resource_tool/build/sqlite3:restool_sqlite", 68 "//third_party/libxml2:static_libxml2", 69 ] 70 71 cflags = [ "-std=c++17" ] 72 if (is_mingw) { 73 ldflags = [ 74 "-static", 75 "-lws2_32", 76 "-lshlwapi", 77 ] 78 } 79 subsystem_name = "developtools" 80 part_name = "global_resource_tool" 81} 82 83ohos_unittest_py("restool_test") { 84 sources = [ "test/test.py" ] 85} 86 87ID_DEFINED_PATH = "//base/global/system_resources/systemres/main/resources/base/element/id_defined.json" 88 89ohos_copy("restool_id_defined") { 90 sources = [ "${ID_DEFINED_PATH}" ] 91 outputs = 92 [ get_label_info( 93 "//developtools/global_resource_tool:restool($host_toolchain)", 94 "root_out_dir") + "/developtools/global_resource_tool/" ] 95 deps = [ "//developtools/global_resource_tool:restool($host_toolchain)" ] 96 subsystem_name = "developtools" 97 part_name = "global_resource_tool" 98} 99 100ohos_prebuilt_etc("restool_systemres") { 101 source = "${ID_DEFINED_PATH}" 102 subsystem_name = "developtools" 103 part_name = "global_resource_tool" 104} 105