From 42e305bb9d1babef9bb66a8d376289e8aebed671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 5 Apr 2014 22:58:47 +0200 Subject: Get rid of long rebuilds because of minor cmake config changes --- logic/MinecraftProcess.cpp | 3 ++- logic/updater/DownloadUpdateTask.cpp | 29 ++++++++++++++++------------- logic/updater/NotificationChecker.cpp | 13 ++++++------- logic/updater/UpdateChecker.cpp | 5 +++-- 4 files changed, 27 insertions(+), 23 deletions(-) (limited to 'logic') diff --git a/logic/MinecraftProcess.cpp b/logic/MinecraftProcess.cpp index 90767d9e..7b97b717 100644 --- a/logic/MinecraftProcess.cpp +++ b/logic/MinecraftProcess.cpp @@ -15,6 +15,7 @@ * limitations under the License. */ #include "MultiMC.h" +#include "Config.h" #include "MinecraftProcess.h" @@ -432,7 +433,7 @@ QStringList MinecraftProcess::javaArguments() const void MinecraftProcess::arm() { - emit log("MultiMC version: " + MMC->version().toString() + "\n\n"); + emit log("MultiMC version: " + BuildConfig.printableVersionString() + "\n\n"); emit log("Minecraft folder is:\n" + workingDirectory() + "\n\n"); if (!preLaunch()) diff --git a/logic/updater/DownloadUpdateTask.cpp b/logic/updater/DownloadUpdateTask.cpp index 83679f19..1a423210 100644 --- a/logic/updater/DownloadUpdateTask.cpp +++ b/logic/updater/DownloadUpdateTask.cpp @@ -16,6 +16,8 @@ #include "DownloadUpdateTask.h" #include "MultiMC.h" +#include "Config.h" + #include "logic/updater/UpdateChecker.h" #include "logic/net/NetJob.h" #include "pathutils.h" @@ -29,7 +31,7 @@ DownloadUpdateTask::DownloadUpdateTask(QString repoUrl, int versionId, QObject *parent) : Task(parent) { - m_cVersionId = MMC->version().build; + m_cVersionId = BuildConfig.VERSION_BUILD; m_nRepoUrl = repoUrl; m_nVersionId = versionId; @@ -58,7 +60,7 @@ void DownloadUpdateTask::processChannels() } QList channels = checker->getChannelList(); - QString channelId = MMC->version().channel; + QString channelId = BuildConfig.VERSION_CHANNEL; m_cRepoUrl.clear(); // Search through the channel list for a channel with the correct ID. @@ -405,17 +407,18 @@ DownloadUpdateTask::processFileLists(NetJob *job, if (isUpdater) { -#ifdef MultiMC_UPDATER_FORCE_LOCAL - QLOG_DEBUG() << "Skipping updater download and using local version."; -#else - auto cache_entry = MMC->metacache()->resolveEntry("root", entry.path); - QLOG_DEBUG() << "Updater will be in " << cache_entry->getFullPath(); - // force check. - cache_entry->stale = true; - - auto download = CacheDownload::make(QUrl(source.url), cache_entry); - job->addNetAction(download); -#endif + if(BuildConfig.UPDATER_FORCE_LOCAL) + QLOG_DEBUG() << "Skipping updater download and using local version."; + else + { + auto cache_entry = MMC->metacache()->resolveEntry("root", entry.path); + QLOG_DEBUG() << "Updater will be in " << cache_entry->getFullPath(); + // force check. + cache_entry->stale = true; + + auto download = CacheDownload::make(QUrl(source.url), cache_entry); + job->addNetAction(download); + } } else { diff --git a/logic/updater/NotificationChecker.cpp b/logic/updater/NotificationChecker.cpp index 191e90a3..39da362b 100644 --- a/logic/updater/NotificationChecker.cpp +++ b/logic/updater/NotificationChecker.cpp @@ -5,11 +5,11 @@ #include #include "MultiMC.h" -#include "MultiMCVersion.h" +#include "Config.h" #include "logic/net/CacheDownload.h" NotificationChecker::NotificationChecker(QObject *parent) - : QObject(parent), m_notificationsUrl(QUrl(NOTIFICATION_URL)) + : QObject(parent), m_notificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL)) { // this will call checkForNotifications once the event loop is running QMetaObject::invokeMethod(this, "checkForNotifications", Qt::QueuedConnection); @@ -93,13 +93,12 @@ void NotificationChecker::downloadSucceeded(int) bool NotificationChecker::NotificationEntry::applies() const { - MultiMCVersion version = MMC->version(); - bool channelApplies = channel.isEmpty() || channel == version.channel; - bool platformApplies = platform.isEmpty() || platform == version.platform; + bool channelApplies = channel.isEmpty() || channel == BuildConfig.VERSION_CHANNEL; + bool platformApplies = platform.isEmpty() || platform == BuildConfig.BUILD_PLATFORM; bool fromApplies = - from.isEmpty() || from == FULL_VERSION_STR || !versionLessThan(FULL_VERSION_STR, from); + from.isEmpty() || from == BuildConfig.FULL_VERSION_STR || !versionLessThan(BuildConfig.FULL_VERSION_STR, from); bool toApplies = - to.isEmpty() || to == FULL_VERSION_STR || !versionLessThan(to, FULL_VERSION_STR); + to.isEmpty() || to == BuildConfig.FULL_VERSION_STR || !versionLessThan(to, BuildConfig.FULL_VERSION_STR); return channelApplies && platformApplies && fromApplies && toApplies; } diff --git a/logic/updater/UpdateChecker.cpp b/logic/updater/UpdateChecker.cpp index 8e2aa8b3..57ddfb0b 100644 --- a/logic/updater/UpdateChecker.cpp +++ b/logic/updater/UpdateChecker.cpp @@ -16,6 +16,7 @@ #include "UpdateChecker.h" #include "MultiMC.h" +#include "Config.h" #include "logger/QsLog.h" @@ -30,7 +31,7 @@ UpdateChecker::UpdateChecker() { - m_channelListUrl = CHANLIST_URL; + m_channelListUrl = BuildConfig.CHANLIST_URL; m_updateChecking = false; m_chanListLoading = false; m_checkUpdateWaiting = false; @@ -148,7 +149,7 @@ void UpdateChecker::updateCheckFinished(bool notifyNoUpdate) // We've got the version with the greatest ID number. Now compare it to our current build // number and update if they're different. int newBuildNumber = newestVersion.value("Id").toVariant().toInt(); - if (newBuildNumber != MMC->version().build) + if (newBuildNumber != BuildConfig.VERSION_BUILD) { QLOG_DEBUG() << "Found newer version with ID" << newBuildNumber; // Update! -- cgit v1.2.3