GH-3234 Add support for custom meta URLs at build time

This is not particularly interesting for non-developers.
Also includes some internal restructuring of URL constants in general.
This commit is contained in:
Petr Mrázek
2020-07-18 16:18:02 +02:00
parent 3158082b16
commit e7f373496e
27 changed files with 75 additions and 99 deletions

View File

@ -27,7 +27,7 @@
#include "FileSystem.h"
#include "net/Download.h"
#include "net/ChecksumValidator.h"
#include "net/URLConstants.h"
#include "BuildConfig.h"
namespace {
QSet<QString> collectPathsFromDir(QString dirPath)
@ -308,7 +308,7 @@ QString AssetObject::getLocalPath()
QUrl AssetObject::getUrl()
{
return URLConstants::RESOURCE_BASE + getRelPath();
return BuildConfig.RESOURCE_BASE + getRelPath();
}
QString AssetObject::getRelPath()

View File

@ -5,6 +5,7 @@
#include <net/ChecksumValidator.h>
#include <Env.h>
#include <FileSystem.h>
#include <BuildConfig.h>
void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32,
@ -171,7 +172,7 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(
if (m_repositoryURL.isEmpty())
{
return URLConstants::LIBRARY_BASE + raw_storage;
return BuildConfig.LIBRARY_BASE + raw_storage;
}
if(m_repositoryURL.endsWith('/'))

View File

@ -12,7 +12,6 @@
#include "Rule.h"
#include "minecraft/OpSys.h"
#include "GradleSpecifier.h"
#include "net/URLConstants.h"
#include "MojangDownloadInfo.h"
#include "multimc_logic_export.h"

View File

@ -25,7 +25,6 @@
#include "BaseInstance.h"
#include "minecraft/PackProfile.h"
#include "minecraft/Library.h"
#include "net/URLConstants.h"
#include <FileSystem.h>
#include "update/FoldersTask.h"

View File

@ -198,7 +198,10 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
// FIXME: this will eventually break...
else
{
lib->setAbsoluteUrl(URLConstants::getLegacyJarUrl(out->minecraftVersion));
out->addProblem(
ProblemSeverity::Error,
QObject::tr("URL for the main jar could not be determined - Mojang removed the server that we used as fallback.")
);
}
out->mainJar = lib;
}

View File

@ -25,7 +25,7 @@
#include <Env.h>
#include <net/URLConstants.h>
#include <BuildConfig.h>
#include <QDebug>
@ -42,7 +42,7 @@ void YggdrasilTask::executeTask()
// Get the content of the request we're going to send to the server.
QJsonDocument doc(getRequestContent());
QUrl reqUrl(URLConstants::AUTH_BASE + getEndpoint());
QUrl reqUrl(BuildConfig.AUTH_BASE + getEndpoint());
QNetworkRequest netRequest(reqUrl);
netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

View File

@ -4,6 +4,7 @@
#include "FMLLibrariesTask.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
#include "BuildConfig.h"
FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst)
{
@ -63,7 +64,7 @@ void FMLLibrariesTask::executeTask()
for (auto &lib : fmlLibsToProcess)
{
auto entry = metacache->resolveEntry("fmllibs", lib.filename);
QString urlString = (lib.ours ? URLConstants::FMLLIBS_OUR_BASE_URL : URLConstants::FMLLIBS_FORGE_BASE_URL) + lib.filename;
QString urlString = (lib.ours ? BuildConfig.FMLLIBS_OUR_BASE_URL : BuildConfig.FMLLIBS_FORGE_BASE_URL) + lib.filename;
dljob->addNetAction(Net::Download::makeCached(QUrl(urlString), entry));
}