OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |