Skip to content

Commit

Permalink
Detect forge dependency problems if multiple mods are missing and the…
Browse files Browse the repository at this point in the history
…re are no versions specified for some of them
  • Loading branch information
JulianVennen committed Jan 15, 2024
1 parent 0a7115c commit 36499b3
Show file tree
Hide file tree
Showing 4 changed files with 4,365 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Analysis/Problem/Forge/ModDependencyProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function setMatches(array $matches, mixed $patternKey): void
$this->addSolution((new ModInstallSolution())->setModName($matches[2]));
break;
case 1:
$count = preg_match_all('/(\w+)@\[([0-9\.]+)/', $matches[2], $dependencyMatches);
$count = preg_match_all('/(\w+)(?:@\[?([0-9\.]+))?[,\]]/', $matches[2], $dependencyMatches);
if (!$count) {
if (preg_match('/\[(\S+)\]/', $matches[2], $dependencyMatches)) {
$this->dependencyMods[] = $dependencyMatches[1];
Expand All @@ -81,7 +81,12 @@ public function setMatches(array $matches, mixed $patternKey): void
$name = $dependencyMatches[1][$i];
$version = $dependencyMatches[2][$i];
$this->dependencyMods[] = $name;
$this->addSolution((new ModInstallSolution())->setModName($name)->setModVersion($version));

$solution = (new ModInstallSolution())->setModName($name);
if ($version) {
$solution->setModVersion($version);
}
$this->addSolution($solution);
}
break;
case 2:
Expand Down
Loading

0 comments on commit 36499b3

Please sign in to comment.