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

Unified Diff: tools/gn/command_check.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/c_include_iterator_unittest.cc ('k') | tools/gn/command_gen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_check.cc
diff --git a/tools/gn/command_check.cc b/tools/gn/command_check.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a84bdf3096e2f68ab29030d0b78de088269a6cb4
--- /dev/null
+++ b/tools/gn/command_check.cc
@@ -0,0 +1,40 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tools/gn/commands.h"
+#include "tools/gn/setup.h"
+#include "tools/gn/standard_out.h"
+
+namespace commands {
+
+const char kCheck[] = "check";
+const char kCheck_HelpShort[] =
+ "check: Check header dependencies.";
+const char kCheck_Help[] =
+ "gn check: Check header dependencies.\n"
+ "\n"
+ " \"gn check\" is the same thing as \"gn gen\" with the \"--check\" flag\n"
+ " except that this command does not write out any build files. It's\n"
+ " intended to be an easy way to manually trigger include file checking.\n"
+ "\n"
+ " See \"gn help\" for the common command-line switches.\n";
+
+// Note: partially duplicated in command_gyp.cc.
+int RunCheck(const std::vector<std::string>& args) {
+ // Deliberately leaked to avoid expensive process teardown.
+ Setup* setup = new Setup();
+ // TODO(brettw) bug 343726: Use a temporary directory instead of this
+ // default one to avoid messing up any build that's in there.
+ if (!setup->DoSetup("//out/Default"))
+ return 1;
+ setup->set_check_public_headers(true);
+
+ if (!setup->Run())
+ return 1;
+
+ OutputString("Header dependency check OK\n", DECORATION_GREEN);
+ return 0;
+}
+
+} // namespace commands
« no previous file with comments | « tools/gn/c_include_iterator_unittest.cc ('k') | tools/gn/command_gen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698