• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 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")
16import("//foundation/ability/idl_tool/idl_tool.gni")
17
18module_output_path = "idl/unittest"
19
20IDL_DIR = "../../.."
21
22config("idl_unittest_test_config") {
23  include_dirs = [
24    "../../common/",
25    "${IDL_DIR}/",
26    "//third_party/bounds_checking_function/include/",
27  ]
28}
29
30common_sources = [
31  "${IDL_DIR}/ast/ast_array_type.cpp",
32  "${IDL_DIR}/ast/ast_boolean_type.cpp",
33  "${IDL_DIR}/ast/ast_byte_type.cpp",
34  "${IDL_DIR}/ast/ast_char_type.cpp",
35  "${IDL_DIR}/ast/ast_double_type.cpp",
36  "${IDL_DIR}/ast/ast_float_type.cpp",
37  "${IDL_DIR}/ast/ast_integer_type.cpp",
38  "${IDL_DIR}/ast/ast_interface_type.cpp",
39  "${IDL_DIR}/ast/ast_list_type.cpp",
40  "${IDL_DIR}/ast/ast_long_type.cpp",
41  "${IDL_DIR}/ast/ast_map_type.cpp",
42  "${IDL_DIR}/ast/ast_method.cpp",
43  "${IDL_DIR}/ast/ast_module.cpp",
44  "${IDL_DIR}/ast/ast_namespace.cpp",
45  "${IDL_DIR}/ast/ast_node.cpp",
46  "${IDL_DIR}/ast/ast_parameter.cpp",
47  "${IDL_DIR}/ast/ast_sequenceable_type.cpp",
48  "${IDL_DIR}/ast/ast_short_type.cpp",
49  "${IDL_DIR}/ast/ast_string_type.cpp",
50  "${IDL_DIR}/ast/ast_type.cpp",
51  "${IDL_DIR}/ast/ast_void_type.cpp",
52]
53
54common_sources += [
55  "${IDL_DIR}/codegen/code_emitter.cpp",
56  "${IDL_DIR}/codegen/code_generator.cpp",
57  "${IDL_DIR}/codegen/cpp_code_emitter.cpp",
58  "${IDL_DIR}/codegen/ts_code_emitter.cpp",
59]
60
61common_sources += [
62  "${IDL_DIR}/metadata/metadata_builder.cpp",
63  "${IDL_DIR}/metadata/metadata_dumper.cpp",
64  "${IDL_DIR}/metadata/metadata_reader.cpp",
65  "${IDL_DIR}/metadata/metadata_serializer.cpp",
66]
67
68common_sources += [
69  "${IDL_DIR}/parser/lexer.cpp",
70  "${IDL_DIR}/parser/parser.cpp",
71]
72
73common_sources += [
74  "${IDL_DIR}/util/file.cpp",
75  "${IDL_DIR}/util/light_refcount_base.cpp",
76  "${IDL_DIR}/util/logger.cpp",
77  "${IDL_DIR}/util/options.cpp",
78  "${IDL_DIR}/util/string.cpp",
79  "${IDL_DIR}/util/string_builder.cpp",
80  "${IDL_DIR}/util/string_pool.cpp",
81]
82
83ohos_unittest("metadata_reader_test") {
84  module_out_path = module_output_path
85  include_dirs = [ "${IDL_TOOL_DIR}" ]
86
87  sources = [ "metadata_reader_test.cpp" ]
88
89  sources += common_sources
90
91  deps = []
92
93  external_deps = [
94    "c_utils:utils",
95    "hilog:libhilog",
96  ]
97
98  part_name = "idl_tool"
99  subsystem_name = "ability"
100}
101
102group("unittest") {
103  testonly = true
104  deps = [ ":metadata_reader_test" ]
105}
106