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

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

Issue 165823003: GN: Change gen command syntax, support relative dirs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments fixes 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 | « base/files/file_path.h ('k') | tools/gn/command_gen.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 " --args=\"doom_melon_setting=5 component_build=1\"\n" 113 " --args=\"doom_melon_setting=5 component_build=1\"\n"
114 " or in a toolchain definition (see \"gn help buildargs\" for more on\n" 114 " or in a toolchain definition (see \"gn help buildargs\" for more on\n"
115 " how this all works).\n" 115 " how this all works).\n"
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 // TODO(brettw) bug 343726: Use a temporary directory instead of this
124 // default one to avoid messing up any build that's in there.
125 if (!setup->DoSetup("//out/Default/") || !setup->Run())
124 return 1; 126 return 1;
125 127
126 Scope::KeyValueMap build_args; 128 Scope::KeyValueMap build_args;
127 setup->build_settings().build_args().MergeDeclaredArguments(&build_args); 129 setup->build_settings().build_args().MergeDeclaredArguments(&build_args);
128 130
129 if (args.size() == 1) { 131 if (args.size() == 1) {
130 // Get help on a specific command. 132 // Get help on a specific command.
131 Scope::KeyValueMap::const_iterator found_arg = build_args.find(args[0]); 133 Scope::KeyValueMap::const_iterator found_arg = build_args.find(args[0]);
132 if (found_arg == build_args.end()) { 134 if (found_arg == build_args.end()) {
133 Err(Location(), "Unknown build argument.", 135 Err(Location(), "Unknown build argument.",
(...skipping 19 matching lines...) Expand all
153 for (std::map<base::StringPiece, Value>::iterator i = sorted_args.begin(); 155 for (std::map<base::StringPiece, Value>::iterator i = sorted_args.begin();
154 i != sorted_args.end(); ++i) { 156 i != sorted_args.end(); ++i) {
155 PrintArgHelp(i->first, i->second); 157 PrintArgHelp(i->first, i->second);
156 OutputString("\n"); 158 OutputString("\n");
157 } 159 }
158 160
159 return 0; 161 return 0;
160 } 162 }
161 163
162 } // namespace commands 164 } // namespace commands
OLDNEW
« no previous file with comments | « base/files/file_path.h ('k') | tools/gn/command_gen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698