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

Unified Diff: tools/gn/setup.cc

Issue 2514333005: Add support for customizing GN's args text. (Closed)
Patch Set: Created 4 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
« tools/gn/command_args.cc ('K') | « tools/gn/docs/reference.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/setup.cc
diff --git a/tools/gn/setup.cc b/tools/gn/setup.cc
index 8a433bcdbb1cacf67fd0e96bdbaf5f5bee9dc360..436f82e09ac233304f2809baccd59620aac2791b 100644
--- a/tools/gn/setup.cc
+++ b/tools/gn/setup.cc
@@ -106,6 +106,10 @@ Variables
The secondary source root must be inside the main source tree.
+ arg_file_template [optional]
brettw 2016/11/22 16:14:32 These parameters are alphabetical. Can you put thi
Dirk Pranke 2016/11/22 18:41:52 Done. I thought I checked for that but clearly mis
+ Label of a file that contains the text that should be used as the
brettw 2016/11/22 16:14:32 Label -> File name (labels are used for targets no
Dirk Pranke 2016/11/22 18:41:52 Changed "Label" to "Path to", instead, and fixed b
+ default args.gn file when you run `gn args`.
+
Example .gn file contents
buildconfig = "//build/config/BUILDCONFIG.gn"
@@ -738,5 +742,22 @@ bool Setup::FillOtherConfig(const base::CommandLine& cmdline) {
build_settings_.set_exec_script_whitelist(std::move(whitelist));
}
+ const Value* arg_file_template_value =
+ dotfile_scope_.GetValue("arg_file_template", true);
brettw 2016/11/22 16:14:32 Indent more.
Dirk Pranke 2016/11/22 18:41:52 Done.
+ if (arg_file_template_value) {
+ if (!arg_file_template_value->VerifyTypeIs(Value::STRING, &err)) {
+ err.PrintToStdout();
+ return false;
+ }
+ SourceFile path(arg_file_template_value->string_value());
+ if (!base::PathExists(path.Resolve(build_settings_.root_path()))) {
brettw 2016/11/22 16:14:32 I don't think we should be doing filesystem operat
Dirk Pranke 2016/11/22 18:41:52 Okay. I moved the error handling code.
+ err = Err(Location(), arg_file_template_value->string_value() +
+ std::string(" does not exist."));
+ err.PrintToStdout();
+ return false;
+ }
+ build_settings_.set_arg_file_template_path(path);
+ }
+
return true;
}
« tools/gn/command_args.cc ('K') | « tools/gn/docs/reference.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698