Index: tools/gn/setup.cc |
diff --git a/tools/gn/setup.cc b/tools/gn/setup.cc |
index 728a8eba38bd2df73ae67a30071838c07d9f8a10..343ad8ab8428957f82b3f7b3042f3191a7715df8 100644 |
--- a/tools/gn/setup.cc |
+++ b/tools/gn/setup.cc |
@@ -18,6 +18,7 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "build/build_config.h" |
#include "tools/gn/filesystem_utils.h" |
+#include "tools/gn/header_checker.h" |
#include "tools/gn/input_file.h" |
#include "tools/gn/parse_tree.h" |
#include "tools/gn/parser.h" |
@@ -123,7 +124,8 @@ CommonSetup::CommonSetup() |
loader_(new LoaderImpl(&build_settings_)), |
builder_(new Builder(loader_.get())), |
check_for_bad_items_(true), |
- check_for_unused_overrides_(true) { |
+ check_for_unused_overrides_(true), |
+ check_public_headers_(false) { |
loader_->set_complete_callback(base::Bind(&DecrementWorkCount)); |
} |
@@ -165,6 +167,22 @@ bool CommonSetup::RunPostMessageLoop() { |
} |
} |
+ if (check_public_headers_) { |
+ std::vector<const Target*> targets = builder_->GetAllResolvedTargets(); |
+ scoped_refptr<HeaderChecker> header_checker( |
+ new HeaderChecker(&build_settings_, targets)); |
+ |
+ std::vector<Err> header_errors; |
+ header_checker->Run(&header_errors); |
+ for (size_t i = 0; i < header_errors.size(); i++) { |
+ if (i > 0) |
+ OutputString("___________________\n", DECORATION_YELLOW); |
+ header_errors[i].PrintToStdout(); |
+ } |
+ if (!header_errors.empty()) |
+ return false; |
+ } |
+ |
// Write out tracing and timing if requested. |
const CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
if (cmdline->HasSwitch(kTimeSwitch)) |