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

Unified Diff: tools/gn/command_args.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
Index: tools/gn/command_args.cc
diff --git a/tools/gn/command_args.cc b/tools/gn/command_args.cc
index 1b81135be3d9ff23e632380568d956c8ec4661b5..9ff28cedb1c3994939a3e92dc218a671604237f5 100644
--- a/tools/gn/command_args.cc
+++ b/tools/gn/command_args.cc
@@ -243,12 +243,27 @@ int EditArgsFile(const std::string& build_dir) {
setup.build_settings().GetFullPath(setup.GetBuildArgFile())
.NormalizePathSeparators();
if (!base::PathExists(arg_file)) {
- std::string argfile_default_contents =
- "# Build arguments go here. Examples:\n"
- "# is_component_build = true\n"
- "# is_debug = false\n"
- "# See \"gn args <out_dir> --list\" for available build "
- "arguments.\n";
+ BuildSettings build_settings = setup.build_settings();
+ base::FilePath arg_file_template_path =
+ build_settings.GetFullPath(build_settings.arg_file_template_path())
brettw 2016/11/22 16:14:32 Indent more.
Dirk Pranke 2016/11/22 18:41:52 Done.
+ .NormalizePathSeparators();
+
+ std::string argfile_default_contents;
+ if (!build_settings.arg_file_template_path().is_null()) {
+ base::FilePath arg_file_path_template_path =
+ build_settings.GetFullPath(build_settings.arg_file_template_path());
brettw 2016/11/22 16:14:32 Indent mode (maybe this will have to wrap, sadly).
Dirk Pranke 2016/11/22 18:41:52 Reworked to be shorter.
+ if (!base::ReadFileToString(arg_file_template_path,
+ &argfile_default_contents)) {
+ return 1;
Dirk Pranke 2016/11/22 04:27:39 Should I print an err to stdout here if this read
brettw 2016/11/22 16:14:32 No, but I would prefer if it fell through to the d
Dirk Pranke 2016/11/22 18:41:52 Done. I'm not sure if I'm wild about that, but it'
+ }
+ } else {
+ argfile_default_contents =
+ "# Build arguments go here. Examples:\n"
+ "# is_component_build = true\n"
+ "# is_debug = false\n"
brettw 2016/11/22 16:14:32 Can you remove the examples in this case?
Dirk Pranke 2016/11/22 18:41:52 Done.
+ "# See \"gn args <out_dir> --list\" for available build "
+ "arguments.\n";
+ }
#if defined(OS_WIN)
// Use Windows lineendings for this file since it will often open in
// Notepad which can't handle Unix ones.

Powered by Google App Engine
This is Rietveld 408576698