summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--logic/CMakeLists.txt2
-rw-r--r--logic/forge/ForgeInstaller.cpp8
-rw-r--r--logic/ftb/OneSixFTBInstance.cpp10
-rw-r--r--logic/ftb/OneSixFTBInstance.h2
-rw-r--r--logic/liteloader/LiteLoaderInstaller.cpp13
-rw-r--r--logic/minecraft/MinecraftProfile.cpp8
-rw-r--r--logic/minecraft/MinecraftProfile.h10
-rw-r--r--logic/minecraft/OneSixLibrary.cpp42
-rw-r--r--logic/minecraft/OneSixLibrary.h50
-rw-r--r--logic/minecraft/OneSixUpdate.cpp4
-rw-r--r--logic/minecraft/RawLibrary.h26
-rw-r--r--logic/minecraft/VersionFile.cpp12
-rw-r--r--logic/minecraft/VersionFile.h2
13 files changed, 55 insertions, 134 deletions
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 <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);
}
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<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())
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 <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;
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 <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));
-}
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 <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);
-};
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<ForgeXzDownloadPtr> ForgeLibs;
- QList<std::shared_ptr<OneSixLibrary>> brokenLocalLibs;
+ QList<RawLibraryPtr> 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<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
{
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 <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);
}
}
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;