OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/functions.h" | 5 #include "tools/gn/functions.h" |
6 | 6 |
7 #include "tools/gn/config_values_generator.h" | 7 #include "tools/gn/config_values_generator.h" |
8 #include "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
9 #include "tools/gn/parse_tree.h" | 9 #include "tools/gn/parse_tree.h" |
10 #include "tools/gn/scope.h" | 10 #include "tools/gn/scope.h" |
11 #include "tools/gn/target_generator.h" | 11 #include "tools/gn/target_generator.h" |
12 #include "tools/gn/value.h" | 12 #include "tools/gn/value.h" |
13 #include "tools/gn/variables.h" | 13 #include "tools/gn/variables.h" |
14 | 14 |
15 #define DEPENDENT_CONFIG_VARS \ | 15 #define DEPENDENT_CONFIG_VARS \ |
16 " Dependent configs: all_dependent_configs, direct_dependent_configs\n" | 16 " Dependent configs: all_dependent_configs, public_configs\n" |
17 #define DEPS_VARS \ | 17 #define DEPS_VARS \ |
18 " Deps: data, datadeps, deps, forward_dependent_configs_from, hard_dep\n" | 18 " Deps: data_deps, deps, forward_dependent_configs_from, public_deps\n" |
19 #define GENERAL_TARGET_VARS \ | 19 #define GENERAL_TARGET_VARS \ |
20 " General: configs, inputs, sources\n" | 20 " General: check_includes, configs, data, inputs, output_name,\n" \ |
| 21 " output_extension, public, sources, testonly, visibility\n" |
21 | 22 |
22 namespace functions { | 23 namespace functions { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 Value ExecuteGenericTarget(const char* target_type, | 27 Value ExecuteGenericTarget(const char* target_type, |
27 Scope* scope, | 28 Scope* scope, |
28 const FunctionCallNode* function, | 29 const FunctionCallNode* function, |
29 const std::vector<Value>& args, | 30 const std::vector<Value>& args, |
30 BlockNode* block, | 31 BlockNode* block, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 " current build file and converted as needed automatically).\n" | 65 " current build file and converted as needed automatically).\n" |
65 | 66 |
66 // Common help paragraph on script output directories. | 67 // Common help paragraph on script output directories. |
67 #define SCRIPT_EXECUTION_OUTPUTS \ | 68 #define SCRIPT_EXECUTION_OUTPUTS \ |
68 " All output files must be inside the output directory of the build.\n" \ | 69 " All output files must be inside the output directory of the build.\n" \ |
69 " You would generally use |$target_out_dir| or |$target_gen_dir| to\n" \ | 70 " You would generally use |$target_out_dir| or |$target_gen_dir| to\n" \ |
70 " reference the output or generated intermediate file directories,\n" \ | 71 " reference the output or generated intermediate file directories,\n" \ |
71 " respectively.\n" | 72 " respectively.\n" |
72 | 73 |
73 #define ACTION_DEPS \ | 74 #define ACTION_DEPS \ |
74 " The \"deps\" for an action will always be completed before any part\n" \ | 75 " The \"deps\" and \"public_deps\" for an action will always be\n" \ |
75 " of the action is run so it can depend on the output of previous\n" \ | 76 " completed before any part of the action is run so it can depend on\n" \ |
76 " steps. The \"datadeps\" will be built if the action is built, but\n" \ | 77 " the output of previous steps. The \"data_deps\" will be built if the\n" \ |
77 " may not have completed before all steps of the action are started.\n" \ | 78 " action is built, but may not have completed before all steps of the\n" \ |
78 " This can give additional parallelism in the build for runtime-only\n" \ | 79 " action are started. This can give additional parallelism in the build\n"\ |
79 " dependencies.\n" | 80 " for runtime-only dependencies.\n" |
80 | 81 |
81 const char kAction[] = "action"; | 82 const char kAction[] = "action"; |
82 const char kAction_HelpShort[] = | 83 const char kAction_HelpShort[] = |
83 "action: Declare a target that runs a script a single time."; | 84 "action: Declare a target that runs a script a single time."; |
84 const char kAction_Help[] = | 85 const char kAction_Help[] = |
85 "action: Declare a target that runs a script a single time.\n" | 86 "action: Declare a target that runs a script a single time.\n" |
86 "\n" | 87 "\n" |
87 " This target type allows you to run a script a single time to produce\n" | 88 " This target type allows you to run a script a single time to produce\n" |
88 " or more output files. If you want to run a script once for each of a\n" | 89 " or more output files. If you want to run a script once for each of a\n" |
89 " set of input files, see \"gn help action_foreach\".\n" | 90 " set of input files, see \"gn help action_foreach\".\n" |
(...skipping 24 matching lines...) Expand all Loading... |
114 " the \"outputs\".\n" | 115 " the \"outputs\".\n" |
115 "\n" | 116 "\n" |
116 SCRIPT_EXECUTION_CONTEXT | 117 SCRIPT_EXECUTION_CONTEXT |
117 "\n" | 118 "\n" |
118 "File name handling\n" | 119 "File name handling\n" |
119 "\n" | 120 "\n" |
120 SCRIPT_EXECUTION_OUTPUTS | 121 SCRIPT_EXECUTION_OUTPUTS |
121 "\n" | 122 "\n" |
122 "Variables\n" | 123 "Variables\n" |
123 "\n" | 124 "\n" |
124 " args, data, datadeps, depfile, deps, outputs*, script*,\n" | 125 " args, data, data_deps, depfile, deps, outputs*, script*,\n" |
125 " inputs, sources\n" | 126 " inputs, sources\n" |
126 " * = required\n" | 127 " * = required\n" |
127 "\n" | 128 "\n" |
128 "Example\n" | 129 "Example\n" |
129 "\n" | 130 "\n" |
130 " action(\"run_this_guy_once\") {\n" | 131 " action(\"run_this_guy_once\") {\n" |
131 " script = \"doprocessing.py\"\n" | 132 " script = \"doprocessing.py\"\n" |
132 " sources = [ \"my_configuration.txt\" ]\n" | 133 " sources = [ \"my_configuration.txt\" ]\n" |
133 " outputs = [ \"$target_gen_dir/insightful_output.txt\" ]\n" | 134 " outputs = [ \"$target_gen_dir/insightful_output.txt\" ]\n" |
134 "\n" | 135 "\n" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 "Outputs\n" | 186 "Outputs\n" |
186 "\n" | 187 "\n" |
187 SCRIPT_EXECUTION_CONTEXT | 188 SCRIPT_EXECUTION_CONTEXT |
188 "\n" | 189 "\n" |
189 "File name handling\n" | 190 "File name handling\n" |
190 "\n" | 191 "\n" |
191 SCRIPT_EXECUTION_OUTPUTS | 192 SCRIPT_EXECUTION_OUTPUTS |
192 "\n" | 193 "\n" |
193 "Variables\n" | 194 "Variables\n" |
194 "\n" | 195 "\n" |
195 " args, data, datadeps, depfile, deps, outputs*, script*,\n" | 196 " args, data, data_deps, depfile, deps, outputs*, script*,\n" |
196 " inputs, sources*\n" | 197 " inputs, sources*\n" |
197 " * = required\n" | 198 " * = required\n" |
198 "\n" | 199 "\n" |
199 "Example\n" | 200 "Example\n" |
200 "\n" | 201 "\n" |
201 " # Runs the script over each IDL file. The IDL script will generate\n" | 202 " # Runs the script over each IDL file. The IDL script will generate\n" |
202 " # both a .cc and a .h file for each input.\n" | 203 " # both a .cc and a .h file for each input.\n" |
203 " action_foreach(\"my_idl\") {\n" | 204 " action_foreach(\"my_idl\") {\n" |
204 " script = \"idl_processor.py\"\n" | 205 " script = \"idl_processor.py\"\n" |
205 " sources = [ \"foo.idl\", \"bar.idl\" ]\n" | 206 " sources = [ \"foo.idl\", \"bar.idl\" ]\n" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 355 |
355 const char kSharedLibrary[] = "shared_library"; | 356 const char kSharedLibrary[] = "shared_library"; |
356 const char kSharedLibrary_HelpShort[] = | 357 const char kSharedLibrary_HelpShort[] = |
357 "shared_library: Declare a shared library target."; | 358 "shared_library: Declare a shared library target."; |
358 const char kSharedLibrary_Help[] = | 359 const char kSharedLibrary_Help[] = |
359 "shared_library: Declare a shared library target.\n" | 360 "shared_library: Declare a shared library target.\n" |
360 "\n" | 361 "\n" |
361 " A shared library will be specified on the linker line for targets\n" | 362 " A shared library will be specified on the linker line for targets\n" |
362 " listing the shared library in its \"deps\". If you don't want this\n" | 363 " listing the shared library in its \"deps\". If you don't want this\n" |
363 " (say you dynamically load the library at runtime), then you should\n" | 364 " (say you dynamically load the library at runtime), then you should\n" |
364 " depend on the shared library via \"datadeps\" instead.\n" | 365 " depend on the shared library via \"data_deps\" instead.\n" |
365 "\n" | 366 "\n" |
366 "Variables\n" | 367 "Variables\n" |
367 "\n" | 368 "\n" |
368 CONFIG_VALUES_VARS_HELP | 369 CONFIG_VALUES_VARS_HELP |
369 DEPS_VARS | 370 DEPS_VARS |
370 DEPENDENT_CONFIG_VARS | 371 DEPENDENT_CONFIG_VARS |
371 GENERAL_TARGET_VARS; | 372 GENERAL_TARGET_VARS; |
372 | 373 |
373 Value RunSharedLibrary(Scope* scope, | 374 Value RunSharedLibrary(Scope* scope, |
374 const FunctionCallNode* function, | 375 const FunctionCallNode* function, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 Value RunStaticLibrary(Scope* scope, | 451 Value RunStaticLibrary(Scope* scope, |
451 const FunctionCallNode* function, | 452 const FunctionCallNode* function, |
452 const std::vector<Value>& args, | 453 const std::vector<Value>& args, |
453 BlockNode* block, | 454 BlockNode* block, |
454 Err* err) { | 455 Err* err) { |
455 return ExecuteGenericTarget(functions::kStaticLibrary, scope, function, args, | 456 return ExecuteGenericTarget(functions::kStaticLibrary, scope, function, args, |
456 block, err); | 457 block, err); |
457 } | 458 } |
458 | 459 |
459 } // namespace functions | 460 } // namespace functions |
OLD | NEW |