diff options
author | flow <flowlnlnln@gmail.com> | 2022-07-12 07:46:46 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 07:46:46 -0300 |
commit | e259bffca655b343b413a060482f550494b0090e (patch) | |
tree | 789520d9310856d44d7035d12d37b211a13c3008 /buildconfig/BuildConfig.cpp.in | |
parent | 1a26a5365913787e051a7c6518f051bb71ba5cd5 (diff) | |
parent | cbc1aad58d21f5551f1405ea441cfa176bf56739 (diff) | |
download | PrismLauncher-e259bffca655b343b413a060482f550494b0090e.tar.gz PrismLauncher-e259bffca655b343b413a060482f550494b0090e.tar.bz2 PrismLauncher-e259bffca655b343b413a060482f550494b0090e.zip |
Merge pull request #810 from Scrumplex/refactor-launcher-version
Hide channel from version for tagged commits
Diffstat (limited to 'buildconfig/BuildConfig.cpp.in')
-rw-r--r-- | buildconfig/BuildConfig.cpp.in | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/buildconfig/BuildConfig.cpp.in b/buildconfig/BuildConfig.cpp.in index 55a0eabe..7da66f36 100644 --- a/buildconfig/BuildConfig.cpp.in +++ b/buildconfig/BuildConfig.cpp.in @@ -70,12 +70,18 @@ Config::Config() } GIT_COMMIT = "@Launcher_GIT_COMMIT@"; + GIT_TAG = "@Launcher_GIT_TAG@"; GIT_REFSPEC = "@Launcher_GIT_REFSPEC@"; - if (GIT_REFSPEC == QStringLiteral("GITDIR-NOTFOUND")) + + // Assume that builds outside of Git repos are "stable" + if (GIT_REFSPEC == QStringLiteral("GITDIR-NOTFOUND") + || GIT_TAG == QStringLiteral("GITDIR-NOTFOUND")) { - VERSION_CHANNEL = QStringLiteral("stable"); + GIT_REFSPEC = "refs/heads/stable"; + GIT_TAG = versionString(); } - else if(GIT_REFSPEC.startsWith("refs/heads/")) + + if (GIT_REFSPEC.startsWith("refs/heads/")) { VERSION_CHANNEL = GIT_REFSPEC; VERSION_CHANNEL.remove("refs/heads/"); @@ -89,7 +95,7 @@ Config::Config() } else { - VERSION_CHANNEL = QObject::tr("unknown"); + VERSION_CHANNEL = "unknown"; } VERSION_STR = "@Launcher_VERSION_STRING@"; @@ -108,12 +114,17 @@ Config::Config() SUBREDDIT_URL = "@Launcher_SUBREDDIT_URL@"; } +QString Config::versionString() const +{ + return QString("%1.%2.%3").arg(VERSION_MAJOR).arg(VERSION_MINOR).arg(VERSION_HOTFIX); +} + QString Config::printableVersionString() const { - QString vstr = QString("%1.%2.%3").arg(QString::number(VERSION_MAJOR), QString::number(VERSION_MINOR), QString::number(VERSION_HOTFIX)); + QString vstr = versionString(); // If the build is not a main release, append the channel - if(VERSION_CHANNEL != "stable") + if(VERSION_CHANNEL != "stable" && GIT_TAG != vstr) { vstr += "-" + VERSION_CHANNEL; } @@ -121,7 +132,7 @@ QString Config::printableVersionString() const // if a build number is set, also add it to the end if(VERSION_BUILD >= 0) { - vstr += "-" + QString::number(VERSION_BUILD); + vstr += "+build." + QString::number(VERSION_BUILD); } return vstr; } |