NOISSUE jar mods as libraries, fix for customizing net.minecraft

This commit is contained in:
Petr Mrázek 2017-04-17 22:51:30 +02:00
parent fc28aacdea
commit c4c8e99681
15 changed files with 187 additions and 86 deletions

View File

@ -249,7 +249,6 @@ set(MINECRAFT_SOURCES
minecraft/MinecraftProfile.h minecraft/MinecraftProfile.h
minecraft/MojangVersionFormat.cpp minecraft/MojangVersionFormat.cpp
minecraft/MojangVersionFormat.h minecraft/MojangVersionFormat.h
minecraft/JarMod.h
minecraft/MinecraftInstance.cpp minecraft/MinecraftInstance.cpp
minecraft/MinecraftInstance.h minecraft/MinecraftInstance.h
minecraft/Rule.cpp minecraft/Rule.cpp

View File

@ -65,13 +65,22 @@ struct GradleSpecifier
filename += "." + m_extension; filename += "." + m_extension;
return filename; return filename;
} }
QString toPath() const QString toPath(const QString & filenameOverride = QString()) const
{ {
if(!m_valid) if(!m_valid)
return "INVALID"; return "INVALID";
QString filename;
if(filenameOverride.isEmpty())
{
filename = getFileName();
}
else
{
filename = filenameOverride;
}
QString path = m_groupId; QString path = m_groupId;
path.replace('.', '/'); path.replace('.', '/');
path += '/' + m_artifactId + '/' + m_version + '/' + getFileName(); path += '/' + m_artifactId + '/' + m_version + '/' + filename;
return path; return path;
} }
inline bool valid() const inline bool valid() const

View File

@ -1,12 +0,0 @@
#pragma once
#include <QString>
#include <QJsonObject>
#include <memory>
class Jarmod;
typedef std::shared_ptr<Jarmod> JarmodPtr;
class Jarmod
{
public: /* data */
QString name;
QString originalName;
};

View File

@ -11,11 +11,11 @@
void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32, void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32,
QStringList& native64, const QString &overridePath) const QStringList& native64, const QString &overridePath) const
{ {
bool isLocal = (hint() == "local"); bool local = isLocal();
auto actualPath = [&](QString relPath) auto actualPath = [&](QString relPath)
{ {
QFileInfo out(FS::PathCombine(storagePrefix(), relPath)); QFileInfo out(FS::PathCombine(storagePrefix(), relPath));
if(isLocal && !overridePath.isEmpty()) if(local && !overridePath.isEmpty())
{ {
QString fileName = out.fileName(); QString fileName = out.fileName();
auto fullPath = FS::PathCombine(overridePath, fileName); auto fullPath = FS::PathCombine(overridePath, fileName);
@ -56,7 +56,7 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
{ {
QList<NetActionPtr> out; QList<NetActionPtr> out;
bool isAlwaysStale = (hint() == "always-stale"); bool isAlwaysStale = (hint() == "always-stale");
bool isLocal = (hint() == "local"); bool local = isLocal();
bool isForge = (hint() == "forge-pack-xz"); bool isForge = (hint() == "forge-pack-xz");
auto add_download = [&](QString storage, QString url, QString sha1 = QString()) auto add_download = [&](QString storage, QString url, QString sha1 = QString())
@ -68,7 +68,7 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
} }
if (!entry->isStale()) if (!entry->isStale())
return true; return true;
if(isLocal) if(local)
{ {
if(!overridePath.isEmpty()) if(!overridePath.isEmpty())
{ {
@ -228,6 +228,11 @@ bool Library::isActive() const
return result; return result;
} }
bool Library::isLocal() const
{
return m_hint == "local";
}
void Library::setStoragePrefix(QString prefix) void Library::setStoragePrefix(QString prefix)
{ {
m_storagePrefix = prefix; m_storagePrefix = prefix;
@ -247,12 +252,16 @@ QString Library::storagePrefix() const
return m_storagePrefix; return m_storagePrefix;
} }
QString Library::storageSuffix(OpSys system) const QString Library::filename(OpSys system) const
{ {
if(!m_filename.isEmpty())
{
return m_filename;
}
// non-native? use only the gradle specifier // non-native? use only the gradle specifier
if (!isNative()) if (!isNative())
{ {
return m_name.toPath(); return m_name.getFileName();
} }
// otherwise native, override classifiers. Mojang HACK! // otherwise native, override classifiers. Mojang HACK!
@ -265,5 +274,33 @@ QString Library::storageSuffix(OpSys system) const
{ {
nativeSpec.setClassifier("INVALID"); nativeSpec.setClassifier("INVALID");
} }
return nativeSpec.toPath(); return nativeSpec.getFileName();
}
QString Library::displayName(OpSys system) const
{
if(!m_displayname.isEmpty())
return m_displayname;
return filename(system);
}
QString Library::storageSuffix(OpSys system) const
{
// non-native? use only the gradle specifier
if (!isNative())
{
return m_name.toPath(m_filename);
}
// otherwise native, override classifiers. Mojang HACK!
GradleSpecifier nativeSpec = m_name;
if (m_nativeClassifiers.contains(system))
{
nativeSpec.setClassifier(m_nativeClassifiers[system]);
}
else
{
nativeSpec.setClassifier("INVALID");
}
return nativeSpec.toPath(m_filename);
} }

View File

@ -48,6 +48,7 @@ public:
newlib->m_rules = base->m_rules; newlib->m_rules = base->m_rules;
newlib->m_storagePrefix = base->m_storagePrefix; newlib->m_storagePrefix = base->m_storagePrefix;
newlib->m_mojangDownloads = base->m_mojangDownloads; newlib->m_mojangDownloads = base->m_mojangDownloads;
newlib->m_filename = base->m_filename;
return newlib; return newlib;
} }
@ -108,6 +109,23 @@ public: /* methods */
m_absoluteURL = absolute_url; m_absoluteURL = absolute_url;
} }
void setFilename(const QString &filename)
{
m_filename = filename;
}
/// Get the file name of the library
QString filename(OpSys system) const;
// DEPRECATED: set a display name, used by jar mods only
void setDisplayName(const QString & displayName)
{
m_displayname = displayName;
}
/// Get the file name of the library
QString displayName(OpSys system) const;
void setMojangDownloadInfo(MojangLibraryDownloadInfo::Ptr info) void setMojangDownloadInfo(MojangLibraryDownloadInfo::Ptr info)
{ {
m_mojangDownloads = info; m_mojangDownloads = info;
@ -127,6 +145,9 @@ public: /* methods */
/// Returns true if the library should be loaded (or extracted, in case of natives) /// Returns true if the library should be loaded (or extracted, in case of natives)
bool isActive() const; bool isActive() const;
/// Returns true if the library is contained in an instance and false if it is shared
bool isLocal() const;
// Get a list of downloads for this library // Get a list of downloads for this library
QList<NetActionPtr> getDownloads(OpSys system, class HttpMetaCache * cache, QList<NetActionPtr> getDownloads(OpSys system, class HttpMetaCache * cache,
QStringList & failedFiles, const QString & overridePath) const; QStringList & failedFiles, const QString & overridePath) const;
@ -138,7 +159,7 @@ private: /* methods */
/// Get the prefix - root of the storage to be used /// Get the prefix - root of the storage to be used
QString storagePrefix() const; QString storagePrefix() const;
/// Get the relative path where the library should be saved /// Get the relative file path where the library should be saved
QString storageSuffix(OpSys system) const; QString storageSuffix(OpSys system) const;
QString hint() const QString hint() const
@ -156,6 +177,12 @@ protected: /* data */
/// DEPRECATED: MultiMC-specific absolute URL. takes precedence over the implicit maven repo URL, if defined /// DEPRECATED: MultiMC-specific absolute URL. takes precedence over the implicit maven repo URL, if defined
QString m_absoluteURL; QString m_absoluteURL;
/// MultiMC extension - filename override
QString m_filename;
/// DEPRECATED MultiMC extension - display name
QString m_displayname;
/** /**
* MultiMC-specific type hint - modifies how the library is treated * MultiMC-specific type hint - modifies how the library is treated
*/ */

View File

@ -79,7 +79,7 @@ void MinecraftProfile::clear()
m_libraries.clear(); m_libraries.clear();
m_traits.clear(); m_traits.clear();
m_jarMods.clear(); m_jarMods.clear();
mojangDownloads.clear(); m_mainJar.reset();
m_problemSeverity = ProblemSeverity::None; m_problemSeverity = ProblemSeverity::None;
} }
@ -437,18 +437,6 @@ void MinecraftProfile::applyMinecraftAssets(MojangAssetIndexInfo::Ptr assets)
} }
} }
void MinecraftProfile::applyMojangDownload(const QString &key, MojangDownloadInfo::Ptr download)
{
if(download)
{
mojangDownloads[key] = download;
}
else
{
mojangDownloads.remove(key);
}
}
void MinecraftProfile::applyTraits(const QSet<QString>& traits) void MinecraftProfile::applyTraits(const QSet<QString>& traits)
{ {
this->m_traits.unite(traits); this->m_traits.unite(traits);
@ -464,7 +452,7 @@ void MinecraftProfile::applyTweakers(const QStringList& tweakers)
} }
} }
void MinecraftProfile::applyJarMods(const QList<JarmodPtr>& jarMods) void MinecraftProfile::applyJarMods(const QList<LibraryPtr>& jarMods)
{ {
this->m_jarMods.append(jarMods); this->m_jarMods.append(jarMods);
} }
@ -593,7 +581,7 @@ QString MinecraftProfile::getMinecraftArguments() const
return m_minecraftArguments; return m_minecraftArguments;
} }
const QList<JarmodPtr> & MinecraftProfile::getJarMods() const const QList<LibraryPtr> & MinecraftProfile::getJarMods() const
{ {
return m_jarMods; return m_jarMods;
} }

View File

@ -23,7 +23,6 @@
#include "Library.h" #include "Library.h"
#include "ProfilePatch.h" #include "ProfilePatch.h"
#include "JarMod.h"
#include "BaseVersion.h" #include "BaseVersion.h"
#include "MojangDownloadInfo.h" #include "MojangDownloadInfo.h"
@ -99,11 +98,10 @@ public: /* application of profile variables from patches */
void applyMinecraftAssets(MojangAssetIndexInfo::Ptr assets); void applyMinecraftAssets(MojangAssetIndexInfo::Ptr assets);
void applyTraits(const QSet<QString> &traits); void applyTraits(const QSet<QString> &traits);
void applyTweakers(const QStringList &tweakers); void applyTweakers(const QStringList &tweakers);
void applyJarMods(const QList<JarmodPtr> &jarMods); void applyJarMods(const QList<LibraryPtr> &jarMods);
void applyLibrary(LibraryPtr library); void applyLibrary(LibraryPtr library);
void applyMainJar(LibraryPtr jar); void applyMainJar(LibraryPtr jar);
void applyProblemSeverity(ProblemSeverity severity); void applyProblemSeverity(ProblemSeverity severity);
void applyMojangDownload(const QString & key, MojangDownloadInfo::Ptr download);
public: /* getters for profile variables */ public: /* getters for profile variables */
QString getMinecraftVersion() const; QString getMinecraftVersion() const;
@ -114,7 +112,7 @@ public: /* getters for profile variables */
QString getMinecraftArguments() const; QString getMinecraftArguments() const;
const QSet<QString> & getTraits() const; const QSet<QString> & getTraits() const;
const QStringList & getTweakers() const; const QStringList & getTweakers() const;
const QList<JarmodPtr> & getJarMods() const; const QList<LibraryPtr> & getJarMods() const;
const QList<LibraryPtr> & getLibraries() const; const QList<LibraryPtr> & getLibraries() const;
const QList<LibraryPtr> & getNativeLibraries() const; const QList<LibraryPtr> & getNativeLibraries() const;
const LibraryPtr getMainJar() const; const LibraryPtr getMainJar() const;
@ -149,9 +147,6 @@ private: /* data */
/// Assets type - "legacy" or a version ID /// Assets type - "legacy" or a version ID
MojangAssetIndexInfo::Ptr m_minecraftAssets; MojangAssetIndexInfo::Ptr m_minecraftAssets;
// Mojang: list of 'downloads' - client jar, server jar, windows server exe, maybe more.
QMap <QString, std::shared_ptr<MojangDownloadInfo>> mojangDownloads;
/** /**
* arguments that should be used for launching minecraft * arguments that should be used for launching minecraft
* *
@ -182,7 +177,7 @@ private: /* data */
QSet<QString> m_traits; QSet<QString> m_traits;
/// A list of jar mods. version files can add those. /// A list of jar mods. version files can add those.
QList<JarmodPtr> m_jarMods; QList<LibraryPtr> m_jarMods;
ProblemSeverity m_problemSeverity = ProblemSeverity::None; ProblemSeverity m_problemSeverity = ProblemSeverity::None;

View File

@ -4,7 +4,6 @@
#include <QList> #include <QList>
#include <QJsonDocument> #include <QJsonDocument>
#include <QDateTime> #include <QDateTime>
#include "JarMod.h"
#include "ProblemProvider.h" #include "ProblemProvider.h"
class MinecraftProfile; class MinecraftProfile;

View File

@ -6,7 +6,6 @@
#include "minecraft/VersionFile.h" #include "minecraft/VersionFile.h"
#include "minecraft/Library.h" #include "minecraft/Library.h"
#include "minecraft/MinecraftProfile.h" #include "minecraft/MinecraftProfile.h"
#include "minecraft/JarMod.h"
#include "ParseUtils.h" #include "ParseUtils.h"
#include "VersionBuildError.h" #include "VersionBuildError.h"
@ -43,12 +42,6 @@ void VersionFile::applyTo(MinecraftProfile *profile)
profile->applyLibrary(library); profile->applyLibrary(library);
} }
profile->applyProblemSeverity(getProblemSeverity()); profile->applyProblemSeverity(getProblemSeverity());
auto iter = mojangDownloads.begin();
while(iter != mojangDownloads.end())
{
profile->applyMojangDownload(iter.key(), iter.value());
iter++;
}
} }
/* /*

View File

@ -10,7 +10,6 @@
#include "minecraft/Rule.h" #include "minecraft/Rule.h"
#include "ProblemProvider.h" #include "ProblemProvider.h"
#include "Library.h" #include "Library.h"
#include "JarMod.h"
class MinecraftProfile; class MinecraftProfile;
class VersionFile; class VersionFile;
@ -84,7 +83,7 @@ public: /* data */
QSet<QString> traits; QSet<QString> traits;
/// MultiMC: list of jar mods added to this version /// MultiMC: list of jar mods added to this version
QList<JarmodPtr> jarMods; QList<LibraryPtr> jarMods;
public: public:
// Mojang: DEPRECATED list of 'downloads' - client jar, server jar, windows server exe, maybe more. // Mojang: DEPRECATED list of 'downloads' - client jar, server jar, windows server exe, maybe more.

View File

@ -314,7 +314,16 @@ QStringList OneSixInstance::verboseDescription(AuthSessionPtr session)
out << "Jar Mods:"; out << "Jar Mods:";
for(auto & jarmod: jarMods) for(auto & jarmod: jarMods)
{ {
out << " " + jarmod->originalName + " (" + jarmod->name + ")"; auto displayname = jarmod->displayName(currentSystem);
auto realname = jarmod->filename(currentSystem);
if(displayname != realname)
{
out << " " + displayname + " (" + realname + ")";
}
else
{
out << " " + realname;
}
} }
out << ""; out << "";
} }
@ -521,8 +530,10 @@ QList< Mod > OneSixInstance::getJarMods() const
QList<Mod> mods; QList<Mod> mods;
for (auto jarmod : m_profile->getJarMods()) for (auto jarmod : m_profile->getJarMods())
{ {
QString filePath = jarmodsPath().absoluteFilePath(jarmod->name); QStringList jar, temp1, temp2, temp3;
mods.push_back(Mod(QFileInfo(filePath))); jarmod->getApplicableFiles(currentSystem, jar, temp1, temp2, temp3, jarmodsPath().absolutePath());
// QString filePath = jarmodsPath().absoluteFilePath(jarmod->filename(currentSystem));
mods.push_back(Mod(QFileInfo(jar[0])));
} }
return mods; return mods;
} }

View File

@ -248,16 +248,22 @@ bool OneSixProfileStrategy::removePatch(ProfilePatchPtr patch)
m_instance->setComponentVersion(patch->getID(), QString()); m_instance->setComponentVersion(patch->getID(), QString());
} }
auto preRemoveJarMod = [&](JarmodPtr jarMod) -> bool // FIXME: we need a generic way of removing local resources, not just jar mods...
auto preRemoveJarMod = [&](LibraryPtr jarMod) -> bool
{ {
QString fullpath = FS::PathCombine(m_instance->jarModsDir(), jarMod->name); if (!jarMod->isLocal())
QFileInfo finfo (fullpath); {
return true;
}
QStringList jar, temp1, temp2, temp3;
jarMod->getApplicableFiles(currentSystem, jar, temp1, temp2, temp3, m_instance->jarmodsPath().absolutePath());
QFileInfo finfo (jar[0]);
if(finfo.exists()) if(finfo.exists())
{ {
QFile jarModFile(fullpath); QFile jarModFile(jar[0]);
if(!jarModFile.remove()) if(!jarModFile.remove())
{ {
qCritical() << "File" << fullpath << "could not be removed because:" << jarModFile.errorString(); qCritical() << "File" << jar[0] << "could not be removed because:" << jarModFile.errorString();
return false; return false;
} }
return true; return true;
@ -381,9 +387,11 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths)
} }
auto f = std::make_shared<VersionFile>(); auto f = std::make_shared<VersionFile>();
auto jarMod = std::make_shared<Jarmod>(); auto jarMod = std::make_shared<Library>();
jarMod->name = target_filename; jarMod->setRawName(GradleSpecifier("org.multimc.jarmods:" + id + ":1"));
jarMod->originalName = sourceInfo.completeBaseName(); jarMod->setFilename(target_filename);
jarMod->setDisplayName(sourceInfo.completeBaseName());
jarMod->setHint("local");
f->jarMods.append(jarMod); f->jarMods.append(jarMod);
f->name = target_name; f->name = target_name;
f->uid = target_id; f->uid = target_id;

View File

@ -20,6 +20,8 @@ LibraryPtr OneSixVersionFormat::libraryFromJson(const QJsonObject &libObj, const
readString(libObj, "MMC-hint", out->m_hint); readString(libObj, "MMC-hint", out->m_hint);
readString(libObj, "MMC-absulute_url", out->m_absoluteURL); readString(libObj, "MMC-absulute_url", out->m_absoluteURL);
readString(libObj, "MMC-absoluteUrl", out->m_absoluteURL); readString(libObj, "MMC-absoluteUrl", out->m_absoluteURL);
readString(libObj, "MMC-filename", out->m_filename);
readString(libObj, "MMC-displayname", out->m_displayname);
return out; return out;
} }
@ -30,6 +32,10 @@ QJsonObject OneSixVersionFormat::libraryToJson(Library *library)
libRoot.insert("MMC-absoluteUrl", library->m_absoluteURL); libRoot.insert("MMC-absoluteUrl", library->m_absoluteURL);
if (library->m_hint.size()) if (library->m_hint.size())
libRoot.insert("MMC-hint", library->m_hint); libRoot.insert("MMC-hint", library->m_hint);
if (library->m_filename.size())
libRoot.insert("MMC-filename", library->m_filename);
if (library->m_displayname.size())
libRoot.insert("MMC-displayname", library->m_displayname);
return libRoot; return libRoot;
} }
@ -96,13 +102,25 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
} }
} }
if (root.contains("+jarMods"))
if (root.contains("jarMods"))
{
for (auto libVal : requireArray(root.value("jarMods")))
{
QJsonObject libObj = requireObject(libVal);
// parse the jarmod
auto lib = OneSixVersionFormat::jarModFromJson(libObj, filename);
// and add to jar mods
out->jarMods.append(lib);
}
}
else if (root.contains("+jarMods")) // DEPRECATED: old style '+jarMods' are only here for backwards compatibility
{ {
for (auto libVal : requireArray(root.value("+jarMods"))) for (auto libVal : requireArray(root.value("+jarMods")))
{ {
QJsonObject libObj = requireObject(libVal); QJsonObject libObj = requireObject(libVal);
// parse the jarmod // parse the jarmod
auto lib = OneSixVersionFormat::jarModFromJson(libObj, filename, out->name); auto lib = OneSixVersionFormat::plusJarModFromJson(libObj, filename, out->name);
// and add to jar mods // and add to jar mods
out->jarMods.append(lib); out->jarMods.append(lib);
} }
@ -197,13 +215,16 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
writeString(root, "name", patch->name); writeString(root, "name", patch->name);
writeString(root, "uid", patch->uid); writeString(root, "uid", patch->uid);
writeString(root, "fileId", patch->uid);
writeString(root, "version", patch->version); writeString(root, "version", patch->version);
writeString(root, "mcVersion", patch->dependsOnMinecraftVersion); writeString(root, "mcVersion", patch->dependsOnMinecraftVersion);
MojangVersionFormat::writeVersionProperties(patch.get(), root); MojangVersionFormat::writeVersionProperties(patch.get(), root);
if(patch->mainJar)
{
root.insert("mainJar", libraryToJson(patch->mainJar.get()));
}
writeString(root, "appletClass", patch->appletClass); writeString(root, "appletClass", patch->appletClass);
writeStringList(root, "+tweakers", patch->addTweakers); writeStringList(root, "+tweakers", patch->addTweakers);
writeStringList(root, "+traits", patch->traits.toList()); writeStringList(root, "+traits", patch->traits.toList());
@ -214,7 +235,7 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
{ {
array.append(OneSixVersionFormat::libraryToJson(value.get())); array.append(OneSixVersionFormat::libraryToJson(value.get()));
} }
root.insert("+libraries", array); root.insert("libraries", array);
} }
if (!patch->jarMods.isEmpty()) if (!patch->jarMods.isEmpty())
{ {
@ -223,7 +244,7 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
{ {
array.append(OneSixVersionFormat::jarModtoJson(value.get())); array.append(OneSixVersionFormat::jarModtoJson(value.get()));
} }
root.insert("+jarMods", array); root.insert("jarMods", array);
} }
// write the contents to a json document. // write the contents to a json document.
{ {
@ -233,32 +254,55 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
} }
} }
JarmodPtr OneSixVersionFormat::jarModFromJson(const QJsonObject &libObj, const QString &filename, const QString &originalName) LibraryPtr OneSixVersionFormat::plusJarModFromJson(const QJsonObject &libObj, const QString &filename, const QString &originalName)
{ {
JarmodPtr out(new Jarmod()); LibraryPtr out(new Library());
if (!libObj.contains("name")) if (!libObj.contains("name"))
{ {
throw JSONValidationError(filename + throw JSONValidationError(filename +
"contains a jarmod that doesn't have a 'name' field"); "contains a jarmod that doesn't have a 'name' field");
} }
out->name = libObj.value("name").toString();
out->originalName = libObj.value("originalName").toString(); // just make up something unique on the spot for the library name.
if(out->originalName.isEmpty()) auto uuid = QUuid::createUuid();
QString id = uuid.toString().remove('{').remove('}');
// filename override is the old name
out->setFilename(libObj.value("name").toString());
// it needs to be local, it is stored in the instance jarmods folder
out->setHint("local");
// read the original name if present - some versions did not set it
// it is the original jar mod filename before it got renamed at the point of addition
auto displayName = libObj.value("originalName").toString();
if(displayName.isEmpty())
{ {
auto fixed = originalName; auto fixed = originalName;
fixed.remove(" (jar mod)"); fixed.remove(" (jar mod)");
out->originalName = originalName; out->setDisplayName(fixed);
}
else
{
out->setDisplayName(displayName);
} }
return out; return out;
} }
QJsonObject OneSixVersionFormat::jarModtoJson(Jarmod *jarmod) LibraryPtr OneSixVersionFormat::jarModFromJson(const QJsonObject& libObj, const QString& filename)
{ {
QJsonObject out; auto lib = libraryFromJson(libObj, filename);
writeString(out, "name", jarmod->name); return lib;
if(!jarmod->originalName.isEmpty()) }
QJsonObject OneSixVersionFormat::jarModtoJson(Library *jarmod)
{
QJsonObject out = libraryToJson(jarmod);
if(!jarmod->m_displayname.isEmpty())
{ {
writeString(out, "originalName", jarmod->originalName); writeString(out, "originalName", jarmod->m_displayname);
} }
return out; return out;
} }

View File

@ -16,7 +16,10 @@ public:
static LibraryPtr libraryFromJson(const QJsonObject &libObj, const QString &filename); static LibraryPtr libraryFromJson(const QJsonObject &libObj, const QString &filename);
static QJsonObject libraryToJson(Library *library); static QJsonObject libraryToJson(Library *library);
// jar mods // DEPRECATED: old 'plus' jar mods generated by the application
static JarmodPtr jarModFromJson(const QJsonObject &libObj, const QString &filename, const QString &originalName); static LibraryPtr plusJarModFromJson(const QJsonObject &libObj, const QString &filename, const QString &originalName);
static QJsonObject jarModtoJson(Jarmod * jarmod);
// new jar mods derived from libraries
static LibraryPtr jarModFromJson(const QJsonObject &libObj, const QString &filename);
static QJsonObject jarModtoJson(Library * jarmod);
}; };

View File

@ -50,6 +50,7 @@ void LibrariesTask::executeTask()
}; };
createJobs(profile->getLibraries()); createJobs(profile->getLibraries());
createJobs(profile->getNativeLibraries()); createJobs(profile->getNativeLibraries());
createJobs(profile->getJarMods());
createJob(profile->getMainJar()); createJob(profile->getMainJar());
// FIXME: this is never filled!!!! // FIXME: this is never filled!!!!