From 8d4f6cee48e7002dfa3f8158234f444f7bae8f30 Mon Sep 17 00:00:00 2001 From: bigwheel Date: Mon, 14 Jan 2019 19:02:41 +0900 Subject: [PATCH] [Fix #287] Add alternative constructor for binary compatibility --- .../sbt/librarymanagement/EvictionWarning.scala | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala b/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala index 08fef77bc..04da1a4c6 100644 --- a/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala +++ b/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala @@ -198,6 +198,13 @@ final class EvictionWarning private[sbt] ( val allEvictions: Seq[EvictionPair], val binaryIncompatibleEvictionExists: Boolean ) { + private[sbt] def this( + options: EvictionWarningOptions, + scalaEvictions: Seq[EvictionPair], + directEvictions: Seq[EvictionPair], + transitiveEvictions: Seq[EvictionPair], + allEvictions: Seq[EvictionPair] + ) = this(options, scalaEvictions, directEvictions, transitiveEvictions, allEvictions, false) def reportedEvictions: Seq[EvictionPair] = scalaEvictions ++ directEvictions ++ transitiveEvictions private[sbt] def infoAllTheThings: List[String] = EvictionWarning.infoAllTheThings(this) @@ -291,22 +298,25 @@ object EvictionWarning { case p if isScalaArtifact(module, p.organization, p.name) => (module.scalaModuleInfo, p.winner) match { case (Some(s), Some(winner)) if (s.scalaFullVersion != winner.module.revision) => - binaryIncompatibleEvictionExists = true if (options.warnScalaVersionEviction) scalaEvictions += p + if (options.warnEvictionSummary) + binaryIncompatibleEvictionExists = true case _ => } case p if p.includesDirect => if (!guessCompatible(p)) { - binaryIncompatibleEvictionExists = true if (options.warnDirectEvictions) directEvictions += p + if (options.warnEvictionSummary) + binaryIncompatibleEvictionExists = true } case p => if (!guessCompatible(p)) { - binaryIncompatibleEvictionExists = true if (options.warnTransitiveEvictions) transitiveEvictions += p + if (options.warnEvictionSummary) + binaryIncompatibleEvictionExists = true } } new EvictionWarning(