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

Unified Diff: tools/gn/gn_main.cc

Issue 46003002: Add a target in GN that generates a last_change.h file for the SVN revision. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 7 years, 1 month 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/command_help.cc ('k') | tools/gn/secondary/build/config/compiler/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/gn_main.cc
diff --git a/tools/gn/gn_main.cc b/tools/gn/gn_main.cc
index 9c86ab5f01468947a8e958183ed35de5d507e6ec..bfd501064cf05c6ee82744b07c46aa7c7d2f2fcd 100644
--- a/tools/gn/gn_main.cc
+++ b/tools/gn/gn_main.cc
@@ -8,6 +8,15 @@
#include "tools/gn/commands.h"
#include "tools/gn/err.h"
#include "tools/gn/location.h"
+#include "tools/gn/standard_out.h"
+
+// Only the GN-generated build makes this header for now.
+// TODO(brettw) consider adding this if we need it in GYP.
+#if defined(GN_BUILD)
+#include "build/util/last_change.h"
+#else
+#define LAST_CHANGE "UNKNOWN"
+#endif
namespace {
@@ -39,6 +48,10 @@ int main(int argc, char** argv) {
if (cmdline.HasSwitch("help")) {
// Make "--help" default to help command.
command = commands::kHelp;
+ } else if (cmdline.HasSwitch("version")) {
+ // Make "--version" print the version and exit.
+ OutputString(std::string(LAST_CHANGE) + "\n");
+ exit(0);
} else if (args.empty()) {
command = commands::kGen;
} else {
« no previous file with comments | « tools/gn/command_help.cc ('k') | tools/gn/secondary/build/config/compiler/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698