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 "tools/gn/setup.h" | 5 #include "tools/gn/setup.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <sstream> | 10 #include <sstream> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/process/launch.h" | 16 #include "base/process/launch.h" |
17 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "tools/gn/commands.h" |
21 #include "tools/gn/filesystem_utils.h" | 22 #include "tools/gn/filesystem_utils.h" |
22 #include "tools/gn/header_checker.h" | |
23 #include "tools/gn/input_file.h" | 23 #include "tools/gn/input_file.h" |
24 #include "tools/gn/parse_tree.h" | 24 #include "tools/gn/parse_tree.h" |
25 #include "tools/gn/parser.h" | 25 #include "tools/gn/parser.h" |
26 #include "tools/gn/source_dir.h" | 26 #include "tools/gn/source_dir.h" |
27 #include "tools/gn/source_file.h" | 27 #include "tools/gn/source_file.h" |
28 #include "tools/gn/standard_out.h" | 28 #include "tools/gn/standard_out.h" |
29 #include "tools/gn/tokenizer.h" | 29 #include "tools/gn/tokenizer.h" |
30 #include "tools/gn/trace.h" | 30 #include "tools/gn/trace.h" |
31 #include "tools/gn/value.h" | 31 #include "tools/gn/value.h" |
32 | 32 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (check_for_unused_overrides_) { | 181 if (check_for_unused_overrides_) { |
182 if (!build_settings_.build_args().VerifyAllOverridesUsed(&err)) { | 182 if (!build_settings_.build_args().VerifyAllOverridesUsed(&err)) { |
183 // TODO(brettw) implement a system of warnings. Until we have a better | 183 // TODO(brettw) implement a system of warnings. Until we have a better |
184 // system, print the error but don't return failure. | 184 // system, print the error but don't return failure. |
185 err.PrintToStdout(); | 185 err.PrintToStdout(); |
186 return true; | 186 return true; |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 if (check_public_headers_) { | 190 if (check_public_headers_) { |
191 std::vector<const Target*> targets = builder_->GetAllResolvedTargets(); | 191 if (!commands::CheckPublicHeaders(&build_settings_, |
192 scoped_refptr<HeaderChecker> header_checker( | 192 builder_->GetAllResolvedTargets(), |
193 new HeaderChecker(&build_settings_, targets)); | 193 std::vector<const Target*>())) { |
194 | 194 return false; |
195 std::vector<Err> header_errors; | |
196 header_checker->Run(&header_errors); | |
197 for (size_t i = 0; i < header_errors.size(); i++) { | |
198 if (i > 0) | |
199 OutputString("___________________\n", DECORATION_YELLOW); | |
200 header_errors[i].PrintToStdout(); | |
201 } | 195 } |
202 if (!header_errors.empty()) | |
203 return false; | |
204 } | 196 } |
205 | 197 |
206 // Write out tracing and timing if requested. | 198 // Write out tracing and timing if requested. |
207 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 199 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
208 if (cmdline->HasSwitch(kTimeSwitch)) | 200 if (cmdline->HasSwitch(kTimeSwitch)) |
209 PrintLongHelp(SummarizeTraces()); | 201 PrintLongHelp(SummarizeTraces()); |
210 if (cmdline->HasSwitch(kTracelogSwitch)) | 202 if (cmdline->HasSwitch(kTracelogSwitch)) |
211 SaveTraces(cmdline->GetSwitchValuePath(kTracelogSwitch)); | 203 SaveTraces(cmdline->GetSwitchValuePath(kTracelogSwitch)); |
212 | 204 |
213 return true; | 205 return true; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 } | 588 } |
597 | 589 |
598 void DependentSetup::RunPreMessageLoop() { | 590 void DependentSetup::RunPreMessageLoop() { |
599 CommonSetup::RunPreMessageLoop(); | 591 CommonSetup::RunPreMessageLoop(); |
600 } | 592 } |
601 | 593 |
602 bool DependentSetup::RunPostMessageLoop() { | 594 bool DependentSetup::RunPostMessageLoop() { |
603 return CommonSetup::RunPostMessageLoop(); | 595 return CommonSetup::RunPostMessageLoop(); |
604 } | 596 } |
605 | 597 |
OLD | NEW |