Fixes #1615. Move the invocation of eviction warning.

This moves the invocation of eviction warning so it’s called only when
actual ivy update is being performed.
This commit is contained in:
Eugene Yokota 2014-12-12 17:46:19 -05:00
parent e17ab305ae
commit 40e5f7538a
3 changed files with 28 additions and 9 deletions

View File

@ -41,6 +41,8 @@ final class EvictionWarningOptions private[sbt] (
}
object EvictionWarningOptions {
def empty: EvictionWarningOptions =
new EvictionWarningOptions(Vector(), false, false, false, false, defaultGuess)
def default: EvictionWarningOptions =
new EvictionWarningOptions(Vector(Compile), true, true, false, false, defaultGuess)
def full: EvictionWarningOptions =

View File

@ -1151,13 +1151,9 @@ object Classpaths {
unresolvedWarningConfiguration in update := UnresolvedWarningConfiguration(dependencyPositions.value),
update <<= updateTask tag (Tags.Update, Tags.Network),
update := {
import ShowLines._
val report = update.value
val log = streams.value.log
ConflictWarning(conflictWarning.value, report, log)
val ewo = (evictionWarningOptions in update).value
val ew = EvictionWarning(ivyModule.value, ewo, report, log)
ew.lines foreach { log.warn(_) }
report
},
evictionWarningOptions in evicted := EvictionWarningOptions.full,
@ -1337,33 +1333,41 @@ object Classpaths {
case Some(x) if uc0.logging == Default => uc0.copy(logging = DownloadOnly)
case _ => uc0
}
val ewo =
if (executionRoots.value exists { _.key == evicted.key }) EvictionWarningOptions.empty
else (evictionWarningOptions in update).value
cachedUpdate(s.cacheDirectory / updateCacheName.value, show, ivyModule.value, uc, transform,
skip = (skip in update).value, force = isRoot, depsUpdated = depsUpdated,
uwConfig = uwConfig, logicalClock = logicalClock, depDir = Some(depDir), log = s.log)
uwConfig = uwConfig, logicalClock = logicalClock, depDir = Some(depDir),
ewo = ewo, log = s.log)
}
@deprecated("Use cachedUpdate with the variant that takes unresolvedHandler instead.", "0.13.6")
def cachedUpdate(cacheFile: File, label: String, module: IvySbt#Module, config: UpdateConfiguration,
transform: UpdateReport => UpdateReport, skip: Boolean, force: Boolean, depsUpdated: Boolean, log: Logger): UpdateReport =
cachedUpdate(cacheFile, label, module, config, transform, skip, force, depsUpdated,
UnresolvedWarningConfiguration(), LogicalClock.unknown, None, log)
UnresolvedWarningConfiguration(), LogicalClock.unknown, None, EvictionWarningOptions.empty, log)
private[sbt] def cachedUpdate(cacheFile: File, label: String, module: IvySbt#Module, config: UpdateConfiguration,
transform: UpdateReport => UpdateReport, skip: Boolean, force: Boolean, depsUpdated: Boolean,
uwConfig: UnresolvedWarningConfiguration, logicalClock: LogicalClock, depDir: Option[File], log: Logger): UpdateReport =
uwConfig: UnresolvedWarningConfiguration, logicalClock: LogicalClock, depDir: Option[File],
ewo: EvictionWarningOptions, log: Logger): UpdateReport =
{
implicit val updateCache = updateIC
type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil
def work = (_: In) match {
case conf :+: settings :+: config :+: HNil =>
import ShowLines._
log.info("Updating " + label + "...")
val r = IvyActions.updateEither(module, config, uwConfig, logicalClock, depDir, log) match {
case Right(ur) => ur
case Left(uw) =>
import ShowLines._
uw.lines foreach { log.warn(_) }
throw uw.resolveException
}
log.info("Done updating.")
transform(r)
val result = transform(r)
val ew = EvictionWarning(module, ewo, result, log)
ew.lines foreach { log.warn(_) }
result
}
def uptodate(inChanged: Boolean, out: UpdateReport): Boolean =
!force &&

View File

@ -0,0 +1,13 @@
[@cunei]: https://github.com/cunei
[@eed3si9n]: https://github.com/eed3si9n
[@gkossakowski]: https://github.com/gkossakowski
[@jsuereth]: https://github.com/jsuereth
[1615]: https://github.com/sbt/sbt/issues/1615
### Fixes with compatibility implications
### Improvements
### Bug fixes
- Fixes eviction warning being too noisy. [#1615][1615] by [@eed3si9n][@eed3si9n]