pekko/project/MiMa.scala

69 lines
2.2 KiB
Scala
Raw Normal View History

/**
2018-01-04 17:26:29 +00:00
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package akka
import sbt._
import sbt.Keys._
import com.typesafe.tools.mima.plugin.MimaPlugin
import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._
object MiMa extends AutoPlugin {
2018-03-01 10:48:40 +01:00
private val latestMinorOf25 = 11
private val latestMinorOf24 = 20
2017-07-27 13:33:14 +03:00
override def requires = MimaPlugin
override def trigger = allRequirements
override val projectSettings = Seq(
2017-10-06 10:30:28 +02:00
mimaPreviousArtifacts := akkaPreviousArtifacts(name.value, organization.value, scalaBinaryVersion.value))
def akkaPreviousArtifacts(projectName: String, organization: String, scalaBinaryVersion: String): Set[sbt.ModuleID] = {
val versions: Seq[String] = {
val akka24NoStreamVersions = Seq("2.4.0", "2.4.1")
2017-10-06 10:30:28 +02:00
val akka25Versions = (0 to latestMinorOf25).map(patch s"2.5.$patch")
val akka24StreamVersions = (2 to 12) map ("2.4." + _)
val akka24WithScala212 =
2017-07-27 13:33:14 +03:00
(13 to latestMinorOf24)
2017-10-06 10:30:28 +02:00
.map("2.4." + _)
.filterNot(_ == "2.4.15") // 2.4.15 was released from the wrong branch and never announced
val akka242NewArtifacts = Seq(
"akka-stream",
2017-10-06 10:30:28 +02:00
"akka-stream-testkit")
val akka250NewArtifacts = Seq(
2017-10-06 10:30:28 +02:00
"akka-persistence-query")
scalaBinaryVersion match {
2017-10-06 10:30:28 +02:00
case "2.11"
if (akka250NewArtifacts.contains(projectName)) akka25Versions
else {
if (!akka242NewArtifacts.contains(projectName)) akka24NoStreamVersions
else Seq.empty
} ++ akka24StreamVersions ++ akka24WithScala212 ++ akka25Versions
2017-10-06 10:30:28 +02:00
case "2.12"
akka24WithScala212 ++ akka25Versions
case v if v.startsWith("2.13") =>
// no Akka released for 2.13 yet, no jars to check BC against
2017-10-06 10:30:28 +02:00
Seq.empty
}
}
2017-01-24 11:27:24 +01:00
val akka25PromotedArtifacts = Set(
2017-10-06 10:30:28 +02:00
"akka-distributed-data")
// check against all binary compatible artifacts
2017-10-06 10:30:28 +02:00
versions.map { v
2017-01-24 11:27:24 +01:00
val adjustedProjectName =
if (akka25PromotedArtifacts(projectName) && v.startsWith("2.4"))
projectName + "-experimental"
else
2017-01-24 11:27:24 +01:00
projectName
organization %% adjustedProjectName % v
}.toSet
}
}