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 "base/atomicops.h" | 5 #include "base/atomicops.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/timer/elapsed_timer.h" | 9 #include "base/timer/elapsed_timer.h" |
10 #include "tools/gn/build_settings.h" | 10 #include "tools/gn/build_settings.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 " Generates ninja files from the current tree and puts them in the given\n" | 82 " Generates ninja files from the current tree and puts them in the given\n" |
83 " output directory.\n" | 83 " output directory.\n" |
84 "\n" | 84 "\n" |
85 " The output directory can be a source-repo-absolute path name such as:\n" | 85 " The output directory can be a source-repo-absolute path name such as:\n" |
86 " //out/foo\n" | 86 " //out/foo\n" |
87 " Or it can be a directory relative to the current directory such as:\n" | 87 " Or it can be a directory relative to the current directory such as:\n" |
88 " out/foo\n" | 88 " out/foo\n" |
89 "\n" | 89 "\n" |
90 " See \"gn help\" for the common command-line switches.\n"; | 90 " See \"gn help\" for the common command-line switches.\n"; |
91 | 91 |
92 // Note: partially duplicated in command_gyp.cc. | |
93 int RunGen(const std::vector<std::string>& args) { | 92 int RunGen(const std::vector<std::string>& args) { |
94 base::ElapsedTimer timer; | |
95 | |
96 if (args.size() != 1) { | 93 if (args.size() != 1) { |
97 Err(Location(), "Need exactly one build directory to generate.", | 94 Err(Location(), "Need exactly one build directory to generate.", |
98 "I expected something more like \"gn gen out/foo\"\n" | 95 "I expected something more like \"gn gen out/foo\"\n" |
99 "You can also see \"gn help gen\".").PrintToStdout(); | 96 "You can also see \"gn help gen\".").PrintToStdout(); |
100 return 1; | 97 return 1; |
101 } | 98 } |
102 | 99 |
100 base::ElapsedTimer timer; | |
scottmg
2014/05/21 20:34:42
i think probably leave this where it was?
tfarina
2014/05/21 20:39:44
OK. Done.
| |
101 | |
103 // Deliberately leaked to avoid expensive process teardown. | 102 // Deliberately leaked to avoid expensive process teardown. |
104 Setup* setup = new Setup(); | 103 Setup* setup = new Setup(); |
105 if (!setup->DoSetup(args[0])) | 104 if (!setup->DoSetup(args[0])) |
106 return 1; | 105 return 1; |
107 | 106 |
108 if (CommandLine::ForCurrentProcess()->HasSwitch(kSwitchCheck)) | 107 if (CommandLine::ForCurrentProcess()->HasSwitch(kSwitchCheck)) |
109 setup->set_check_public_headers(true); | 108 setup->set_check_public_headers(true); |
110 | 109 |
111 // Cause the load to also generate the ninja files for each target. We wrap | 110 // Cause the load to also generate the ninja files for each target. We wrap |
112 // the writing to maintain a counter. | 111 // the writing to maintain a counter. |
(...skipping 23 matching lines...) Expand all Loading... | |
136 setup->scheduler().input_file_manager()->GetInputFileCount()) + | 135 setup->scheduler().input_file_manager()->GetInputFileCount()) + |
137 " files in " + | 136 " files in " + |
138 base::IntToString(elapsed_time.InMilliseconds()) + "ms\n"; | 137 base::IntToString(elapsed_time.InMilliseconds()) + "ms\n"; |
139 OutputString(stats); | 138 OutputString(stats); |
140 } | 139 } |
141 | 140 |
142 return 0; | 141 return 0; |
143 } | 142 } |
144 | 143 |
145 } // namespace commands | 144 } // namespace commands |
OLD | NEW |