[polari/wip/fmuellner/ci-snapshots: 7/9] build: Include VCS tag in version



commit 56505cf8ca2403a4992e67eb340d39d154f13ace
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jul 30 00:48:03 2018 +0200

    build: Include VCS tag in version
    
    This is useful information to include in development snapshots, so use
    the output of `git-describe` as version when building from git.
    
    For stable releases there is no change, as they are either build from
    a tag (where `git describe` simply returns the tag name) or from a
    tarball (where there's a fallback to meson.project_version()).
    
    https://gitlab.gnome.org/GNOME/polari/issues/61

 meson.build | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index 9892011..9f913f4 100644
--- a/meson.build
+++ b/meson.build
@@ -42,7 +42,7 @@ gjs = dependency('gjs-1.0')
 conf = configuration_data()
 
 conf.set_quoted('PACKAGE_NAME', meson.project_name())
-conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('PACKAGE_VERSION', '@VCS_TAG@')
 conf.set_quoted('PREFIX', prefix)
 conf.set_quoted('LIBDIR', libdir)
 conf.set_quoted('PKGLIBDIR', pkglibdir)
@@ -52,8 +52,12 @@ conf.set10('HAVE_STRCASESTR', cc.has_function('strcasestr'))
 conf.set10('SNAPSHOT', get_option('snapshot'))
 
 config_h = declare_dependency(
-  sources: configure_file(
-    configuration: conf,
+  sources: vcs_tag(
+    command: ['git', 'describe'],
+    input: configure_file(
+      configuration: conf,
+      output: 'config.h.in'
+    ),
     output: 'config.h'
   ),
   include_directories: include_directories('.')


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