Commit e0cca53a authored by Sébastien Blin's avatar Sébastien Blin

scripts: automatic versionning

If the client is for a release. So, following the current format,
the branch will be release/yyyymm, use the format yyyy.mm.pp where
pp is the number of patches.

Change-Id: I4f5981524faf013d0f1f1736143f19a445adebd5
parent 43e448a6
......@@ -15,9 +15,12 @@ set (CMAKE_CXX_STANDARD 14)
# set project name and version
PROJECT(ring-client-gnome)
SET(PROJECT_VERSION_MAJOR 2018)
SET(PROJECT_VERSION_MINOR 06)
SET(PROJECT_VERSION_PATCH 06)
IF(EXISTS "${PROJECT_SOURCE_DIR}/version.txt")
FILE (STRINGS "version.txt" PROJECT_VERSION)
ELSE()
SET (PROJECT_VERSION "development")
ENDIF()
# set build date
IF( NOT ("$ENV{SOURCE_DATE_EPOCH}" STREQUAL ""))
......
PROJECT_NAME = "@CMAKE_PROJECT_NAME@"
PROJECT_NUMBER = @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@
PROJECT_NUMBER = @PROJECT_VERSION@
INPUT = @PROJECT_SOURCE_DIR@
RECURSIVE = YES
EXCLUDE = @PROJECT_BINARY_DIR@
......
#!/bin/bash
branch_name=$1 # (release/yyyymm)
if [ "x${git_cmd}" != "x" ]; then
echo "git not available!" # fallback to development
exit 1
fi
if [[ ${branch_name} = release/* ]]; then
git_cmd=$(which git)
major_nb=$(echo ${branch_name} | /bin/grep -Po '\d{4}')
minor_nb=$(echo ${branch_name} | /bin/grep -Po '\d{2}$')
patch_nb=$(git rev-list --count ${branch_name} ^master)
if [ "x${major_nb}" != "x" ] && [ "x${minor_nb}" != "x" ] && [ "x${patch_nb}" != "x" ]; then
echo "${major_nb}.${minor_nb}.${patch_nb}" > version.txt
else
echo "Incorrect version!"
exit 1
fi
else
echo $(git rev-parse HEAD) > version.txt
fi
exit 0
/* cmake will generate config.h with defines containing the values defined in cmake */
#define VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define VERSION_MINOR @PROJECT_VERSION_MINOR@
#define VERSION_PATCH @PROJECT_VERSION_PATCH@
#define RING_VERSION "@PROJECT_VERSION@"
#define USE_LIBNOTIFY @USE_LIBNOTIFY@
#define HAVE_APPINDICATOR @HAVE_APPINDICATOR@
......
......@@ -366,7 +366,7 @@ ring_client_startup(GApplication *app)
RingClient *client = RING_CLIENT(app);
RingClientPrivate *priv = RING_CLIENT_GET_PRIVATE(client);
g_message("Jami GNOME client version: %d.%02d.%02d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
g_message("Jami GNOME client version: %s", RING_VERSION);
g_message("git ref: %s", RING_CLIENT_REVISION);
/* make sure that the system corresponds to the autostart setting */
......
......@@ -33,7 +33,7 @@ option_version_cb(G_GNUC_UNUSED const gchar *option_name,
G_GNUC_UNUSED gpointer data,
G_GNUC_UNUSED GError **error)
{
g_print("%d.%d.%d - %s\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, RING_CLIENT_REVISION);
g_print("%s - %s\n", RING_VERSION, RING_CLIENT_REVISION);
exit(EXIT_SUCCESS);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment