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

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

Issue 21114002: Add initial prototype for the GN meta-buildsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add owners and readme Created 7 years, 4 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/gn.gyp ('k') | tools/gn/import_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/at_exit.h"
6 #include "base/command_line.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "tools/gn/commands.h"
9 #include "tools/gn/err.h"
10 #include "tools/gn/location.h"
11
12 namespace {
13
14 std::vector<std::string> GetArgs(const CommandLine& cmdline) {
15 CommandLine::StringVector in_args = cmdline.GetArgs();
16 #if defined(OS_WIN)
17 std::vector<std::string> out_args;
18 for (size_t i = 0; i < in_args.size(); i++)
19 out_args.push_back(base::WideToUTF8(in_args[i]));
20 return out_args;
21 #else
22 return in_args;
23 #endif
24 }
25
26 } // namespace
27
28 int main(int argc, char** argv) {
29 base::AtExitManager at_exit;
30 CommandLine::Init(argc, argv);
31
32 std::vector<std::string> args = GetArgs(*CommandLine::ForCurrentProcess());
33
34 std::string command;
35 if (args.empty()) {
36 command = "gen";
37 } else {
38 command = args[0];
39 args.erase(args.begin());
40 }
41
42 int retval = 0;
43 if (command == "gen") {
44 retval = RunGenCommand(args);
45 } else if (command == "desc" || command == "wtf") {
46 retval = RunDescCommand(args);
47 } else if (command == "deps") {
48 retval = RunDepsCommand(args);
49 } else if (command == "tree") {
50 retval = RunTreeCommand(args);
51 } else {
52 Err(Location(),
53 "Command \"" + command + "\" unknown.").PrintToStdout();
54 retval = 1;
55 }
56
57 exit(retval); // Don't free memory, it can be really slow!
58 return retval;
59 }
OLDNEW
« no previous file with comments | « tools/gn/gn.gyp ('k') | tools/gn/import_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698