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

Side by Side 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 unified diff | Download patch
« tools/gn/command_args.cc ('K') | « tools/gn/docs/reference.md ('k') | no next file » | 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/setup.h" 5 #include "tools/gn/setup.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <sstream> 9 #include <sstream>
10 #include <utility> 10 #include <utility>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 for a BUILD.gn file (or the build config file discussed above), the file 99 for a BUILD.gn file (or the build config file discussed above), the file
100 will first be looked for in the source root. If it's not found, the 100 will first be looked for in the source root. If it's not found, the
101 secondary source root will be checked (which would contain a parallel 101 secondary source root will be checked (which would contain a parallel
102 directory hierarchy). 102 directory hierarchy).
103 103
104 This behavior is intended to be used when BUILD.gn files can't be checked 104 This behavior is intended to be used when BUILD.gn files can't be checked
105 in to certain source directories for whatever reason. 105 in to certain source directories for whatever reason.
106 106
107 The secondary source root must be inside the main source tree. 107 The secondary source root must be inside the main source tree.
108 108
109 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
110 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
111 default args.gn file when you run `gn args`.
112
109 Example .gn file contents 113 Example .gn file contents
110 114
111 buildconfig = "//build/config/BUILDCONFIG.gn" 115 buildconfig = "//build/config/BUILDCONFIG.gn"
112 116
113 check_targets = [ 117 check_targets = [
114 "//doom_melon/*", # Check everything in this subtree. 118 "//doom_melon/*", # Check everything in this subtree.
115 "//tools:mind_controlling_ant", # Check this specific target. 119 "//tools:mind_controlling_ant", # Check this specific target.
116 ] 120 ]
117 121
118 root = "//:root" 122 root = "//:root"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 } 735 }
732 whitelist->insert(current_dir.ResolveRelativeFile(item, &err)); 736 whitelist->insert(current_dir.ResolveRelativeFile(item, &err));
733 if (err.has_error()) { 737 if (err.has_error()) {
734 err.PrintToStdout(); 738 err.PrintToStdout();
735 return false; 739 return false;
736 } 740 }
737 } 741 }
738 build_settings_.set_exec_script_whitelist(std::move(whitelist)); 742 build_settings_.set_exec_script_whitelist(std::move(whitelist));
739 } 743 }
740 744
745 const Value* arg_file_template_value =
746 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.
747 if (arg_file_template_value) {
748 if (!arg_file_template_value->VerifyTypeIs(Value::STRING, &err)) {
749 err.PrintToStdout();
750 return false;
751 }
752 SourceFile path(arg_file_template_value->string_value());
753 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.
754 err = Err(Location(), arg_file_template_value->string_value() +
755 std::string(" does not exist."));
756 err.PrintToStdout();
757 return false;
758 }
759 build_settings_.set_arg_file_template_path(path);
760 }
761
741 return true; 762 return true;
742 } 763 }
OLDNEW
« 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