Rework version numbering system.
Again...
This commit is contained in:
parent
28cb66e85c
commit
3202b972f8
@ -128,12 +128,16 @@ SET(MultiMC_NEWS_RSS_URL "http://multimc.org/rss.xml" CACHE STRING "URL to fetch
|
|||||||
######## Set version numbers ########
|
######## Set version numbers ########
|
||||||
SET(MultiMC_VERSION_MAJOR 0)
|
SET(MultiMC_VERSION_MAJOR 0)
|
||||||
SET(MultiMC_VERSION_MINOR 0)
|
SET(MultiMC_VERSION_MINOR 0)
|
||||||
|
SET(MultiMC_VERSION_HOTFIX 0)
|
||||||
|
|
||||||
# Build number
|
# Build number
|
||||||
SET(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
|
SET(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
|
||||||
|
|
||||||
# Build type
|
# Version type
|
||||||
SET(MultiMC_VERSION_BUILD_TYPE "custombuild" CACHE STRING "Build type. If this is set, it is appended to the end of the version string with a dash (<version string>-<build type>. It is not used for anything other than indicating in the version string what type of build this is (eg 'lin64').")
|
SET(MultiMC_VERSION_TYPE "Custom" CACHE STRING "MultiMC's version type. This should be one of 'Custom', 'Release', 'ReleaseCandidate', or 'Development', depending on what type of version this is.")
|
||||||
|
|
||||||
|
# Build platform.
|
||||||
|
SET(MultiMC_BUILD_PLATFORM "" CACHE STRING "A short string identifying the platform that this build was built for. Only used by the notification system and to display in the about dialog.")
|
||||||
|
|
||||||
# Version channel
|
# Version channel
|
||||||
SET(MultiMC_VERSION_CHANNEL "" CACHE STRING "The current build's channel. Included in the version string.")
|
SET(MultiMC_VERSION_CHANNEL "" CACHE STRING "The current build's channel. Included in the version string.")
|
||||||
@ -147,16 +151,20 @@ SET(MultiMC_UPDATER false CACHE BOOL "Whether or not the update system is enable
|
|||||||
# Notification URL
|
# Notification URL
|
||||||
SET(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.")
|
SET(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.")
|
||||||
|
|
||||||
|
SET(MultiMC_RELEASE_VERSION_NAME "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}")
|
||||||
|
IF (MultiMC_VERSION_HOTFIX GREATER 0)
|
||||||
|
SET(MultiMC_RELEASE_VERSION_NAME "${MultiMC_RELEASE_VERSION_NAME}.${MultiMC_VERSION_HOTFIX}")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# Build a version string to display in the configure logs.
|
# Build a version string to display in the configure logs.
|
||||||
SET(MultiMC_VERSION_STRING "5.${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}")
|
IF (MultiMC_VERSION_TYPE STREQUAL "Custom" OR MultiMC_VERSION_TYPE STREQUAL "Release")
|
||||||
IF (MultiMC_VERSION_BUILD GREATER -1)
|
SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}")
|
||||||
SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}.${MultiMC_VERSION_BUILD}")
|
ELSEIF (MultiMC_VERSION_TYPE STREQUAL "ReleaseCandidate")
|
||||||
ENDIF ()
|
SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-rc${MultiMC_VERSION_BUILD}")
|
||||||
IF (NOT MultiMC_VERSION_CHANNEL STREQUAL "")
|
ELSEIF (MultiMC_VERSION_TYPE STREQUAL "Development")
|
||||||
SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}-${MultiMC_VERSION_CHANNEL}")
|
SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-dev${MultiMC_VERSION_BUILD}")
|
||||||
ENDIF ()
|
ELSE ()
|
||||||
IF (NOT MultiMC_VERSION_BUILD_TYPE STREQUAL "")
|
MESSAGE(ERROR "Invalid build type.")
|
||||||
SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}-${MultiMC_VERSION_BUILD_TYPE}")
|
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
MESSAGE(STATUS "MultiMC 5 version ${MultiMC_VERSION_STRING}")
|
MESSAGE(STATUS "MultiMC 5 version ${MultiMC_VERSION_STRING}")
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
using namespace Util::Commandline;
|
using namespace Util::Commandline;
|
||||||
|
|
||||||
MultiMC::MultiMC(int &argc, char **argv, bool root_override)
|
MultiMC::MultiMC(int &argc, char **argv, bool root_override)
|
||||||
: QApplication(argc, argv), m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD,
|
: QApplication(argc, argv), m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_HOTFIX,
|
||||||
VERSION_CHANNEL, VERSION_BUILD_TYPE}
|
VERSION_BUILD, MultiMCVersion::VERSION_TYPE, VERSION_CHANNEL, BUILD_PLATFORM}
|
||||||
{
|
{
|
||||||
setOrganizationName("MultiMC");
|
setOrganizationName("MultiMC");
|
||||||
setApplicationName("MultiMC5");
|
setApplicationName("MultiMC5");
|
||||||
|
@ -18,58 +18,63 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The Version class represents a MultiMC version number.
|
* \brief The Version class represents a MultiMC version.
|
||||||
*/
|
*/
|
||||||
struct MultiMCVersion
|
struct MultiMCVersion
|
||||||
{
|
{
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
//! Version type for stable release builds.
|
||||||
|
Release,
|
||||||
|
|
||||||
|
//! Version type for release candidates.
|
||||||
|
ReleaseCandidate,
|
||||||
|
|
||||||
|
//! Version type for development builds.
|
||||||
|
Development,
|
||||||
|
|
||||||
|
//! Version type for custom builds. This is the default when no version type is specified.
|
||||||
|
Custom
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Converts the Version to a string.
|
* \brief Converts the Version to a string.
|
||||||
* \return The version number in string format (major.minor.revision.build).
|
* \return The version number in string format (major.minor.revision.build).
|
||||||
*/
|
*/
|
||||||
QString toString() const
|
QString toString() const
|
||||||
{
|
{
|
||||||
QString vstr = QString("5.%1.%2").arg(
|
QString vstr = QString("%1.%2").arg(
|
||||||
QString::number(major),
|
QString::number(major),
|
||||||
QString::number(minor));
|
QString::number(minor));
|
||||||
|
|
||||||
if (build >= 0) vstr += "." + QString::number(build);
|
if (hotfix > 0) vstr += "." + QString::number(hotfix);
|
||||||
if (!channel.isEmpty()) vstr += "-" + channel;
|
|
||||||
if (!buildType.isEmpty()) vstr += "-" + buildType;
|
// If the build is a development build or release candidate, add that info to the end.
|
||||||
|
if (type == Development) vstr += "-dev" + QString::number(build);
|
||||||
|
else if (type == ReleaseCandidate) vstr += "-rc" + QString::number(build);
|
||||||
|
|
||||||
return vstr;
|
return vstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//! The major version number.
|
||||||
* \brief The major version number.
|
|
||||||
* This is no longer going to always be 5 for MultiMC 5. Doing so is useless.
|
|
||||||
* Instead, we'll be starting major off at 1 and incrementing it with every major feature.
|
|
||||||
*/
|
|
||||||
int major;
|
int major;
|
||||||
|
|
||||||
/*!
|
//! The minor version number.
|
||||||
* \brief The minor version number.
|
|
||||||
* This number is incremented for major features and bug fixes.
|
|
||||||
*/
|
|
||||||
int minor;
|
int minor;
|
||||||
|
|
||||||
/*!
|
//! The hotfix number.
|
||||||
* \brief The build number.
|
int hotfix;
|
||||||
* This number is automatically set by Buildbot it is set to the build number of the buildbot
|
|
||||||
* build that this build came from.
|
//! The build number.
|
||||||
* If this build didn't come from buildbot and no build number was given to CMake, this will default
|
|
||||||
* to -1, causing it to not show in this version's string representation.
|
|
||||||
*/
|
|
||||||
int build;
|
int build;
|
||||||
|
|
||||||
/*!
|
//! The build type.
|
||||||
* \brief This build's channel.
|
Type type;
|
||||||
*/
|
|
||||||
|
//! The build channel.
|
||||||
QString channel;
|
QString channel;
|
||||||
|
|
||||||
/*!
|
//! A short string identifying the platform that this version is for. For example, lin64 or win32.
|
||||||
* \brief The build type.
|
QString platform;
|
||||||
* This indicates the type of build that this is. For example, lin64 or custombuild.
|
|
||||||
*/
|
|
||||||
QString buildType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
12
config.h.in
12
config.h.in
@ -1,13 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Minor and major version, used to communicate changes to users.
|
// Version information
|
||||||
#define VERSION_MAJOR @MultiMC_VERSION_MAJOR@
|
#define VERSION_MAJOR @MultiMC_VERSION_MAJOR@
|
||||||
#define VERSION_MINOR @MultiMC_VERSION_MINOR@
|
#define VERSION_MINOR @MultiMC_VERSION_MINOR@
|
||||||
|
#define VERSION_HOTFIX @MultiMC_VERSION_HOTFIX@
|
||||||
// Build number, channel, and type -- number and channel are used by the updater, type is purely visual
|
|
||||||
#define VERSION_BUILD @MultiMC_VERSION_BUILD@
|
#define VERSION_BUILD @MultiMC_VERSION_BUILD@
|
||||||
|
#define VERSION_TYPE @MultiMC_VERSION_TYPE@
|
||||||
|
|
||||||
|
// The version channel. This is used by the updater to determine what channel the current version came from.
|
||||||
#define VERSION_CHANNEL "@MultiMC_VERSION_CHANNEL@"
|
#define VERSION_CHANNEL "@MultiMC_VERSION_CHANNEL@"
|
||||||
#define VERSION_BUILD_TYPE "@MultiMC_VERSION_BUILD_TYPE@"
|
|
||||||
|
// A short string identifying this build's platform. For example, "lin64" or "win32".
|
||||||
|
#define BUILD_PLATFORM "@MultiMC_BUILD_PLATFORM@"
|
||||||
|
|
||||||
// URL for the updater's channel
|
// URL for the updater's channel
|
||||||
#define CHANLIST_URL "@MultiMC_CHANLIST_URL@"
|
#define CHANLIST_URL "@MultiMC_CHANLIST_URL@"
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
|
||||||
#include "MultiMC.h"
|
#include "MultiMC.h"
|
||||||
|
#include "MultiMCVersion.h"
|
||||||
#include "logic/net/CacheDownload.h"
|
#include "logic/net/CacheDownload.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
NotificationChecker::NotificationChecker(QObject *parent)
|
NotificationChecker::NotificationChecker(QObject *parent)
|
||||||
: QObject(parent), m_notificationsUrl(QUrl(NOTIFICATION_URL))
|
: QObject(parent), m_notificationsUrl(QUrl(NOTIFICATION_URL))
|
||||||
@ -66,7 +66,7 @@ void NotificationChecker::downloadSucceeded(int)
|
|||||||
entry.id = obj.value("id").toDouble();
|
entry.id = obj.value("id").toDouble();
|
||||||
entry.message = obj.value("message").toString();
|
entry.message = obj.value("message").toString();
|
||||||
entry.channel = obj.value("channel").toString();
|
entry.channel = obj.value("channel").toString();
|
||||||
entry.buildtype = obj.value("buildtype").toString();
|
entry.platform = obj.value("platform").toString();
|
||||||
entry.from = obj.value("from").toString();
|
entry.from = obj.value("from").toString();
|
||||||
entry.to = obj.value("to").toString();
|
entry.to = obj.value("to").toString();
|
||||||
const QString type = obj.value("type").toString("critical");
|
const QString type = obj.value("type").toString("critical");
|
||||||
@ -93,13 +93,14 @@ void NotificationChecker::downloadSucceeded(int)
|
|||||||
|
|
||||||
bool NotificationChecker::NotificationEntry::applies() const
|
bool NotificationChecker::NotificationEntry::applies() const
|
||||||
{
|
{
|
||||||
bool channelApplies = channel.isEmpty() || channel == VERSION_CHANNEL;
|
MultiMCVersion version = MMC->version();
|
||||||
bool buildtypeApplies = buildtype.isEmpty() || buildtype == VERSION_BUILD_TYPE;
|
bool channelApplies = channel.isEmpty() || channel == version.channel;
|
||||||
|
bool platformApplies = platform.isEmpty() || platform == version.platform;
|
||||||
bool fromApplies =
|
bool fromApplies =
|
||||||
from.isEmpty() || from == FULL_VERSION_STR || !versionLessThan(FULL_VERSION_STR, from);
|
from.isEmpty() || from == FULL_VERSION_STR || !versionLessThan(FULL_VERSION_STR, from);
|
||||||
bool toApplies =
|
bool toApplies =
|
||||||
to.isEmpty() || to == FULL_VERSION_STR || !versionLessThan(to, FULL_VERSION_STR);
|
to.isEmpty() || to == FULL_VERSION_STR || !versionLessThan(to, FULL_VERSION_STR);
|
||||||
return channelApplies && buildtypeApplies && fromApplies && toApplies;
|
return channelApplies && platformApplies && fromApplies && toApplies;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotificationChecker::NotificationEntry::versionLessThan(const QString &v1,
|
bool NotificationChecker::NotificationEntry::versionLessThan(const QString &v1,
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
Information
|
Information
|
||||||
} type;
|
} type;
|
||||||
QString channel;
|
QString channel;
|
||||||
QString buildtype;
|
QString platform;
|
||||||
QString from;
|
QString from;
|
||||||
QString to;
|
QString to;
|
||||||
bool applies() const;
|
bool applies() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user