[gnome-builder] build: track if we are building from git checkout



commit 0c9be7a0a2bfd164b9f3803085b83603f4c453f7
Author: Christian Hergert <chergert redhat com>
Date:   Thu Feb 16 16:29:14 2017 -0800

    build: track if we are building from git checkout
    
    If we are building from a git checkout, we want to get the commit id into
    the version string of the About Dialog. This helps us get more reliable
    information in bug tracking.

 configure.ac                                 |   13 +++++++++++++
 libide/application/ide-application-actions.c |    4 ++++
 plugins/support/ide-support.c                |    9 +++++++++
 3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 275fd20..489a3c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,18 @@ AC_SUBST(LIBIDE_VERSION)
 
 
 dnl ***********************************************************************
+dnl Check if we are building from a git checkout
+dnl ***********************************************************************
+building_from_git=no
+AS_IF([test -d "${srcdir}/.git"],[
+       building_from_git=yes
+       COMMIT_ID=`git describe --always | cut -f 2- -d -`
+       AC_DEFINE_UNQUOTED([COMMIT_ID], ["$COMMIT_ID"], [git commit suffix])
+       AC_SUBST(COMMIT_ID)
+])
+
+
+dnl ***********************************************************************
 dnl Initialize Automake
 dnl ***********************************************************************
 AM_SILENT_RULES([yes])
@@ -555,6 +567,7 @@ echo " ${PACKAGE} - ${VERSION}"
 echo ""
 echo " Options"
 echo ""
+echo "  Building from Git .................... : ${building_from_git}"
 echo "  Prefix ............................... : ${prefix}"
 echo "  Libdir ............................... : ${libdir}"
 echo "  Optimized Build ...................... : ${enable_optimizations}"
diff --git a/libide/application/ide-application-actions.c b/libide/application/ide-application-actions.c
index 6d1ccf7..d05f80b 100644
--- a/libide/application/ide-application-actions.c
+++ b/libide/application/ide-application-actions.c
@@ -122,7 +122,11 @@ ide_application_actions_about (GSimpleAction *action,
                          "program-name", _("GNOME Builder"),
                          "transient-for", parent,
                          "translator-credits", _("translator-credits"),
+#ifdef COMMIT_ID
+                         "version", PACKAGE_VERSION "+" COMMIT_ID,
+#else
                          "version", PACKAGE_VERSION,
+#endif
                          "website", "https://wiki.gnome.org/Apps/Builder";,
                          "website-label", _("Learn more about GNOME Builder"),
                          NULL);
diff --git a/plugins/support/ide-support.c b/plugins/support/ide-support.c
index 1b78c54..4f024c2 100644
--- a/plugins/support/ide-support.c
+++ b/plugins/support/ide-support.c
@@ -18,6 +18,8 @@
 
 #define G_LOG_DOMAIN "ide-support"
 
+#include "config.h"
+
 #include <egg-counter.h>
 #include <gtk/gtk.h>
 #include <ide.h>
@@ -59,6 +61,13 @@ ide_get_support_log (void)
 
   str = g_string_new (NULL);
 
+  g_string_append (str, "[runtime.version]\n");
+  g_string_append_printf (str, "version = \"%s\"\n", PACKAGE_VERSION);
+#ifdef COMMIT_ID
+  g_string_append_printf (str, "commit = \"%s\"\n", COMMIT_ID);
+#endif
+  g_string_append (str, "\n");
+
   /*
    * Log host information.
    */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]