Skip to content

Commit

Permalink
Alias withLatestSnapshots to withCachedSnapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Sep 10, 2023
1 parent 689f347 commit 1162c57
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ private[sbt] object IvySbt {
val delegate = ivyint.SbtChainResolver(delegatedName, rest, settings, updateOptions, log)
val initialResolvers = projectResolvers :+ delegate
val freshOptions = UpdateOptions()
.withLatestSnapshots(false)
.withCachedSnapshots(true)
.withModuleResolvers(updateOptions.moduleResolvers)
ivyint.SbtChainResolver(name, initialResolvers, settings, freshOptions, log)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private[sbt] case class SbtChainResolver(
if (resolvedModule.getId.getRevision.contains("SNAPSHOT")) {

Message.warn(
"Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options."
"Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withCachedSnapshots(true)` options."
)
val resolvers = sortedRevisions.map(_._2.getName)
sortedRevisions.foreach(h => {
Expand Down
11 changes: 10 additions & 1 deletion ivy/src/main/scala/sbt/librarymanagement/ivy/UpdateOptions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ final class UpdateOptions private[sbt] (
// If set to true, prioritize inter-project resolver
val interProjectFirst: Boolean,
// If set to true, check all resolvers for snapshots.
@deprecated("Use withCachedSnapshots instead with opposite boolean values", "1.9.2")
val latestSnapshots: Boolean,
// If set to true, cache snapshots
val cachedSnapshots: Boolean,
// If set to true, use cached resolution.
val cachedResolution: Boolean,
// If set to true, use Gigahorse
Expand All @@ -35,8 +38,11 @@ final class UpdateOptions private[sbt] (
copy(circularDependencyLevel = circularDependencyLevel)
def withInterProjectFirst(interProjectFirst: Boolean): UpdateOptions =
copy(interProjectFirst = interProjectFirst)
@deprecated("Use withCachedSnapshots instead with opposite boolean values", "1.9.2")
def withLatestSnapshots(latestSnapshots: Boolean): UpdateOptions =
copy(latestSnapshots = latestSnapshots)
withCachedSnapshots(!latestSnapshots)
def withCachedSnapshots(cachedSnapshots: Boolean): UpdateOptions
copy(latestSnapshots = !cachedResolution)
def withCachedResolution(cachedResolution: Boolean): UpdateOptions =
copy(cachedResolution = cachedResolution)

Expand All @@ -54,6 +60,7 @@ final class UpdateOptions private[sbt] (
circularDependencyLevel: CircularDependencyLevel = this.circularDependencyLevel,
interProjectFirst: Boolean = this.interProjectFirst,
latestSnapshots: Boolean = this.latestSnapshots,
cachedSnasphots: Boolean = !this.latestSnapshots,
cachedResolution: Boolean = this.cachedResolution,
gigahorse: Boolean = this.gigahorse,
resolverConverter: UpdateOptions.ResolverConverter = this.resolverConverter,
Expand All @@ -63,6 +70,7 @@ final class UpdateOptions private[sbt] (
circularDependencyLevel,
interProjectFirst,
latestSnapshots,
cachedSnasphots,
cachedResolution,
gigahorse,
resolverConverter,
Expand Down Expand Up @@ -109,6 +117,7 @@ object UpdateOptions {
circularDependencyLevel = CircularDependencyLevel.Warn,
interProjectFirst = true,
latestSnapshots = true,
cachedSnapshots = false,
cachedResolution = false,
gigahorse = LMSysProp.useGigahorse,
resolverConverter = PartialFunction.empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class UpdateOptionsSpec extends BasicTestSuite {
UpdateOptions()
.withCircularDependencyLevel(CircularDependencyLevel.Error)
.withCachedResolution(true)
.withLatestSnapshots(false)
.withCachedSnapshots(true)
.toString() == """|UpdateOptions(
| circularDependencyLevel = error,
| latestSnapshots = false,
| cachedSnapshots = true,
| cachedResolution = true
|)""".stripMargin
)
Expand Down

0 comments on commit 1162c57

Please sign in to comment.