New schema for the 4th segment of the swift version number

Based on a count of the number of commits since
any of the first 3 segments were changed.
This commit is contained in:
Mat Sutcliffe
2020-01-01 00:21:04 +00:00
parent 516c8a2fce
commit f056d4fcd6
10 changed files with 71 additions and 158 deletions

View File

@@ -87,17 +87,7 @@ namespace XSwiftBus
std::string CService::getVersionNumber() const
{
std::string version(XSWIFTBUS_VERSION);
const std::string lastCommitTs(GIT_COMMIT_TS);
const long long lctsll = std::stoll(lastCommitTs); // at least 64bit
// now we have to converto int
// max 2147483647 (2^31 - 1)
// 1MMddHHmm (years since 2010)
const long long yearOffset = 201000000000;
const int lctsInt = static_cast<int>(lctsll - yearOffset);
version = version + "." + std::to_string(lctsInt);
return version;
return XSWIFTBUS_VERSION;
}
std::string CService::getCommitHash() const

View File

@@ -72,19 +72,7 @@ DEFINES += XPLM210=1
DEFINES += XPMP_CLIENT_NAME=\\\"xswiftbus\\\"
DEFINES += XPMP_CLIENT_LONGNAME=\\\"xswiftbus\\\"
win32: GIT_BIN = $$system($$(SYSTEMROOT)\system32\where git 2> nul)
else: GIT_BIN = $$system(which git 2> /dev/null)
isEmpty(GIT_BIN) {
GIT_HEAD_SHA1="<unknown>"
GIT_COMMIT_TS="0"
} else {
GIT_HEAD_SHA1=$$system(git rev-parse --short HEAD)
GIT_COMMIT_TS=$$system(git log -1 --date=format:'%Y%m%d%H%M' --pretty=format:%cd)
}
DEFINES += XSWIFTBUS_VERSION=\\\"$$swiftConfig(version.full)\\\"
DEFINES += GIT_COMMIT_TS=\\\"$$GIT_COMMIT_TS\\\"
DEFINES += XSWIFTBUS_VERSION=\\\"$$swiftConfig(version.full).$$VER_REV\\\"
isEmpty(XSWIFTBUS_COMMIT): error(Missing XSWIFTBUS_COMMIT variable)
DEFINES += XSWIFTBUS_COMMIT=\\\"$$XSWIFTBUS_COMMIT\\\"