[Fix #287] Add alternative constructor for binary compatibility

This commit is contained in:
bigwheel 2019-01-14 19:02:41 +09:00
parent c1a93c65b7
commit 8d4f6cee48
1 changed files with 13 additions and 3 deletions

View File

@ -198,6 +198,13 @@ final class EvictionWarning private[sbt] (
val allEvictions: Seq[EvictionPair], val allEvictions: Seq[EvictionPair],
val binaryIncompatibleEvictionExists: Boolean 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] = def reportedEvictions: Seq[EvictionPair] =
scalaEvictions ++ directEvictions ++ transitiveEvictions scalaEvictions ++ directEvictions ++ transitiveEvictions
private[sbt] def infoAllTheThings: List[String] = EvictionWarning.infoAllTheThings(this) private[sbt] def infoAllTheThings: List[String] = EvictionWarning.infoAllTheThings(this)
@ -291,22 +298,25 @@ object EvictionWarning {
case p if isScalaArtifact(module, p.organization, p.name) => case p if isScalaArtifact(module, p.organization, p.name) =>
(module.scalaModuleInfo, p.winner) match { (module.scalaModuleInfo, p.winner) match {
case (Some(s), Some(winner)) if (s.scalaFullVersion != winner.module.revision) => case (Some(s), Some(winner)) if (s.scalaFullVersion != winner.module.revision) =>
binaryIncompatibleEvictionExists = true
if (options.warnScalaVersionEviction) if (options.warnScalaVersionEviction)
scalaEvictions += p scalaEvictions += p
if (options.warnEvictionSummary)
binaryIncompatibleEvictionExists = true
case _ => case _ =>
} }
case p if p.includesDirect => case p if p.includesDirect =>
if (!guessCompatible(p)) { if (!guessCompatible(p)) {
binaryIncompatibleEvictionExists = true
if (options.warnDirectEvictions) if (options.warnDirectEvictions)
directEvictions += p directEvictions += p
if (options.warnEvictionSummary)
binaryIncompatibleEvictionExists = true
} }
case p => case p =>
if (!guessCompatible(p)) { if (!guessCompatible(p)) {
binaryIncompatibleEvictionExists = true
if (options.warnTransitiveEvictions) if (options.warnTransitiveEvictions)
transitiveEvictions += p transitiveEvictions += p
if (options.warnEvictionSummary)
binaryIncompatibleEvictionExists = true
} }
} }
new EvictionWarning( new EvictionWarning(