Include commit hash in VERSION

This commit is contained in:
casey langen 2020-10-31 21:28:48 -07:00
parent 01068cd798
commit 5d2fd09c89
3 changed files with 6 additions and 1 deletions

View File

@ -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 <major> <minor> <patch>"
@ -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

View File

@ -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() {

View File

@ -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)) {