NOISSUE remove OneSixLibrary
This commit is contained in:
parent
f6b2ccb110
commit
71e4b147ec
@ -181,8 +181,6 @@ set(LOGIC_SOURCES
|
||||
minecraft/MinecraftVersionList.cpp
|
||||
minecraft/MinecraftVersionList.h
|
||||
minecraft/NullProfileStrategy.h
|
||||
minecraft/OneSixLibrary.cpp
|
||||
minecraft/OneSixLibrary.h
|
||||
minecraft/OneSixProfileStrategy.cpp
|
||||
minecraft/OneSixProfileStrategy.h
|
||||
minecraft/OneSixRule.cpp
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "ForgeInstaller.h"
|
||||
#include "minecraft/MinecraftProfile.h"
|
||||
#include "minecraft/OneSixLibrary.h"
|
||||
#include "minecraft/GradleSpecifier.h"
|
||||
#include "net/HttpMetaCache.h"
|
||||
#include "tasks/Task.h"
|
||||
#include "minecraft/OneSixInstance.h"
|
||||
@ -86,10 +86,10 @@ void ForgeInstaller::prepare(const QString &filename, const QString &universalUr
|
||||
m_forgeVersionString = installObj.value("version").toString().remove("Forge").trimmed();
|
||||
|
||||
// where do we put the library? decode the mojang path
|
||||
OneSixLibrary lib(libraryName);
|
||||
GradleSpecifier lib(libraryName);
|
||||
|
||||
auto cacheentry = ENV.metacache()->resolveEntry("libraries", lib.storageSuffix());
|
||||
finalPath = "libraries/" + lib.storageSuffix();
|
||||
auto cacheentry = ENV.metacache()->resolveEntry("libraries", lib.toPath());
|
||||
finalPath = "libraries/" + lib.toPath();
|
||||
if (!FS::ensureFilePathExists(finalPath))
|
||||
return;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "FTBProfileStrategy.h"
|
||||
|
||||
#include "minecraft/MinecraftProfile.h"
|
||||
#include "minecraft/OneSixLibrary.h"
|
||||
#include "minecraft/GradleSpecifier.h"
|
||||
#include "tasks/SequentialTask.h"
|
||||
#include "forge/ForgeInstaller.h"
|
||||
#include "forge/ForgeVersionList.h"
|
||||
@ -77,8 +77,8 @@ void OneSixFTBInstance::copy(const QDir &newDir)
|
||||
qDebug() << "Copying FTB libraries";
|
||||
for (auto library : libraryNames)
|
||||
{
|
||||
OneSixLibrary lib(library);
|
||||
const QString out = QDir::current().absoluteFilePath("libraries/" + lib.storageSuffix());
|
||||
GradleSpecifier lib(library);
|
||||
const QString out = QDir::current().absoluteFilePath("libraries/" + lib.toPath());
|
||||
if (QFile::exists(out))
|
||||
{
|
||||
continue;
|
||||
@ -87,9 +87,9 @@ void OneSixFTBInstance::copy(const QDir &newDir)
|
||||
{
|
||||
qCritical() << "Couldn't create folder structure for" << out;
|
||||
}
|
||||
if (!QFile::copy(librariesPath().absoluteFilePath(lib.storageSuffix()), out))
|
||||
if (!QFile::copy(librariesPath().absoluteFilePath(lib.toPath()), out))
|
||||
{
|
||||
qCritical() << "Couldn't copy" << lib.rawName();
|
||||
qCritical() << "Couldn't copy" << QString(lib);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "minecraft/OneSixInstance.h"
|
||||
|
||||
class OneSixLibrary;
|
||||
|
||||
class OneSixFTBInstance : public OneSixInstance
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "minecraft/MinecraftProfile.h"
|
||||
#include "minecraft/OneSixLibrary.h"
|
||||
#include "minecraft/RawLibrary.h"
|
||||
#include "minecraft/OneSixInstance.h"
|
||||
#include "liteloader/LiteLoaderVersionList.h"
|
||||
#include "Exception.h"
|
||||
@ -51,19 +51,14 @@ bool LiteLoaderInstaller::add(OneSixInstance *to)
|
||||
|
||||
for (auto rawLibrary : m_version->libraries)
|
||||
{
|
||||
OneSixLibrary lib(rawLibrary);
|
||||
libraries.append(lib.toJson());
|
||||
libraries.append(rawLibrary->toJson());
|
||||
}
|
||||
|
||||
// liteloader
|
||||
{
|
||||
OneSixLibrary liteloaderLib("com.mumfrey:liteloader:" + m_version->version);
|
||||
liteloaderLib.setAbsoluteUrl(
|
||||
QString("http://dl.liteloader.com/versions/com/mumfrey/liteloader/%1/%2")
|
||||
.arg(m_version->mcVersion, m_version->file));
|
||||
RawLibrary liteloaderLib("com.mumfrey:liteloader:" + m_version->version);
|
||||
liteloaderLib.setAbsoluteUrl(QString("http://dl.liteloader.com/versions/com/mumfrey/liteloader/%1/%2").arg(m_version->mcVersion, m_version->file));
|
||||
QJsonObject llLibObj = liteloaderLib.toJson();
|
||||
llLibObj.insert("insert", QString("prepend"));
|
||||
llLibObj.insert("MMC-depend", QString("hard"));
|
||||
libraries.append(llLibObj);
|
||||
}
|
||||
|
||||
|
@ -233,9 +233,9 @@ bool MinecraftProfile::revertToVanilla()
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNormalLibs()
|
||||
QList<std::shared_ptr<RawLibrary> > MinecraftProfile::getActiveNormalLibs()
|
||||
{
|
||||
QList<std::shared_ptr<OneSixLibrary> > output;
|
||||
QList<std::shared_ptr<RawLibrary> > output;
|
||||
for (auto lib : libraries)
|
||||
{
|
||||
if (lib->isActive() && !lib->isNative())
|
||||
@ -254,9 +254,9 @@ QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNormalLibs()
|
||||
return output;
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNativeLibs()
|
||||
QList<std::shared_ptr<RawLibrary> > MinecraftProfile::getActiveNativeLibs()
|
||||
{
|
||||
QList<std::shared_ptr<OneSixLibrary> > output;
|
||||
QList<std::shared_ptr<RawLibrary> > output;
|
||||
for (auto lib : libraries)
|
||||
{
|
||||
if (lib->isActive() && lib->isNative())
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QList>
|
||||
#include <memory>
|
||||
|
||||
#include "OneSixLibrary.h"
|
||||
#include "RawLibrary.h"
|
||||
#include "VersionFile.h"
|
||||
#include "JarMod.h"
|
||||
|
||||
@ -96,10 +96,10 @@ public:
|
||||
|
||||
public:
|
||||
/// get all java libraries that belong to the classpath
|
||||
QList<std::shared_ptr<OneSixLibrary>> getActiveNormalLibs();
|
||||
QList<RawLibraryPtr> getActiveNormalLibs();
|
||||
|
||||
/// get all native libraries that need to be available to the process
|
||||
QList<std::shared_ptr<OneSixLibrary>> getActiveNativeLibs();
|
||||
QList<RawLibraryPtr> getActiveNativeLibs();
|
||||
|
||||
/// get file ID of the patch file at #
|
||||
QString versionFileId(const int index) const;
|
||||
@ -171,10 +171,10 @@ public: /* data */
|
||||
QString appletClass;
|
||||
|
||||
/// the list of libs - both active and inactive, native and java
|
||||
QList<OneSixLibraryPtr> libraries;
|
||||
QList<RawLibraryPtr> libraries;
|
||||
|
||||
/// same, but only vanilla.
|
||||
QList<OneSixLibraryPtr> vanillaLibraries;
|
||||
QList<RawLibraryPtr> vanillaLibraries;
|
||||
|
||||
/// traits, collected from all the version files (version files can only add)
|
||||
QSet<QString> traits;
|
||||
|
@ -1,42 +0,0 @@
|
||||
/* Copyright 2013-2015 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <QJsonArray>
|
||||
|
||||
#include "OneSixLibrary.h"
|
||||
#include "OneSixRule.h"
|
||||
#include "OpSys.h"
|
||||
|
||||
OneSixLibrary::OneSixLibrary(RawLibraryPtr base)
|
||||
{
|
||||
m_name = base->m_name;
|
||||
m_base_url = base->m_base_url;
|
||||
m_hint = base->m_hint;
|
||||
m_absolute_url = base->m_absolute_url;
|
||||
extract_excludes = base->extract_excludes;
|
||||
m_native_classifiers = base->m_native_classifiers;
|
||||
m_rules = base->m_rules;
|
||||
m_storagePrefix = base->m_storagePrefix;
|
||||
// these only make sense for raw libraries. OneSix
|
||||
/*
|
||||
insertType = base->insertType;
|
||||
insertData = base->insertData;
|
||||
*/
|
||||
}
|
||||
|
||||
OneSixLibraryPtr OneSixLibrary::fromRawLibrary(RawLibraryPtr lib)
|
||||
{
|
||||
return OneSixLibraryPtr(new OneSixLibrary(lib));
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/* Copyright 2013-2015 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
#include <QJsonObject>
|
||||
#include <QDir>
|
||||
#include <memory>
|
||||
|
||||
#include "net/URLConstants.h"
|
||||
#include "minecraft/OpSys.h"
|
||||
#include "minecraft/RawLibrary.h"
|
||||
|
||||
class OneSixLibrary;
|
||||
typedef std::shared_ptr<OneSixLibrary> OneSixLibraryPtr;
|
||||
|
||||
/**
|
||||
* This is a leftover from a previous design.
|
||||
* All it does is separate the 'Raw' libraries read from files from the 'OneSix' libraries
|
||||
* used for actually doing things.
|
||||
*
|
||||
* DEPRECATED, but still useful to keep the data clean and separated by type.
|
||||
*/
|
||||
class OneSixLibrary : public RawLibrary
|
||||
{
|
||||
public:
|
||||
/// Constructor
|
||||
OneSixLibrary(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
/// Constructor
|
||||
OneSixLibrary(RawLibraryPtr base);
|
||||
static OneSixLibraryPtr fromRawLibrary(RawLibraryPtr lib);
|
||||
};
|
@ -27,7 +27,7 @@
|
||||
#include "BaseInstance.h"
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include "minecraft/MinecraftProfile.h"
|
||||
#include "minecraft/OneSixLibrary.h"
|
||||
#include "minecraft/RawLibrary.h"
|
||||
#include "minecraft/OneSixInstance.h"
|
||||
#include "forge/ForgeMirrors.h"
|
||||
#include "net/URLConstants.h"
|
||||
@ -213,7 +213,7 @@ void OneSixUpdate::jarlibStart()
|
||||
|
||||
auto metacache = ENV.metacache();
|
||||
QList<ForgeXzDownloadPtr> ForgeLibs;
|
||||
QList<std::shared_ptr<OneSixLibrary>> brokenLocalLibs;
|
||||
QList<RawLibraryPtr> brokenLocalLibs;
|
||||
|
||||
for (auto lib : libs)
|
||||
{
|
||||
|
@ -18,14 +18,36 @@ typedef std::shared_ptr<RawLibrary> RawLibraryPtr;
|
||||
|
||||
class RawLibrary
|
||||
{
|
||||
friend class OneSixLibrary;
|
||||
public: /* methods */
|
||||
public:
|
||||
RawLibrary()
|
||||
{
|
||||
}
|
||||
RawLibrary(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
/// limited copy without some data. TODO: why?
|
||||
static RawLibraryPtr limitedCopy(RawLibraryPtr base)
|
||||
{
|
||||
auto newlib = std::make_shared<RawLibrary>();
|
||||
newlib->m_name = base->m_name;
|
||||
newlib->m_base_url = base->m_base_url;
|
||||
newlib->m_hint = base->m_hint;
|
||||
newlib->m_absolute_url = base->m_absolute_url;
|
||||
newlib->extract_excludes = base->extract_excludes;
|
||||
newlib->m_native_classifiers = base->m_native_classifiers;
|
||||
newlib->m_rules = base->m_rules;
|
||||
newlib->m_storagePrefix = base->m_storagePrefix;
|
||||
return newlib;
|
||||
}
|
||||
|
||||
/// read and create a basic library
|
||||
static RawLibraryPtr fromJson(const QJsonObject &libObj, const QString &filename);
|
||||
|
||||
/// Convert the library back to an JSON object
|
||||
QJsonObject toJson() const;
|
||||
|
||||
public: /* methods */
|
||||
/// Returns the raw name field
|
||||
const GradleSpecifier & rawName() const
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "minecraft/VersionFile.h"
|
||||
#include "minecraft/OneSixLibrary.h"
|
||||
#include "minecraft/RawLibrary.h"
|
||||
#include "minecraft/MinecraftProfile.h"
|
||||
#include "minecraft/JarMod.h"
|
||||
#include "ParseUtils.h"
|
||||
@ -32,7 +32,7 @@ static QString readStringRet(const QJsonObject &root, const QString &key)
|
||||
return QString();
|
||||
}
|
||||
|
||||
int findLibraryByName(QList<OneSixLibraryPtr> haystack, const GradleSpecifier &needle)
|
||||
int findLibraryByName(QList<RawLibraryPtr> haystack, const GradleSpecifier &needle)
|
||||
{
|
||||
int retval = -1;
|
||||
for (int i = 0; i < haystack.size(); ++i)
|
||||
@ -379,10 +379,10 @@ void VersionFile::applyTo(MinecraftProfile *version)
|
||||
version->traits.unite(traits);
|
||||
if (shouldOverwriteLibs)
|
||||
{
|
||||
QList<OneSixLibraryPtr> libs;
|
||||
QList<RawLibraryPtr> libs;
|
||||
for (auto lib : overwriteLibs)
|
||||
{
|
||||
libs.append(OneSixLibrary::fromRawLibrary(lib));
|
||||
libs.append(RawLibrary::limitedCopy(lib));
|
||||
}
|
||||
if (isMinecraftVersion())
|
||||
{
|
||||
@ -397,14 +397,14 @@ void VersionFile::applyTo(MinecraftProfile *version)
|
||||
// library not found? just add it.
|
||||
if (index < 0)
|
||||
{
|
||||
version->libraries.append(OneSixLibrary::fromRawLibrary(addedLibrary));
|
||||
version->libraries.append(RawLibrary::limitedCopy(addedLibrary));
|
||||
continue;
|
||||
}
|
||||
auto existingLibrary = version->libraries.at(index);
|
||||
// if we are higher it means we should update
|
||||
if (Version(addedLibrary->version()) > Version(existingLibrary->version()))
|
||||
{
|
||||
auto library = OneSixLibrary::fromRawLibrary(addedLibrary);
|
||||
auto library = RawLibrary::limitedCopy(addedLibrary);
|
||||
version->libraries.replace(index, library);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "minecraft/OpSys.h"
|
||||
#include "minecraft/OneSixRule.h"
|
||||
#include "ProfilePatch.h"
|
||||
#include "OneSixLibrary.h"
|
||||
#include "RawLibrary.h"
|
||||
#include "JarMod.h"
|
||||
|
||||
class MinecraftProfile;
|
||||
|
Loading…
Reference in New Issue
Block a user