MCPcopy Create free account
hub / github.com/MultiMC/Launcher / getTrivialComponentChanges

Function getTrivialComponentChanges

launcher/minecraft/ComponentUpdateTask.cpp:410–496  ·  view source on GitHub ↗

* handles: * - trivial addition (there is an unmet requirement and it can be trivially met by adding something) * - trivial version conflict of dependencies == explicit version required and installed is different * * toAdd - set of requirements than mean adding a new component * toChange - set of requirements that mean changing version of an existing component */

Source from the content-addressed store, hash-verified

408 * toChange - set of requirements that mean changing version of an existing component
409 */
410static bool getTrivialComponentChanges(const ComponentIndex & index, const RequireExSet & input, RequireExSet & toAdd, RequireExSet & toChange)
411{
412 enum class Decision
413 {
414 Undetermined,
415 Met,
416 Missing,
417 VersionNotSame,
418 LockedVersionNotSame
419 } decision = Decision::Undetermined;
420
421 QString reqStr;
422 bool succeeded = true;
423 // list the composed requirements and say if they are met or unmet
424 for(auto & req: input)
425 {
426 do
427 {
428 if(req.equalsVersion.isEmpty())
429 {
430 reqStr = QString("Req: %1").arg(req.uid);
431 if(index.contains(req.uid))
432 {
433 decision = Decision::Met;
434 }
435 else
436 {
437 toAdd.insert(req);
438 decision = Decision::Missing;
439 }
440 break;
441 }
442 else
443 {
444 reqStr = QString("Req: %1 == %2").arg(req.uid, req.equalsVersion);
445 const auto & compIter = index.find(req.uid);
446 if(compIter == index.cend())
447 {
448 toAdd.insert(req);
449 decision = Decision::Missing;
450 break;
451 }
452 auto & comp = (*compIter);
453 if(comp->getVersion() != req.equalsVersion)
454 {
455 if(comp->isCustom()) {
456 decision = Decision::LockedVersionNotSame;
457 } else {
458 if(comp->m_dependencyOnly)
459 {
460 decision = Decision::VersionNotSame;
461 }
462 else
463 {
464 decision = Decision::LockedVersionNotSame;
465 }
466 }
467 break;

Callers 1

resolveDependenciesMethod · 0.85

Calls 7

QStringClass · 0.85
isEmptyMethod · 0.80
insertMethod · 0.80
isCustomMethod · 0.80
containsMethod · 0.45
findMethod · 0.45
getVersionMethod · 0.45

Tested by

no test coverage detected