MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / getTrivialComponentChanges

Function getTrivialComponentChanges

launcher/minecraft/ComponentUpdateTask.cpp:418–504  ·  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

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