Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: tools/gn/functions_target.cc

Issue 1430043002: Support script response files in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment, random build fix Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/function_write_file.cc ('k') | tools/gn/ninja_action_target_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 " handling. If you want to pass the sources to your script, you must do\n" 101 " handling. If you want to pass the sources to your script, you must do\n"
102 " so explicitly by including them in the \"args\". Note also that this\n" 102 " so explicitly by including them in the \"args\". Note also that this\n"
103 " means there is no special handling of paths since GN doesn't know\n" 103 " means there is no special handling of paths since GN doesn't know\n"
104 " which of the args are paths and not. You will want to use\n" 104 " which of the args are paths and not. You will want to use\n"
105 " rebase_path() to convert paths to be relative to the root_build_dir.\n" 105 " rebase_path() to convert paths to be relative to the root_build_dir.\n"
106 "\n" 106 "\n"
107 " You can dynamically write input dependencies (for incremental rebuilds\n" 107 " You can dynamically write input dependencies (for incremental rebuilds\n"
108 " if an input file changes) by writing a depfile when the script is run\n" 108 " if an input file changes) by writing a depfile when the script is run\n"
109 " (see \"gn help depfile\"). This is more flexible than \"inputs\".\n" 109 " (see \"gn help depfile\"). This is more flexible than \"inputs\".\n"
110 "\n" 110 "\n"
111 " If the command line length is very long, you can use response files\n"
112 " to pass args to your script. See \"gn help response_file_contents\".\n"
113 "\n"
111 " It is recommended you put inputs to your script in the \"sources\"\n" 114 " It is recommended you put inputs to your script in the \"sources\"\n"
112 " variable, and stuff like other Python files required to run your\n" 115 " variable, and stuff like other Python files required to run your\n"
113 " script in the \"inputs\" variable.\n" 116 " script in the \"inputs\" variable.\n"
114 "\n" 117 "\n"
115 ACTION_DEPS 118 ACTION_DEPS
116 "\n" 119 "\n"
117 "Outputs\n" 120 "Outputs\n"
118 "\n" 121 "\n"
119 " You should specify files created by your script by specifying them in\n" 122 " You should specify files created by your script by specifying them in\n"
120 " the \"outputs\".\n" 123 " the \"outputs\".\n"
121 "\n" 124 "\n"
122 SCRIPT_EXECUTION_CONTEXT 125 SCRIPT_EXECUTION_CONTEXT
123 "\n" 126 "\n"
124 "File name handling\n" 127 "File name handling\n"
125 "\n" 128 "\n"
126 SCRIPT_EXECUTION_OUTPUTS 129 SCRIPT_EXECUTION_OUTPUTS
127 "\n" 130 "\n"
128 "Variables\n" 131 "Variables\n"
129 "\n" 132 "\n"
130 " args, console, data, data_deps, depfile, deps, outputs*, script*,\n" 133 " args, console, data, data_deps, depfile, deps, inputs, outputs*,\n"
131 " inputs, sources\n" 134 " response_file_contents, script*, sources\n"
132 " * = required\n" 135 " * = required\n"
133 "\n" 136 "\n"
134 "Example\n" 137 "Example\n"
135 "\n" 138 "\n"
136 " action(\"run_this_guy_once\") {\n" 139 " action(\"run_this_guy_once\") {\n"
137 " script = \"doprocessing.py\"\n" 140 " script = \"doprocessing.py\"\n"
138 " sources = [ \"my_configuration.txt\" ]\n" 141 " sources = [ \"my_configuration.txt\" ]\n"
139 " outputs = [ \"$target_gen_dir/insightful_output.txt\" ]\n" 142 " outputs = [ \"$target_gen_dir/insightful_output.txt\" ]\n"
140 "\n" 143 "\n"
141 " # Our script imports this Python file so we want to rebuild if it\n" 144 " # Our script imports this Python file so we want to rebuild if it\n"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 " \"outputs\" variable should specify one or more files with a source\n" 178 " \"outputs\" variable should specify one or more files with a source\n"
176 " expansion pattern in it (see \"gn help source_expansion\"). The output\n" 179 " expansion pattern in it (see \"gn help source_expansion\"). The output\n"
177 " file(s) for each script invocation should be unique. Normally you\n" 180 " file(s) for each script invocation should be unique. Normally you\n"
178 " use \"{{source_name_part}}\" in each output file.\n" 181 " use \"{{source_name_part}}\" in each output file.\n"
179 "\n" 182 "\n"
180 " If your script takes additional data as input, such as a shared\n" 183 " If your script takes additional data as input, such as a shared\n"
181 " configuration file or a Python module it uses, those files should be\n" 184 " configuration file or a Python module it uses, those files should be\n"
182 " listed in the \"inputs\" variable. These files are treated as\n" 185 " listed in the \"inputs\" variable. These files are treated as\n"
183 " dependencies of each script invocation.\n" 186 " dependencies of each script invocation.\n"
184 "\n" 187 "\n"
188 " If the command line length is very long, you can use response files\n"
189 " to pass args to your script. See \"gn help response_file_contents\".\n"
190 "\n"
185 " You can dynamically write input dependencies (for incremental rebuilds\n" 191 " You can dynamically write input dependencies (for incremental rebuilds\n"
186 " if an input file changes) by writing a depfile when the script is run\n" 192 " if an input file changes) by writing a depfile when the script is run\n"
187 " (see \"gn help depfile\"). This is more flexible than \"inputs\".\n" 193 " (see \"gn help depfile\"). This is more flexible than \"inputs\".\n"
188 "\n" 194 "\n"
189 ACTION_DEPS 195 ACTION_DEPS
190 "\n" 196 "\n"
191 "Outputs\n" 197 "Outputs\n"
192 "\n" 198 "\n"
193 SCRIPT_EXECUTION_CONTEXT 199 SCRIPT_EXECUTION_CONTEXT
194 "\n" 200 "\n"
195 "File name handling\n" 201 "File name handling\n"
196 "\n" 202 "\n"
197 SCRIPT_EXECUTION_OUTPUTS 203 SCRIPT_EXECUTION_OUTPUTS
198 "\n" 204 "\n"
199 "Variables\n" 205 "Variables\n"
200 "\n" 206 "\n"
201 " args, console, data, data_deps, depfile, deps, outputs*, script*,\n" 207 " args, console, data, data_deps, depfile, deps, inputs, outputs*,\n"
202 " inputs, sources*\n" 208 " response_file_contents, script*, sources*\n"
203 " * = required\n" 209 " * = required\n"
204 "\n" 210 "\n"
205 "Example\n" 211 "Example\n"
206 "\n" 212 "\n"
207 " # Runs the script over each IDL file. The IDL script will generate\n" 213 " # Runs the script over each IDL file. The IDL script will generate\n"
208 " # both a .cc and a .h file for each input.\n" 214 " # both a .cc and a .h file for each input.\n"
209 " action_foreach(\"my_idl\") {\n" 215 " action_foreach(\"my_idl\") {\n"
210 " script = \"idl_processor.py\"\n" 216 " script = \"idl_processor.py\"\n"
211 " sources = [ \"foo.idl\", \"bar.idl\" ]\n" 217 " sources = [ \"foo.idl\", \"bar.idl\" ]\n"
212 "\n" 218 "\n"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 const Template* templ = scope->GetTemplate(target_type); 557 const Template* templ = scope->GetTemplate(target_type);
552 if (templ) 558 if (templ)
553 return templ->Invoke(scope, function, sub_args, block, err); 559 return templ->Invoke(scope, function, sub_args, block, err);
554 560
555 // Otherwise, assume the target is a built-in target type. 561 // Otherwise, assume the target is a built-in target type.
556 return ExecuteGenericTarget(target_type.c_str(), scope, function, sub_args, 562 return ExecuteGenericTarget(target_type.c_str(), scope, function, sub_args,
557 block, err); 563 block, err);
558 } 564 }
559 565
560 } // namespace functions 566 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/function_write_file.cc ('k') | tools/gn/ninja_action_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698