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

Side by Side Diff: tools/gn/command_args.cc

Issue 137713007: Check for GN args using the union of all rather than individually. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/args.cc ('k') | tools/gn/command_gyp.cc » ('j') | 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 <map> 5 #include <map>
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "tools/gn/commands.h" 9 #include "tools/gn/commands.h"
10 #include "tools/gn/input_file.h" 10 #include "tools/gn/input_file.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 "\n" 116 "\n"
117 " If \"arg name\" is specified, only the information for that argument\n" 117 " If \"arg name\" is specified, only the information for that argument\n"
118 " will be displayed. Otherwise all arguments will be displayed.\n"; 118 " will be displayed. Otherwise all arguments will be displayed.\n";
119 119
120 int RunArgs(const std::vector<std::string>& args) { 120 int RunArgs(const std::vector<std::string>& args) {
121 Setup* setup = new Setup; 121 Setup* setup = new Setup;
122 setup->set_check_for_bad_items(false); 122 setup->set_check_for_bad_items(false);
123 if (!setup->DoSetup() || !setup->Run()) 123 if (!setup->DoSetup() || !setup->Run())
124 return 1; 124 return 1;
125 125
126 const Scope::KeyValueMap& build_args = 126 Scope::KeyValueMap build_args;
127 setup->build_settings().build_args().declared_arguments(); 127 setup->build_settings().build_args().MergeDeclaredArguments(&build_args);
128 128
129 if (args.size() == 1) { 129 if (args.size() == 1) {
130 // Get help on a specific command. 130 // Get help on a specific command.
131 Scope::KeyValueMap::const_iterator found_arg = build_args.find(args[0]); 131 Scope::KeyValueMap::const_iterator found_arg = build_args.find(args[0]);
132 if (found_arg == build_args.end()) { 132 if (found_arg == build_args.end()) {
133 Err(Location(), "Unknown build argument.", 133 Err(Location(), "Unknown build argument.",
134 "You asked for \"" + args[0] + "\" which I didn't find in any " 134 "You asked for \"" + args[0] + "\" which I didn't find in any "
135 "buildfile\nassociated with this build."); 135 "buildfile\nassociated with this build.");
136 return 1; 136 return 1;
137 } 137 }
(...skipping 15 matching lines...) Expand all
153 for (std::map<base::StringPiece, Value>::iterator i = sorted_args.begin(); 153 for (std::map<base::StringPiece, Value>::iterator i = sorted_args.begin();
154 i != sorted_args.end(); ++i) { 154 i != sorted_args.end(); ++i) {
155 PrintArgHelp(i->first, i->second); 155 PrintArgHelp(i->first, i->second);
156 OutputString("\n"); 156 OutputString("\n");
157 } 157 }
158 158
159 return 0; 159 return 0;
160 } 160 }
161 161
162 } // namespace commands 162 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/args.cc ('k') | tools/gn/command_gyp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698