mirror of https://github.com/sbt/sbt.git
27 lines
602 B
Scala
27 lines
602 B
Scala
package coursier
|
|
|
|
import scalaz.{ -\/, \/-, Monad, EitherT }
|
|
|
|
case class InterProjectRepository(projects: Seq[Project]) extends Repository {
|
|
|
|
private val map = projects
|
|
.map { proj => proj.moduleVersion -> proj }
|
|
.toMap
|
|
|
|
def find[F[_]](
|
|
module: Module,
|
|
version: String,
|
|
fetch: Fetch.Content[F]
|
|
)(implicit
|
|
F: Monad[F]
|
|
): EitherT[F, String, (Artifact.Source, Project)] = {
|
|
val res = map.get((module, version)) match {
|
|
case Some(proj) =>
|
|
\/-((Artifact.Source.empty, proj))
|
|
case None =>
|
|
-\/("Not found")
|
|
}
|
|
|
|
EitherT(F.point(res))
|
|
}
|
|
} |