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) |