From 71e4b147ec3b8c5f3e2a004920ffbc0a3b6e18c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 26 Feb 2016 02:04:21 +0100 Subject: NOISSUE remove OneSixLibrary --- logic/CMakeLists.txt | 2 -- logic/forge/ForgeInstaller.cpp | 8 ++--- logic/ftb/OneSixFTBInstance.cpp | 10 +++---- logic/ftb/OneSixFTBInstance.h | 2 -- logic/liteloader/LiteLoaderInstaller.cpp | 13 +++------ logic/minecraft/MinecraftProfile.cpp | 8 ++--- logic/minecraft/MinecraftProfile.h | 10 +++---- logic/minecraft/OneSixLibrary.cpp | 42 --------------------------- logic/minecraft/OneSixLibrary.h | 50 -------------------------------- logic/minecraft/OneSixUpdate.cpp | 4 +-- logic/minecraft/RawLibrary.h | 26 +++++++++++++++-- logic/minecraft/VersionFile.cpp | 12 ++++---- logic/minecraft/VersionFile.h | 2 +- 13 files changed, 55 insertions(+), 134 deletions(-) delete mode 100644 logic/minecraft/OneSixLibrary.cpp delete mode 100644 logic/minecraft/OneSixLibrary.h (limited to 'logic') diff --git a/logic/CMakeLists.txt b/logic/CMakeLists.txt index 9a87dcab..0a6cbbf6 100644 --- a/logic/CMakeLists.txt +++ b/logic/CMakeLists.txt @@ -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 diff --git a/logic/forge/ForgeInstaller.cpp b/logic/forge/ForgeInstaller.cpp index cdbb5f18..78acb8d4 100644 --- a/logic/forge/ForgeInstaller.cpp +++ b/logic/forge/ForgeInstaller.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; diff --git a/logic/ftb/OneSixFTBInstance.cpp b/logic/ftb/OneSixFTBInstance.cpp index ebe421e0..54a3d2bd 100644 --- a/logic/ftb/OneSixFTBInstance.cpp +++ b/logic/ftb/OneSixFTBInstance.cpp @@ -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); } } } diff --git a/logic/ftb/OneSixFTBInstance.h b/logic/ftb/OneSixFTBInstance.h index 35d8216b..add6b51c 100644 --- a/logic/ftb/OneSixFTBInstance.h +++ b/logic/ftb/OneSixFTBInstance.h @@ -2,8 +2,6 @@ #include "minecraft/OneSixInstance.h" -class OneSixLibrary; - class OneSixFTBInstance : public OneSixInstance { Q_OBJECT diff --git a/logic/liteloader/LiteLoaderInstaller.cpp b/logic/liteloader/LiteLoaderInstaller.cpp index 28be614a..555d16c1 100644 --- a/logic/liteloader/LiteLoaderInstaller.cpp +++ b/logic/liteloader/LiteLoaderInstaller.cpp @@ -21,7 +21,7 @@ #include #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); } diff --git a/logic/minecraft/MinecraftProfile.cpp b/logic/minecraft/MinecraftProfile.cpp index 360fa575..379705a7 100644 --- a/logic/minecraft/MinecraftProfile.cpp +++ b/logic/minecraft/MinecraftProfile.cpp @@ -233,9 +233,9 @@ bool MinecraftProfile::revertToVanilla() return true; } -QList > MinecraftProfile::getActiveNormalLibs() +QList > MinecraftProfile::getActiveNormalLibs() { - QList > output; + QList > output; for (auto lib : libraries) { if (lib->isActive() && !lib->isNative()) @@ -254,9 +254,9 @@ QList > MinecraftProfile::getActiveNormalLibs() return output; } -QList > MinecraftProfile::getActiveNativeLibs() +QList > MinecraftProfile::getActiveNativeLibs() { - QList > output; + QList > output; for (auto lib : libraries) { if (lib->isActive() && lib->isNative()) diff --git a/logic/minecraft/MinecraftProfile.h b/logic/minecraft/MinecraftProfile.h index 7686c55b..a9b3c299 100644 --- a/logic/minecraft/MinecraftProfile.h +++ b/logic/minecraft/MinecraftProfile.h @@ -21,7 +21,7 @@ #include #include -#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> getActiveNormalLibs(); + QList getActiveNormalLibs(); /// get all native libraries that need to be available to the process - QList> getActiveNativeLibs(); + QList 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 libraries; + QList libraries; /// same, but only vanilla. - QList vanillaLibraries; + QList vanillaLibraries; /// traits, collected from all the version files (version files can only add) QSet traits; diff --git a/logic/minecraft/OneSixLibrary.cpp b/logic/minecraft/OneSixLibrary.cpp deleted file mode 100644 index fe94d817..00000000 --- a/logic/minecraft/OneSixLibrary.cpp +++ /dev/null @@ -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 - -#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)); -} diff --git a/logic/minecraft/OneSixLibrary.h b/logic/minecraft/OneSixLibrary.h deleted file mode 100644 index e0ca52a8..00000000 --- a/logic/minecraft/OneSixLibrary.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include - -#include "net/URLConstants.h" -#include "minecraft/OpSys.h" -#include "minecraft/RawLibrary.h" - -class OneSixLibrary; -typedef std::shared_ptr 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); -}; diff --git a/logic/minecraft/OneSixUpdate.cpp b/logic/minecraft/OneSixUpdate.cpp index 75a16824..5babb0b6 100644 --- a/logic/minecraft/OneSixUpdate.cpp +++ b/logic/minecraft/OneSixUpdate.cpp @@ -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 ForgeLibs; - QList> brokenLocalLibs; + QList brokenLocalLibs; for (auto lib : libs) { diff --git a/logic/minecraft/RawLibrary.h b/logic/minecraft/RawLibrary.h index efe51bc0..7f0aed2f 100644 --- a/logic/minecraft/RawLibrary.h +++ b/logic/minecraft/RawLibrary.h @@ -18,14 +18,36 @@ typedef std::shared_ptr 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(); + 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 { diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp index 2bc08d20..e0b4aa85 100644 --- a/logic/minecraft/VersionFile.cpp +++ b/logic/minecraft/VersionFile.cpp @@ -4,7 +4,7 @@ #include #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 haystack, const GradleSpecifier &needle) +int findLibraryByName(QList 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 libs; + QList 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); } } diff --git a/logic/minecraft/VersionFile.h b/logic/minecraft/VersionFile.h index ab94348b..56877936 100644 --- a/logic/minecraft/VersionFile.h +++ b/logic/minecraft/VersionFile.h @@ -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; -- cgit v1.2.3