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

Unified Diff: tools/gn/setup.cc

Issue 216903004: Add optional public header checking to GN build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unit test Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/setup.h ('k') | tools/gn/target.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/setup.cc
diff --git a/tools/gn/setup.cc b/tools/gn/setup.cc
index e2e17faa244c707bf3751b121ce2a33cbbc41df1..da6f88c81732448e2944a4bbc48a9dbf1d08c23c 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"
@@ -138,7 +139,8 @@ CommonSetup::CommonSetup()
builder_(new Builder(loader_.get())),
root_build_file_("//BUILD.gn"),
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));
}
@@ -148,7 +150,8 @@ CommonSetup::CommonSetup(const CommonSetup& other)
builder_(new Builder(loader_.get())),
root_build_file_(other.root_build_file_),
check_for_bad_items_(other.check_for_bad_items_),
- check_for_unused_overrides_(other.check_for_unused_overrides_) {
+ check_for_unused_overrides_(other.check_for_unused_overrides_),
+ check_public_headers_(other.check_public_headers_) {
loader_->set_complete_callback(base::Bind(&DecrementWorkCount));
}
@@ -181,6 +184,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))
« no previous file with comments | « tools/gn/setup.h ('k') | tools/gn/target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698