From 5d2fd09c891bbb82c9167a8b911f19010c0901c5 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sat, 31 Oct 2020 21:28:48 -0700 Subject: [PATCH] Include commit hash in VERSION --- script/update-version.sh | 2 ++ src/musikcore/version.h | 2 ++ src/musikcube/app/layout/MainLayout.cpp | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/script/update-version.sh b/script/update-version.sh index 697027692..f9f5cfc79 100755 --- a/script/update-version.sh +++ b/script/update-version.sh @@ -3,6 +3,7 @@ MAJOR=$1 MINOR=$2 PATCH=$3 +COMMIT_HASH=`git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/#\1/"` if [ -z "$MAJOR" ] || [ -z "$MINOR" ] || [ -z "$PATCH" ]; then echo "usage: update-version.sh " @@ -12,6 +13,7 @@ fi sed -Ei.bak "s/(\s*)(#define VERSION_MAJOR )(.*)/\1\2${MAJOR}/g" src/musikcore/version.h sed -Ei.bak "s/(\s*)(#define VERSION_MINOR )(.*)/\1\2${MINOR}/g" src/musikcore/version.h sed -Ei.bak "s/(\s*)(#define VERSION_PATCH )(.*)/\1\2${PATCH}/g" src/musikcore/version.h +sed -Ei.bak "s/(\s*)(#define VERSION_COMMIT_HASH )(.*)/\1\2\"${COMMIT_HASH}\"/g" src/musikcore/version.h sed -Ei.bak "s/(\s*)(#define VERSION )(.*)/\1\2\"${MAJOR}.${MINOR}.${PATCH}\"/g" src/musikcore/version.h # visual studio resource files are utf16-le, so sed can't operate on them diff --git a/src/musikcore/version.h b/src/musikcore/version.h index 7223b4016..373f1b3c9 100644 --- a/src/musikcore/version.h +++ b/src/musikcore/version.h @@ -39,7 +39,9 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 94 #define VERSION_PATCH 0 +#define VERSION_COMMIT_HASH "#8f99f958" #define VERSION "0.94.0" + namespace musik { namespace cube { static inline std::string userAgent() { diff --git a/src/musikcube/app/layout/MainLayout.cpp b/src/musikcube/app/layout/MainLayout.cpp index e715c4bb7..b2bd6d785 100755 --- a/src/musikcube/app/layout/MainLayout.cpp +++ b/src/musikcube/app/layout/MainLayout.cpp @@ -198,7 +198,8 @@ bool MainLayout::KeyPress(const std::string& key) { return true; } else if (key == "M-`") { - ToastOverlay::Show(u8fmt(_TSTR("console_version"), VERSION), -1); + std::string version = u8fmt("%s %s", VERSION, VERSION_COMMIT_HASH); + ToastOverlay::Show(u8fmt(_TSTR("console_version"), version.c_str()), -1); return true; } else if (this->GetLayout()->KeyPress(key)) {