mirror of https://github.com/sbt/sbt.git
Merge pull request #613 from coursier/topic/max-iteration
Factor default max # of iterations
This commit is contained in:
commit
95f08e99d6
|
|
@ -3,6 +3,7 @@ package cli
|
||||||
|
|
||||||
import caseapp.{ HelpMessage => Help, ValueDescription => Value, ExtraName => Short, _ }
|
import caseapp.{ HelpMessage => Help, ValueDescription => Value, ExtraName => Short, _ }
|
||||||
|
|
||||||
|
import coursier.core.ResolutionProcess
|
||||||
import coursier.util.Parse
|
import coursier.util.Parse
|
||||||
|
|
||||||
final case class CommonOptions(
|
final case class CommonOptions(
|
||||||
|
|
@ -27,7 +28,7 @@ final case class CommonOptions(
|
||||||
progress: Boolean = false,
|
progress: Boolean = false,
|
||||||
@Help("Maximum number of resolution iterations (specify a negative value for unlimited, default: 100)")
|
@Help("Maximum number of resolution iterations (specify a negative value for unlimited, default: 100)")
|
||||||
@Short("N")
|
@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)")
|
@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")
|
@Value("maven|sonatype:$repo|ivy2local|bintray:$org/$repo|bintray-ivy:$org/$repo|typesafe:ivy-$repo|typesafe:$repo|sbt-plugin:$repo|ivy:$pattern")
|
||||||
@Short("r")
|
@Short("r")
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import scalaz.Scalaz.{ToFunctorOps, ToTraverseOps, vectorInstance}
|
||||||
sealed abstract class ResolutionProcess {
|
sealed abstract class ResolutionProcess {
|
||||||
def run[F[_]](
|
def run[F[_]](
|
||||||
fetch: Fetch.Metadata[F],
|
fetch: Fetch.Metadata[F],
|
||||||
maxIterations: Int = 50
|
maxIterations: Int = ResolutionProcess.defaultMaxIterations
|
||||||
)(implicit
|
)(implicit
|
||||||
F: Monad[F]
|
F: Monad[F]
|
||||||
): F[Resolution] =
|
): F[Resolution] =
|
||||||
|
|
@ -154,6 +154,9 @@ final case class Done(resolution: Resolution) extends ResolutionProcess {
|
||||||
}
|
}
|
||||||
|
|
||||||
object ResolutionProcess {
|
object ResolutionProcess {
|
||||||
|
|
||||||
|
def defaultMaxIterations: Int = 100
|
||||||
|
|
||||||
def apply(resolution: Resolution): ResolutionProcess = {
|
def apply(resolution: Resolution): ResolutionProcess = {
|
||||||
val resolution0 = resolution.nextIfNoMissing
|
val resolution0 = resolution.nextIfNoMissing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import sbt.Keys._
|
||||||
|
|
||||||
import SbtCompatibility._
|
import SbtCompatibility._
|
||||||
|
|
||||||
|
import coursier.core.ResolutionProcess
|
||||||
|
|
||||||
object CoursierPlugin extends AutoPlugin {
|
object CoursierPlugin extends AutoPlugin {
|
||||||
|
|
||||||
override def trigger = allRequirements
|
override def trigger = allRequirements
|
||||||
|
|
@ -183,7 +185,7 @@ object CoursierPlugin extends AutoPlugin {
|
||||||
|
|
||||||
override lazy val buildSettings = super.buildSettings ++ Seq(
|
override lazy val buildSettings = super.buildSettings ++ Seq(
|
||||||
coursierParallelDownloads := 6,
|
coursierParallelDownloads := 6,
|
||||||
coursierMaxIterations := 50,
|
coursierMaxIterations := ResolutionProcess.defaultMaxIterations,
|
||||||
coursierChecksums := Seq(Some("SHA-1"), None),
|
coursierChecksums := Seq(Some("SHA-1"), None),
|
||||||
coursierArtifactsChecksums := Seq(None),
|
coursierArtifactsChecksums := Seq(None),
|
||||||
coursierCachePolicies := CachePolicy.default,
|
coursierCachePolicies := CachePolicy.default,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue