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

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: Created 7 years, 2 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
Index: tools/gn/gn_main.cc
diff --git a/tools/gn/gn_main.cc b/tools/gn/gn_main.cc
index 9c86ab5f01468947a8e958183ed35de5d507e6ec..bd12918cac5a84909120f8d1e580873f4ed01ab4 100644
--- a/tools/gn/gn_main.cc
+++ b/tools/gn/gn_main.cc
@@ -8,6 +8,14 @@
#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.
viettrungluu 2013/11/06 18:39:22 Is this a TODO?
+#if defined(GN_BUILD)
+#include "build/util/last_change.h"
+#else
+#define LAST_CHANGE "UNKNOWN"
+#endif
namespace {
@@ -39,6 +47,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 {

Powered by Google App Engine
This is Rietveld 408576698