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" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 " sources, outputs, and source_prereqs will be all treated as relative\n" \ | 63 " sources, outputs, and source_prereqs will be all treated as relative\n" \ |
64 " to the current build file and converted as needed automatically).\n" | 64 " to the current build file and converted as needed automatically).\n" |
65 | 65 |
66 // Common help paragraph on script output directories. | 66 // Common help paragraph on script output directories. |
67 #define SCRIPT_EXECUTION_OUTPUTS \ | 67 #define SCRIPT_EXECUTION_OUTPUTS \ |
68 " All output files must be inside the output directory of the build.\n" \ | 68 " 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" \ | 69 " You would generally use |$target_out_dir| or |$target_gen_dir| to\n" \ |
70 " reference the output or generated intermediate file directories,\n" \ | 70 " reference the output or generated intermediate file directories,\n" \ |
71 " respectively.\n" | 71 " respectively.\n" |
72 | 72 |
| 73 #define ACTION_DEPS \ |
| 74 " The \"deps\" for an action will always be completed before any part\n" \ |
| 75 " of the action is run so it can depend on the output of previous\n" \ |
| 76 " steps. The \"datadeps\" will be built if the action is built, but\n" \ |
| 77 " may not have completed before all steps of the action are started.\n" \ |
| 78 " This can give additional parallelism in the build for runtime-only\n" \ |
| 79 " dependencies.\n" |
| 80 |
73 const char kAction[] = "action"; | 81 const char kAction[] = "action"; |
74 const char kAction_HelpShort[] = | 82 const char kAction_HelpShort[] = |
75 "action: Declare a target that runs a script a single time."; | 83 "action: Declare a target that runs a script a single time."; |
76 const char kAction_Help[] = | 84 const char kAction_Help[] = |
77 "action: Declare a target that runs a script a single time.\n" | 85 "action: Declare a target that runs a script a single time.\n" |
78 "\n" | 86 "\n" |
79 " This target type allows you to run a script a single time to produce\n" | 87 " This target type allows you to run a script a single time to produce\n" |
80 " or more output files. If you want to run a script once for each of a\n" | 88 " or more output files. If you want to run a script once for each of a\n" |
81 " set of input files, see \"gn help action_foreach\".\n" | 89 " set of input files, see \"gn help action_foreach\".\n" |
82 "\n" | 90 "\n" |
| 91 "Inputs\n" |
| 92 "\n" |
83 " In an action the \"sources\" and \"source_prereqs\" are treated the\n" | 93 " In an action the \"sources\" and \"source_prereqs\" are treated the\n" |
84 " same: they're both input dependencies on script execution with no\n" | 94 " same: they're both input dependencies on script execution with no\n" |
85 " special handling. If you want to pass the sources to your script, you\n" | 95 " special handling. If you want to pass the sources to your script, you\n" |
86 " must do so explicitly by including them in the \"args\". Note also\n" | 96 " must do so explicitly by including them in the \"args\". Note also\n" |
87 " that this means there is no special handling of paths since GN\n" | 97 " that this means there is no special handling of paths since GN\n" |
88 " doesn't know which of the args are paths and not. You will want to use\n" | 98 " doesn't know which of the args are paths and not. You will want to use\n" |
89 " rebase_path() to convert paths to be relative to the root_build_dir.\n" | 99 " rebase_path() to convert paths to be relative to the root_build_dir.\n" |
90 "\n" | 100 "\n" |
91 " It is recommended you put inputs to your script in the \"sources\"\n" | 101 " It is recommended you put inputs to your script in the \"sources\"\n" |
92 " variable, and stuff like other Python files required to run your\n" | 102 " variable, and stuff like other Python files required to run your\n" |
93 " script in the \"source_prereqs\" variable.\n" | 103 " script in the \"source_prereqs\" variable.\n" |
94 "\n" | 104 "\n" |
| 105 ACTION_DEPS |
| 106 "\n" |
| 107 "Outputs\n" |
| 108 "\n" |
95 " You should specify files created by your script by specifying them in\n" | 109 " You should specify files created by your script by specifying them in\n" |
96 " the \"outputs\".\n" | 110 " the \"outputs\".\n" |
97 "\n" | 111 "\n" |
98 SCRIPT_EXECUTION_CONTEXT | 112 SCRIPT_EXECUTION_CONTEXT |
99 "\n" | 113 "\n" |
100 "File name handling\n" | 114 "File name handling\n" |
101 "\n" | 115 "\n" |
102 SCRIPT_EXECUTION_OUTPUTS | 116 SCRIPT_EXECUTION_OUTPUTS |
103 "\n" | 117 "\n" |
104 "Variables\n" | 118 "Variables\n" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 const char kActionForEach[] = "action_foreach"; | 152 const char kActionForEach[] = "action_foreach"; |
139 const char kActionForEach_HelpShort[] = | 153 const char kActionForEach_HelpShort[] = |
140 "action_foreach: Declare a target that runs a script over a set of files."; | 154 "action_foreach: Declare a target that runs a script over a set of files."; |
141 const char kActionForEach_Help[] = | 155 const char kActionForEach_Help[] = |
142 "action_foreach: Declare a target that runs a script over a set of files.\n" | 156 "action_foreach: Declare a target that runs a script over a set of files.\n" |
143 "\n" | 157 "\n" |
144 " This target type allows you to run a script once-per-file over a set\n" | 158 " This target type allows you to run a script once-per-file over a set\n" |
145 " of sources. If you want to run a script once that takes many files as\n" | 159 " of sources. If you want to run a script once that takes many files as\n" |
146 " input, see \"gn help action\".\n" | 160 " input, see \"gn help action\".\n" |
147 "\n" | 161 "\n" |
| 162 "Inputs\n" |
| 163 "\n" |
148 " The script will be run once per file in the \"sources\" variable. The\n" | 164 " The script will be run once per file in the \"sources\" variable. The\n" |
149 " \"outputs\" variable should specify one or more files with a source\n" | 165 " \"outputs\" variable should specify one or more files with a source\n" |
150 " expansion pattern in it (see \"gn help source_expansion\"). The output\n" | 166 " expansion pattern in it (see \"gn help source_expansion\"). The output\n" |
151 " file(s) for each script invocation should be unique. Normally you\n" | 167 " file(s) for each script invocation should be unique. Normally you\n" |
152 " use \"{{source_name_part}}\" in each output file.\n" | 168 " use \"{{source_name_part}}\" in each output file.\n" |
153 "\n" | 169 "\n" |
154 " If your script takes additional data as input, such as a shared\n" | 170 " If your script takes additional data as input, such as a shared\n" |
155 " configuration file or a Python module it uses, those files should be\n" | 171 " configuration file or a Python module it uses, those files should be\n" |
156 " listed in the \"source_prereqs\" variable. These files are treated as\n" | 172 " listed in the \"source_prereqs\" variable. These files are treated as\n" |
157 " dependencies of each script invocation.\n" | 173 " dependencies of each script invocation.\n" |
158 "\n" | 174 "\n" |
| 175 ACTION_DEPS |
| 176 "\n" |
| 177 "Outputs\n" |
| 178 "\n" |
159 SCRIPT_EXECUTION_CONTEXT | 179 SCRIPT_EXECUTION_CONTEXT |
160 "\n" | 180 "\n" |
161 "File name handling\n" | 181 "File name handling\n" |
162 "\n" | 182 "\n" |
163 SCRIPT_EXECUTION_OUTPUTS | 183 SCRIPT_EXECUTION_OUTPUTS |
164 "\n" | 184 "\n" |
165 "Variables\n" | 185 "Variables\n" |
166 "\n" | 186 "\n" |
167 " args, data, datadeps, depfile, deps, outputs*, script*,\n" | 187 " args, data, datadeps, depfile, deps, outputs*, script*,\n" |
168 " source_prereqs, sources*\n" | 188 " source_prereqs, sources*\n" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 Value RunTest(Scope* scope, | 530 Value RunTest(Scope* scope, |
511 const FunctionCallNode* function, | 531 const FunctionCallNode* function, |
512 const std::vector<Value>& args, | 532 const std::vector<Value>& args, |
513 BlockNode* block, | 533 BlockNode* block, |
514 Err* err) { | 534 Err* err) { |
515 return ExecuteGenericTarget(functions::kExecutable, scope, function, args, | 535 return ExecuteGenericTarget(functions::kExecutable, scope, function, args, |
516 block, err); | 536 block, err); |
517 } | 537 } |
518 | 538 |
519 } // namespace functions | 539 } // namespace functions |
OLD | NEW |