forked from coursier/coursier
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes coursier#1284 This implements an alternative reconciliation rule that first tries the basic reconciliation, and if it fails falls back to using the max values of the specific versions and lower bounds of the intervals.
- Loading branch information
Showing
18 changed files
with
169 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
modules/coursier/shared/src/main/scala/coursier/parse/ReconciliationParser.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package coursier.parse | ||
|
||
import coursier.core.{Module, ModuleName, Organization, Reconciliation} | ||
import coursier.util.{ModuleMatcher, ModuleMatchers, ValidationNel} | ||
import coursier.util.Traverse._ | ||
|
||
object ReconciliationParser { | ||
def reconciliation(input: Seq[String], scalaVersionOrDefault: String): Either[List[String], Seq[(ModuleMatchers, Reconciliation)]] = { | ||
DependencyParser.moduleVersions( | ||
input, scalaVersionOrDefault | ||
).either match { | ||
case Left(e) => Left(e) | ||
case Right(elems) => | ||
(elems.validationNelTraverse { case (m: Module, v: String) => | ||
val e = reconciliation(m, v) | ||
ValidationNel.fromEither(e) | ||
}).either | ||
} | ||
} | ||
|
||
def reconciliation(module: Module, v: String): Either[String, (ModuleMatchers, Reconciliation)] = { | ||
val m = | ||
if (module.organization == Organization("*") && module.name == ModuleName("*")) ModuleMatchers.all | ||
else ModuleMatchers(exclude = Set(ModuleMatcher.all), include = Set(ModuleMatcher(module))) | ||
(v match { | ||
case "basic" => Right(Reconciliation.Basic) | ||
case "relaxed" => Right(Reconciliation.Relaxed) | ||
case _ => Left(s"Unknown reconciliation '$v'") | ||
}) map { r => | ||
m -> r | ||
} | ||
} | ||
} |
Oops, something went wrong.