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

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

Issue 819223002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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
« no previous file with comments | « tools/gn/command_desc.cc ('k') | tools/gn/command_help.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 "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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 "I expected something more like \"gn gen out/foo\"\n" 71 "I expected something more like \"gn gen out/foo\"\n"
72 "You can also see \"gn help gen\".").PrintToStdout(); 72 "You can also see \"gn help gen\".").PrintToStdout();
73 return 1; 73 return 1;
74 } 74 }
75 75
76 // Deliberately leaked to avoid expensive process teardown. 76 // Deliberately leaked to avoid expensive process teardown.
77 Setup* setup = new Setup(); 77 Setup* setup = new Setup();
78 if (!setup->DoSetup(args[0], true)) 78 if (!setup->DoSetup(args[0], true))
79 return 1; 79 return 1;
80 80
81 if (CommandLine::ForCurrentProcess()->HasSwitch(kSwitchCheck)) 81 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchCheck))
82 setup->set_check_public_headers(true); 82 setup->set_check_public_headers(true);
83 83
84 // Cause the load to also generate the ninja files for each target. We wrap 84 // Cause the load to also generate the ninja files for each target. We wrap
85 // the writing to maintain a counter. 85 // the writing to maintain a counter.
86 base::subtle::Atomic32 write_counter = 0; 86 base::subtle::Atomic32 write_counter = 0;
87 setup->builder()->set_resolved_callback( 87 setup->builder()->set_resolved_callback(
88 base::Bind(&ItemResolvedCallback, &write_counter, 88 base::Bind(&ItemResolvedCallback, &write_counter,
89 scoped_refptr<Builder>(setup->builder()))); 89 scoped_refptr<Builder>(setup->builder())));
90 90
91 // Do the actual load. This will also write out the target ninja files. 91 // Do the actual load. This will also write out the target ninja files.
92 if (!setup->Run()) 92 if (!setup->Run())
93 return 1; 93 return 1;
94 94
95 Err err; 95 Err err;
96 // Write the root ninja files. 96 // Write the root ninja files.
97 if (!NinjaWriter::RunAndWriteFiles(&setup->build_settings(), 97 if (!NinjaWriter::RunAndWriteFiles(&setup->build_settings(),
98 setup->builder(), 98 setup->builder(),
99 &err)) { 99 &err)) {
100 err.PrintToStdout(); 100 err.PrintToStdout();
101 return 1; 101 return 1;
102 } 102 }
103 103
104 base::TimeDelta elapsed_time = timer.Elapsed(); 104 base::TimeDelta elapsed_time = timer.Elapsed();
105 105
106 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kQuiet)) { 106 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kQuiet)) {
107 OutputString("Done. ", DECORATION_GREEN); 107 OutputString("Done. ", DECORATION_GREEN);
108 108
109 std::string stats = "Wrote " + 109 std::string stats = "Wrote " +
110 base::IntToString(static_cast<int>(write_counter)) + 110 base::IntToString(static_cast<int>(write_counter)) +
111 " targets from " + 111 " targets from " +
112 base::IntToString( 112 base::IntToString(
113 setup->scheduler().input_file_manager()->GetInputFileCount()) + 113 setup->scheduler().input_file_manager()->GetInputFileCount()) +
114 " files in " + 114 " files in " +
115 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; 115 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n";
116 OutputString(stats); 116 OutputString(stats);
117 } 117 }
118 118
119 return 0; 119 return 0;
120 } 120 }
121 121
122 } // namespace commands 122 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/command_desc.cc ('k') | tools/gn/command_help.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698