| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/commands.h" | 5 #include "tools/gn/commands.h" |
| 6 #include "tools/gn/setup.h" | 6 #include "tools/gn/setup.h" |
| 7 #include "tools/gn/standard_out.h" | 7 #include "tools/gn/standard_out.h" |
| 8 | 8 |
| 9 namespace commands { | 9 namespace commands { |
| 10 | 10 |
| 11 const char kCheck[] = "check"; | 11 const char kCheck[] = "check"; |
| 12 const char kCheck_HelpShort[] = | 12 const char kCheck_HelpShort[] = |
| 13 "check: Check header dependencies."; | 13 "check: Check header dependencies."; |
| 14 const char kCheck_Help[] = | 14 const char kCheck_Help[] = |
| 15 "gn check: Check header dependencies.\n" | 15 "gn check: Check header dependencies.\n" |
| 16 "\n" | 16 "\n" |
| 17 " \"gn check\" is the same thing as \"gn gen\" with the \"--check\" flag\n" | 17 " \"gn check\" is the same thing as \"gn gen\" with the \"--check\" flag\n" |
| 18 " except that this command does not write out any build files. It's\n" | 18 " except that this command does not write out any build files. It's\n" |
| 19 " intended to be an easy way to manually trigger include file checking.\n" | 19 " intended to be an easy way to manually trigger include file checking.\n" |
| 20 "\n" | 20 "\n" |
| 21 " See \"gn help\" for the common command-line switches.\n"; | 21 " See \"gn help\" for the common command-line switches.\n"; |
| 22 | 22 |
| 23 // Note: partially duplicated in command_gyp.cc. | |
| 24 int RunCheck(const std::vector<std::string>& args) { | 23 int RunCheck(const std::vector<std::string>& args) { |
| 25 // Deliberately leaked to avoid expensive process teardown. | 24 // Deliberately leaked to avoid expensive process teardown. |
| 26 Setup* setup = new Setup(); | 25 Setup* setup = new Setup(); |
| 27 // TODO(brettw) bug 343726: Use a temporary directory instead of this | 26 // TODO(brettw) bug 343726: Use a temporary directory instead of this |
| 28 // default one to avoid messing up any build that's in there. | 27 // default one to avoid messing up any build that's in there. |
| 29 if (!setup->DoSetup("//out/Default")) | 28 if (!setup->DoSetup("//out/Default")) |
| 30 return 1; | 29 return 1; |
| 31 setup->set_check_public_headers(true); | 30 setup->set_check_public_headers(true); |
| 32 | 31 |
| 33 if (!setup->Run()) | 32 if (!setup->Run()) |
| 34 return 1; | 33 return 1; |
| 35 | 34 |
| 36 OutputString("Header dependency check OK\n", DECORATION_GREEN); | 35 OutputString("Header dependency check OK\n", DECORATION_GREEN); |
| 37 return 0; | 36 return 0; |
| 38 } | 37 } |
| 39 | 38 |
| 40 } // namespace commands | 39 } // namespace commands |
| OLD | NEW |