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

Unified Diff: tools/gn/variables.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/variables.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/variables.cc
diff --git a/tools/gn/variables.cc b/tools/gn/variables.cc
index d4e978d334a6e195d89583cee94ccab79609a0f6..5a9b8404ce88f0cf761733f006ba6c5623d9a21d 100644
--- a/tools/gn/variables.cc
+++ b/tools/gn/variables.cc
@@ -1164,6 +1164,45 @@ const char kPublicDeps_Help[] =
" public_deps = [ \":c\" ]\n"
" }\n";
+const char kResponseFileContents[] = "response_file_contents";
+const char kResponseFileContents_HelpShort[] =
+ "response_file_contents: [string list] Contents of .rsp file for actions.";
+const char kResponseFileContents_Help[] =
+ "response_file_contents: Contents of a response file for actions.\n"
+ "\n"
+ " Sometimes the arguments passed to a script can be too long for the\n"
+ " system's command-line capabilities. This is especially the case on\n"
+ " Windows where the maximum command-line length is less than 8K. A\n"
+ " response file allows you to pass an unlimited amount of data to a\n"
+ " script in a temporary file for an action or action_foreach target.\n"
+ "\n"
+ " If the response_file_contents variable is defined and non-empty, the\n"
+ " list will be treated as script args (including possibly substitution\n"
+ " patterns) that will be written to a temporary file at build time.\n"
+ " The name of the temporary file will be substituted for\n"
+ " \"{{response_file_name}}\" in the script args.\n"
+ "\n"
+ " The response file contents will always be quoted and escaped\n"
+ " according to Unix shell rules. To parse the response file, the Python\n"
+ " script should use \"shlex.split(file_contents)\".\n"
+ "\n"
+ "Example\n"
+ "\n"
+ " action(\"process_lots_of_files\") {\n"
+ " script = \"process.py\",\n"
+ " inputs = [ ... huge list of files ... ]\n"
+ "\n"
+ " # Write all the inputs to a response file for the script. Also,\n"
+ " # make the paths relative to the script working directory.\n"
+ " response_file_contents = rebase_path(inputs, root_build_dir)\n"
+ "\n"
+ " # The script expects the name of the response file in --file-list.\n"
+ " args = [\n"
+ " \"--enable-foo\",\n"
+ " \"--file-list={{response_file_name}}\",\n"
+ " ]\n"
+ " }\n";
+
const char kScript[] = "script";
const char kScript_HelpShort[] =
"script: [file name] Script file for actions.";
@@ -1358,6 +1397,7 @@ const VariableInfoMap& GetTargetVariables() {
INSERT_VARIABLE(Public)
INSERT_VARIABLE(PublicConfigs)
INSERT_VARIABLE(PublicDeps)
+ INSERT_VARIABLE(ResponseFileContents)
INSERT_VARIABLE(Script)
INSERT_VARIABLE(Sources)
INSERT_VARIABLE(Testonly)
« no previous file with comments | « tools/gn/variables.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698