Permalink
Browse files

Factor default max # of iterations

  • Loading branch information...
alexarchambault committed Jul 18, 2017
1 parent a709755 commit db3679dce4c3c217883a715f226194f3e34a4456
@@ -3,6 +3,7 @@ package cli
import caseapp.{ HelpMessage => Help, ValueDescription => Value, ExtraName => Short, _ }
import coursier.core.ResolutionProcess
import coursier.util.Parse
final case class CommonOptions(
@@ -27,7 +28,7 @@ final case class CommonOptions(
progress: Boolean = false,
@Help("Maximum number of resolution iterations (specify a negative value for unlimited, default: 100)")
@Short("N")
maxIterations: Int = 100,
maxIterations: Int = ResolutionProcess.defaultMaxIterations,
@Help("Repository - for multiple repositories, separate with comma and/or add this option multiple times (e.g. -r central,ivy2local -r sonatype-snapshots, or equivalently -r central,ivy2local,sonatype-snapshots)")
@Value("maven|sonatype:$repo|ivy2local|bintray:$org/$repo|bintray-ivy:$org/$repo|typesafe:ivy-$repo|typesafe:$repo|sbt-plugin:$repo|ivy:$pattern")
@Short("r")
@@ -11,7 +11,7 @@ import scalaz.Scalaz.{ToFunctorOps, ToTraverseOps, vectorInstance}
sealed abstract class ResolutionProcess {
def run[F[_]](
fetch: Fetch.Metadata[F],
maxIterations: Int = 50
maxIterations: Int = ResolutionProcess.defaultMaxIterations
)(implicit
F: Monad[F]
): F[Resolution] =
@@ -154,6 +154,9 @@ final case class Done(resolution: Resolution) extends ResolutionProcess {
}
object ResolutionProcess {
def defaultMaxIterations: Int = 100
def apply(resolution: Resolution): ResolutionProcess = {
val resolution0 = resolution.nextIfNoMissing
@@ -5,6 +5,8 @@ import sbt.Keys._
import SbtCompatibility._
import coursier.core.ResolutionProcess
object CoursierPlugin extends AutoPlugin {
override def trigger = allRequirements
@@ -163,7 +165,7 @@ object CoursierPlugin extends AutoPlugin {
override lazy val buildSettings = super.buildSettings ++ Seq(
coursierParallelDownloads := 6,
coursierMaxIterations := 50,
coursierMaxIterations := ResolutionProcess.defaultMaxIterations,
coursierChecksums := Seq(Some("SHA-1"), None),
coursierArtifactsChecksums := Seq(None),
coursierCachePolicies := CachePolicy.default,

0 comments on commit db3679d

Please sign in to comment.