Add gn_unittests to linux bots.
[chromium-blink-merge.git] / tools / gn / BUILD.gn
blobccbb6bb69e2d2c3b3a6a5ae21bbbc7f0d4c738b6
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//testing/test.gni")
7 defines = [ "GN_BUILD" ]
9 static_library("gn_lib") {
10   sources = [
11     "action_target_generator.cc",
12     "action_target_generator.h",
13     "action_values.cc",
14     "action_values.h",
15     "args.cc",
16     "args.h",
17     "binary_target_generator.cc",
18     "binary_target_generator.h",
19     "build_settings.cc",
20     "build_settings.h",
21     "builder.cc",
22     "builder.h",
23     "builder_record.cc",
24     "builder_record.h",
25     "c_include_iterator.cc",
26     "c_include_iterator.h",
27     "command_args.cc",
28     "command_check.cc",
29     "command_clean.cc",
30     "command_desc.cc",
31     "command_format.cc",
32     "command_gen.cc",
33     "command_help.cc",
34     "command_ls.cc",
35     "command_refs.cc",
36     "commands.cc",
37     "commands.h",
38     "config.cc",
39     "config.h",
40     "config_values.cc",
41     "config_values.h",
42     "config_values_extractors.cc",
43     "config_values_extractors.h",
44     "config_values_generator.cc",
45     "config_values_generator.h",
46     "copy_target_generator.cc",
47     "copy_target_generator.h",
48     "deps_iterator.cc",
49     "deps_iterator.h",
50     "err.cc",
51     "err.h",
52     "escape.cc",
53     "escape.h",
54     "exec_process.cc",
55     "exec_process.h",
56     "filesystem_utils.cc",
57     "filesystem_utils.h",
58     "function_exec_script.cc",
59     "function_foreach.cc",
60     "function_get_label_info.cc",
61     "function_get_path_info.cc",
62     "function_get_target_outputs.cc",
63     "function_process_file_template.cc",
64     "function_read_file.cc",
65     "function_rebase_path.cc",
66     "function_set_default_toolchain.cc",
67     "function_set_defaults.cc",
68     "function_template.cc",
69     "function_toolchain.cc",
70     "function_write_file.cc",
71     "functions.cc",
72     "functions.h",
73     "functions_target.cc",
74     "group_target_generator.cc",
75     "group_target_generator.h",
76     "header_checker.cc",
77     "header_checker.h",
78     "import_manager.cc",
79     "import_manager.h",
80     "input_conversion.cc",
81     "input_conversion.h",
82     "input_file.cc",
83     "input_file.h",
84     "input_file_manager.cc",
85     "input_file_manager.h",
86     "item.cc",
87     "item.h",
88     "label.cc",
89     "label.h",
90     "label_pattern.cc",
91     "label_pattern.h",
92     "label_ptr.h",
93     "loader.cc",
94     "loader.h",
95     "location.cc",
96     "location.h",
97     "ninja_action_target_writer.cc",
98     "ninja_action_target_writer.h",
99     "ninja_binary_target_writer.cc",
100     "ninja_binary_target_writer.h",
101     "ninja_build_writer.cc",
102     "ninja_build_writer.h",
103     "ninja_copy_target_writer.cc",
104     "ninja_copy_target_writer.h",
105     "ninja_group_target_writer.cc",
106     "ninja_group_target_writer.h",
107     "ninja_target_writer.cc",
108     "ninja_target_writer.h",
109     "ninja_toolchain_writer.cc",
110     "ninja_toolchain_writer.h",
111     "ninja_utils.cc",
112     "ninja_utils.h",
113     "ninja_writer.cc",
114     "ninja_writer.h",
115     "operators.cc",
116     "operators.h",
117     "output_file.cc",
118     "output_file.h",
119     "parse_tree.cc",
120     "parse_tree.h",
121     "parser.cc",
122     "parser.h",
123     "path_output.cc",
124     "path_output.h",
125     "pattern.cc",
126     "pattern.h",
127     "scheduler.cc",
128     "scheduler.h",
129     "scope.cc",
130     "scope.h",
131     "scope_per_file_provider.cc",
132     "scope_per_file_provider.h",
133     "settings.cc",
134     "settings.h",
135     "setup.cc",
136     "setup.h",
137     "source_dir.cc",
138     "source_dir.h",
139     "source_file.cc",
140     "source_file.h",
141     "source_file_type.cc",
142     "source_file_type.h",
143     "standard_out.cc",
144     "standard_out.h",
145     "string_utils.cc",
146     "string_utils.h",
147     "substitution_list.cc",
148     "substitution_list.h",
149     "substitution_pattern.cc",
150     "substitution_pattern.h",
151     "substitution_type.cc",
152     "substitution_type.h",
153     "substitution_writer.cc",
154     "substitution_writer.h",
155     "switches.cc",
156     "switches.h",
157     "target.cc",
158     "target.h",
159     "target_generator.cc",
160     "target_generator.h",
161     "template.cc",
162     "template.h",
163     "token.cc",
164     "token.h",
165     "tokenizer.cc",
166     "tokenizer.h",
167     "tool.cc",
168     "tool.h",
169     "toolchain.cc",
170     "toolchain.h",
171     "trace.cc",
172     "trace.h",
173     "unique_vector.h",
174     "value.cc",
175     "value.h",
176     "value_extractors.cc",
177     "value_extractors.h",
178     "variables.cc",
179     "variables.h",
180     "visibility.cc",
181     "visibility.h",
182   ]
184   deps = [
185     "//base",
186     "//base/third_party/dynamic_annotations",
187   ]
190 action("last_commit_position") {
191   script = "last_commit_position.py"
193   # This dependency forces a re-run when the code is synced.
194   inputs = [
195     "//build/util/LASTCHANGE",
196   ]
198   outfile = "$target_gen_dir/last_commit_position.h"
199   outputs = [
200     outfile,
201   ]
203   args = [
204     rebase_path("//", root_build_dir),
205     rebase_path(outfile, root_build_dir),
206     "TOOLS_GN_LAST_COMMIT_POSITION_H_",
207   ]
210 executable("gn") {
211   sources = [
212     "gn_main.cc",
213   ]
215   deps = [
216     ":gn_lib",
217     ":last_commit_position",
218     "//base",
219   ]
222 test("gn_unittests") {
223   sources = [
224     "action_target_generator_unittest.cc",
225     "args_unittest.cc",
226     "builder_unittest.cc",
227     "c_include_iterator_unittest.cc",
228     "command_format_unittest.cc",
229     "config_values_extractors_unittest.cc",
230     "escape_unittest.cc",
231     "exec_process_unittest.cc",
232     "filesystem_utils_unittest.cc",
233     "function_foreach_unittest.cc",
234     "function_get_label_info_unittest.cc",
235     "function_get_path_info_unittest.cc",
236     "function_get_target_outputs_unittest.cc",
237     "function_process_file_template_unittest.cc",
238     "function_rebase_path_unittest.cc",
239     "function_write_file_unittest.cc",
240     "functions_target_unittest.cc",
241     "functions_unittest.cc",
242     "header_checker_unittest.cc",
243     "input_conversion_unittest.cc",
244     "label_pattern_unittest.cc",
245     "label_unittest.cc",
246     "loader_unittest.cc",
247     "ninja_action_target_writer_unittest.cc",
248     "ninja_binary_target_writer_unittest.cc",
249     "ninja_copy_target_writer_unittest.cc",
250     "ninja_group_target_writer_unittest.cc",
251     "ninja_target_writer_unittest.cc",
252     "ninja_toolchain_writer_unittest.cc",
253     "operators_unittest.cc",
254     "parse_tree_unittest.cc",
255     "parser_unittest.cc",
256     "path_output_unittest.cc",
257     "pattern_unittest.cc",
258     "scope_per_file_provider_unittest.cc",
259     "scope_unittest.cc",
260     "source_dir_unittest.cc",
261     "string_utils_unittest.cc",
262     "substitution_pattern_unittest.cc",
263     "substitution_writer_unittest.cc",
264     "target_generator_unittest.cc",
265     "target_unittest.cc",
266     "template_unittest.cc",
267     "test_with_scope.cc",
268     "test_with_scope.h",
269     "tokenizer_unittest.cc",
270     "unique_vector_unittest.cc",
271     "value_unittest.cc",
272     "visibility_unittest.cc",
273   ]
274   deps = [
275     ":gn_lib",
276     "//base/test:run_all_unittests",
277     "//base/test:test_support",
278     "//testing/gtest",
279   ]
282 executable("generate_test_gn_data") {
283   sources = [
284     "generate_test_gn_data.cc",
285   ]
286   deps = [
287     "//base",
288   ]