NOISSUE consider classifier when comparing library names

This commit is contained in:
Petr Mrázek 2023-09-01 23:13:03 +02:00
parent 33a8b916a1
commit 9ec1d43565
11 changed files with 22 additions and 23 deletions

View File

@ -56,10 +56,10 @@ static VersionPtr parseCommonVersion(const QString &uid, const QJsonObject &obj)
version->setType(ensureString(obj, "type", QString()));
version->setRecommended(ensureBoolean(obj, QString("recommended"), false));
version->setVolatile(ensureBoolean(obj, QString("volatile"), false));
RequireSet requires, conflicts;
parseRequires(obj, &requires, "requires");
RequireSet depends, conflicts;
parseRequires(obj, &depends, "requires");
parseRequires(obj, &conflicts, "conflicts");
version->setRequires(requires, conflicts);
version->setRequires(depends, conflicts);
return version;
}
@ -176,7 +176,6 @@ void parseRequires(const QJsonObject& obj, RequireSet* ptr, const char * keyName
{
if(obj.contains(keyName))
{
QSet<QString> requires;
auto reqArray = requireArray(obj, keyName);
auto iter = reqArray.begin();
while(iter != reqArray.end())

View File

@ -111,9 +111,9 @@ void Meta::Version::setTime(const qint64 time)
emit timeChanged();
}
void Meta::Version::setRequires(const Meta::RequireSet &requires, const Meta::RequireSet &conflicts)
void Meta::Version::setRequires(const Meta::RequireSet &depends, const Meta::RequireSet &conflicts)
{
m_requires = requires;
m_requires = depends;
m_conflicts = conflicts;
emit requiresChanged();
}

View File

@ -61,7 +61,7 @@ public: /* con/des */
{
return m_time;
}
const Meta::RequireSet &requires() const
const Meta::RequireSet &depends() const
{
return m_requires;
}
@ -87,7 +87,7 @@ public: /* con/des */
public: // for usage by format parsers only
void setType(const QString &type);
void setTime(const qint64 time);
void setRequires(const Meta::RequireSet &requires, const Meta::RequireSet &conflicts);
void setRequires(const Meta::RequireSet &depends, const Meta::RequireSet &conflicts);
void setVolatile(bool volatile_);
void setRecommended(bool recommended);
void setProvidesRecommendations();

View File

@ -77,7 +77,7 @@ QVariant VersionList::data(const QModelIndex &index, int role) const
case ParentVersionRole:
{
// FIXME: HACK: this should be generic and be replaced by something else. Anything that is a hard 'equals' dep is a 'parent uid'.
auto & reqs = version->requires();
auto & reqs = version->depends();
auto iter = std::find_if(reqs.begin(), reqs.end(), [](const Require & req)
{
return req.uid == "net.minecraft";
@ -92,7 +92,7 @@ QVariant VersionList::data(const QModelIndex &index, int role) const
case UidRole: return version->uid();
case TimeRole: return version->time();
case RequiresRole: return QVariant::fromValue(version->requires());
case RequiresRole: return QVariant::fromValue(version->depends());
case SortRole: return version->rawTime();
case VersionPtrRole: return QVariant::fromValue(version);
case RecommendedRole: return version->isRecommended();

View File

@ -416,9 +416,9 @@ void Component::updateCachedData()
m_cachedVolatile = file->m_volatile;
changed = true;
}
if(!deepCompare(m_cachedRequires, file->requires))
if(!deepCompare(m_cachedRequires, file->depends))
{
m_cachedRequires = file->requires;
m_cachedRequires = file->depends;
changed = true;
}
if(!deepCompare(m_cachedConflicts, file->conflicts))

View File

@ -124,7 +124,7 @@ struct GradleSpecifier
}
bool matchName(const GradleSpecifier & other) const
{
return other.artifactId() == artifactId() && other.groupId() == groupId();
return other.artifactId() == artifactId() && other.groupId() == groupId() && other.classifier() == classifier();
}
bool operator==(const GradleSpecifier & other) const
{

View File

@ -207,7 +207,7 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
if (root.contains("requires"))
{
Meta::parseRequires(root, &out->requires);
Meta::parseRequires(root, &out->depends);
}
QString dependsOnMinecraftVersion = root.value("mcVersion").toString();
if(!dependsOnMinecraftVersion.isEmpty())
@ -215,9 +215,9 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
Meta::Require mcReq;
mcReq.uid = "net.minecraft";
mcReq.equalsVersion = dependsOnMinecraftVersion;
if (out->requires.count(mcReq) == 0)
if (out->depends.count(mcReq) == 0)
{
out->requires.insert(mcReq);
out->depends.insert(mcReq);
}
}
if (root.contains("conflicts"))
@ -309,9 +309,9 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
}
root.insert("mods", array);
}
if(!patch->requires.empty())
if(!patch->depends.empty())
{
Meta::serializeRequires(root, &patch->requires, "requires");
Meta::serializeRequires(root, &patch->depends, "requires");
}
if(!patch->conflicts.empty())
{

View File

@ -412,7 +412,7 @@ static void upgradeDeprecatedFiles(QString root, QString instanceName)
Meta::Require needsLwjgl;
needsLwjgl.uid = "org.lwjgl";
file->requires.insert(needsLwjgl);
file->depends.insert(needsLwjgl);
if(!ProfileUtils::saveJsonFile(OneSixVersionFormat::versionFileToJson(file), mcJson))
{
@ -468,7 +468,7 @@ bool PackProfile::migratePreComponentConfig()
// insert requirements if needed
if(!req.uid.isEmpty())
{
file->requires.insert(req);
file->depends.insert(req);
}
// insert conflicts if needed
if(!conflict.uid.isEmpty())

View File

@ -94,7 +94,7 @@ public: /* data */
* MultiMC: set of packages this depends on
* NOTE: this is shared with the meta format!!!
*/
Meta::RequireSet requires;
Meta::RequireSet depends;
/**
* MultiMC: set of packages this conflicts with

View File

@ -196,7 +196,7 @@ QString PackInstallTask::getVersionForLoader(QString uid)
if(m_version.loader.recommended || m_version.loader.latest) {
for (int i = 0; i < vlist->versions().size(); i++) {
auto version = vlist->versions().at(i);
auto reqs = version->requires();
auto reqs = version->depends();
// filter by minecraft version, if the loader depends on a certain version.
// not all mod loaders depend on a given Minecraft version, so we won't do this

View File

@ -167,7 +167,7 @@ QString AtlPage::chooseVersion(Meta::VersionListPtr vlist, QString minecraftVers
// select recommended build
for (int i = 0; i < vlist->versions().size(); i++) {
auto version = vlist->versions().at(i);
auto reqs = version->requires();
auto reqs = version->depends();
// filter by minecraft version, if the loader depends on a certain version.
if (minecraftVersion != Q_NULLPTR) {