mirror of https://github.com/sbt/sbt.git
Allow specifying the max number of iterations on the command line
This commit is contained in:
parent
8ab72e7431
commit
962ef2a4aa
|
|
@ -12,7 +12,8 @@ import scalaz.{-\/, \/-}
|
||||||
|
|
||||||
case class Coursier(scope: List[String],
|
case class Coursier(scope: List[String],
|
||||||
keepOptional: Boolean,
|
keepOptional: Boolean,
|
||||||
fetch: Boolean) extends App {
|
fetch: Boolean,
|
||||||
|
@ExtraName("N") maxIterations: Int) extends App {
|
||||||
|
|
||||||
val scopes0 =
|
val scopes0 =
|
||||||
if (scope.isEmpty) List(Scope.Compile, Scope.Runtime)
|
if (scope.isEmpty) List(Scope.Compile, Scope.Runtime)
|
||||||
|
|
@ -85,9 +86,15 @@ case class Coursier(scope: List[String],
|
||||||
val res = resolve(
|
val res = resolve(
|
||||||
deps.toSet,
|
deps.toSet,
|
||||||
fetchFrom(repositories),
|
fetchFrom(repositories),
|
||||||
|
maxIterations = Some(maxIterations).filter(_ > 0),
|
||||||
filter = Some(dep => (keepOptional || !dep.optional) && scopes(dep.scope))
|
filter = Some(dep => (keepOptional || !dep.optional) && scopes(dep.scope))
|
||||||
).run
|
).run
|
||||||
|
|
||||||
|
if (!res.isDone) {
|
||||||
|
println(s"Maximum number of iteration reached!")
|
||||||
|
sys exit 1
|
||||||
|
}
|
||||||
|
|
||||||
def repr(dep: Dependency) =
|
def repr(dep: Dependency) =
|
||||||
s"${dep.module.organization}:${dep.module.name}:${dep.`type`}:${Some(dep.classifier).filter(_.nonEmpty).map(_+":").mkString}${dep.version}"
|
s"${dep.module.organization}:${dep.module.name}:${dep.`type`}:${Some(dep.classifier).filter(_.nonEmpty).map(_+":").mkString}${dep.version}"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue