summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-12-01 14:27:36 -0600
committerAndrew <forkk@forkk.net>2013-12-01 14:27:36 -0600
commit2427ad687137bbcfc7303a931d7e0b74d5325e48 (patch)
tree41eba6ced45761278f137eaf86b0f1da3c60996c
parenteff38858ef32239cd91044295ce7db3def857339 (diff)
downloadMultiMC-2427ad687137bbcfc7303a931d7e0b74d5325e48.tar
MultiMC-2427ad687137bbcfc7303a931d7e0b74d5325e48.tar.gz
MultiMC-2427ad687137bbcfc7303a931d7e0b74d5325e48.tar.lz
MultiMC-2427ad687137bbcfc7303a931d7e0b74d5325e48.tar.xz
MultiMC-2427ad687137bbcfc7303a931d7e0b74d5325e48.zip
Rework MultiMC's versioning system
-rw-r--r--CMakeLists.txt23
-rw-r--r--MultiMC.cpp5
-rw-r--r--MultiMC.h3
-rw-r--r--MultiMCVersion.h37
-rw-r--r--config.h.in9
5 files changed, 46 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dfce1fad..f3cacbe2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -91,16 +91,29 @@ ENDIF(${BIGENDIAN})
######## Set version numbers ########
-SET(MultiMC_VERSION_MAJOR 5)
+SET(MultiMC_VERSION_MAJOR 1)
SET(MultiMC_VERSION_MINOR 0)
-SET(MultiMC_VERSION_REV 0)
# Build number
-SET(MultiMC_VERSION_BUILD 0 CACHE STRING "Build number.")
-MESSAGE(STATUS "MultiMC build #${MultiMC_VERSION_BUILD}")
+SET(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
+
+# Build type
+SET(MultiMC_VERSION_BUILD_TYPE "custombuild" CACHE STRING "Build type. Usually corresponds to the buildbot build name. Empty string for no build type.")
+
+SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}")
+
+IF (MultiMC_VERSION_BUILD GREATER -1)
+ SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}.${MultiMC_VERSION_BUILD}")
+ENDIF ()
+
+IF (NOT MultiMC_VERSION_BUILD_TYPE STREQUAL "")
+ SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}-${MultiMC_VERSION_BUILD_TYPE}")
+ENDIF ()
+
+MESSAGE(STATUS "MultiMC 5 version ${MultiMC_VERSION_STRING}")
# Custom target to just print the version.
-ADD_CUSTOM_TARGET(version echo "Version: ${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
+ADD_CUSTOM_TARGET(version echo "Version: ${MultiMC_VERSION_STRING}")
# Check the current Git commit
execute_process(COMMAND git rev-parse HEAD
diff --git a/MultiMC.cpp b/MultiMC.cpp
index 26d7e8c8..a41f5f0a 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -31,7 +31,8 @@
#include "config.h"
using namespace Util::Commandline;
-MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
+MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv),
+ m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_BUILD_TYPE}
{
setOrganizationName("MultiMC");
setApplicationName("MultiMC5");
@@ -105,8 +106,6 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
{
std::cout << "Version " << VERSION_STR << std::endl;
std::cout << "Git " << GIT_COMMIT << std::endl;
- std::cout << "Tag: " << JENKINS_BUILD_TAG << " " << (ARCH == x64 ? "x86_64" : "x86")
- << std::endl;
m_status = MultiMC::Succeeded;
return;
}
diff --git a/MultiMC.h b/MultiMC.h
index dba923b1..cae6eee0 100644
--- a/MultiMC.h
+++ b/MultiMC.h
@@ -2,7 +2,6 @@
#include <QApplication>
#include "MultiMCVersion.h"
-#include "config.h"
#include <memory>
#include "logger/QsLog.h"
#include "logger/QsLogDest.h"
@@ -119,5 +118,5 @@ private:
QsLogging::DestinationPtr m_debugDestination;
Status m_status = MultiMC::Failed;
- MultiMCVersion m_version = {VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD};
+ MultiMCVersion m_version;
};
diff --git a/MultiMCVersion.h b/MultiMCVersion.h
index 70a2259e..863976b2 100644
--- a/MultiMCVersion.h
+++ b/MultiMCVersion.h
@@ -28,36 +28,43 @@ struct MultiMCVersion
*/
QString toString() const
{
- return QString("%1.%2.%3.%4").arg(
- QString::number(major),
- QString::number(minor),
- QString::number(revision),
- QString::number(build));
+ QString vstr = QString("%1.%2").arg(
+ QString::number(major),
+ QString::number(minor));
+
+ if (build > 0) vstr += QString(".%1").arg(QString::number(build));
+ if (!buildType.isEmpty()) vstr += QString("-%1").arg(buildType);
+
+ return vstr;
}
/*!
* \brief The major version number.
- * For MultiMC 5, this will always be 5.
+ * 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;
/*!
* \brief The minor version number.
- * This number is incremented when major features are added.
+ * This number is incremented for major features and bug fixes.
*/
int minor;
/*!
- * \brief The revision number.
- * This number is incremented for bugfixes and small features.
- */
- int revision;
-
- /*!
* \brief The build number.
- * This number is automatically set by Jenkins. It is incremented every time
- * a new build is run.
+ * This number is automatically set by Buildbot it is set to the build number of the buildbot
+ * build that this build came from.
+ * 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;
+
+ /*!
+ * \brief The build type.
+ * This indicates the type of build that this is. For example, lin64-stable.
+ * Usually corresponds to this build's buildbot builder name.
+ */
+ QString buildType;
};
diff --git a/config.h.in b/config.h.in
index fbc5aed2..34841817 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,19 +1,16 @@
#define VERSION_MAJOR @MultiMC_VERSION_MAJOR@
#define VERSION_MINOR @MultiMC_VERSION_MINOR@
-#define VERSION_REVISION @MultiMC_VERSION_REV@
#define VERSION_BUILD @MultiMC_VERSION_BUILD@
+#define VERSION_BUILD_TYPE "@MultiMC_VERSION_BUILD_TYPE@"
#define GIT_COMMIT "@MultiMC_GIT_COMMIT@"
-#define VERSION_STR "@MultiMC_VERSION_MAJOR@.@MultiMC_VERSION_MINOR@.@MultiMC_VERSION_REV@.@MultiMC_VERSION_BUILD@"
+#define VERSION_STR "@MultiMC_VERSION_STRING@"
#define x86 1
#define x64 2
#define ARCH @MultiMC_ARCH@
-#define JENKINS_BUILD_TAG "@MultiMC_BUILD_TAG@"
-
-#define JENKINS_JOB_URL "@MultiMC_JOB_URL@"
-
#define USE_HTTPS @MultiMC_USE_HTTPS@
+