Skip to content

Commit

Permalink
Merge pull request #60 from aternosorg/forge-mod-dependencies
Browse files Browse the repository at this point in the history
Detect forge dependency problems if multiple mods are missing and there are no versions specified for some of them
  • Loading branch information
JulianVennen authored Jan 15, 2024
2 parents 0a7115c + 36499b3 commit 4cbf8ca
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 4cbf8ca

Please sign in to comment.