Get rid of long rebuilds because of minor cmake config changes

This commit is contained in:
Petr Mrázek
2014-04-05 22:58:47 +02:00
parent ad9d082f57
commit 42e305bb9d
14 changed files with 206 additions and 192 deletions

View File

@ -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<UpdateChecker::ChannelListEntry> 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;
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);
#endif
auto download = CacheDownload::make(QUrl(source.url), cache_entry);
job->addNetAction(download);
}
}
else
{

View File

@ -5,11 +5,11 @@
#include <QJsonArray>
#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;
}

View File

@ -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!