2019-01-02 18:55:26 +08:00
|
|
|
/*
|
2021-01-08 17:55:38 +01:00
|
|
|
* Copyright (C) 2009-2021 Lightbend Inc. <https://www.lightbend.com>
|
2015-01-22 20:26:34 +02:00
|
|
|
*/
|
2018-03-13 23:45:55 +09:00
|
|
|
|
2015-01-22 20:26:34 +02:00
|
|
|
package akka
|
|
|
|
|
|
2019-04-19 08:54:25 +02:00
|
|
|
import scala.collection.immutable
|
2015-02-19 15:49:02 +01:00
|
|
|
import sbt._
|
2016-03-10 10:45:35 +02:00
|
|
|
import sbt.Keys._
|
|
|
|
|
import com.typesafe.tools.mima.plugin.MimaPlugin
|
|
|
|
|
import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._
|
2015-01-22 20:26:34 +02:00
|
|
|
|
|
|
|
|
object MiMa extends AutoPlugin {
|
|
|
|
|
|
2020-10-16 15:47:18 +02:00
|
|
|
private val latestPatchOf25 = 32
|
2021-06-23 17:06:13 +02:00
|
|
|
private val latestPatchOf26 = 15
|
2017-07-27 13:33:14 +03:00
|
|
|
|
2016-03-10 10:45:35 +02:00
|
|
|
override def requires = MimaPlugin
|
2015-01-22 20:26:34 +02:00
|
|
|
override def trigger = allRequirements
|
|
|
|
|
|
2016-03-10 10:45:35 +02:00
|
|
|
override val projectSettings = Seq(
|
2020-02-28 11:50:47 +01:00
|
|
|
mimaReportSignatureProblems := true,
|
2017-10-06 10:30:28 +02:00
|
|
|
mimaPreviousArtifacts := akkaPreviousArtifacts(name.value, organization.value, scalaBinaryVersion.value))
|
2015-05-21 09:48:49 +03:00
|
|
|
|
2019-04-03 16:37:39 +02:00
|
|
|
def akkaPreviousArtifacts(
|
|
|
|
|
projectName: String,
|
|
|
|
|
organization: String,
|
|
|
|
|
scalaBinaryVersion: String): Set[sbt.ModuleID] = {
|
2016-12-15 16:01:32 +01:00
|
|
|
|
2019-04-19 08:54:25 +02:00
|
|
|
val versions: Seq[String] = {
|
2019-08-27 10:12:27 +02:00
|
|
|
val firstPatchOf25 =
|
|
|
|
|
if (scalaBinaryVersion.startsWith("2.13")) 25
|
|
|
|
|
else if (projectName.contains("discovery")) 19
|
|
|
|
|
else if (projectName.contains("coordination")) 22
|
|
|
|
|
else 0
|
2019-11-06 21:40:56 +01:00
|
|
|
|
2019-12-04 15:40:38 +01:00
|
|
|
val akka25Previous =
|
|
|
|
|
if (!(projectName.contains("typed") || projectName.contains("jackson"))) {
|
|
|
|
|
// 2.5.18 is the only release built with Scala 2.12.7, which due to
|
|
|
|
|
// https://github.com/scala/bug/issues/11207 produced many more
|
|
|
|
|
// static methods than expected. These are hard to filter out, so
|
|
|
|
|
// we exclude it here and rely on the checks for 2.5.17 and 2.5.19.
|
2020-04-27 16:11:32 +02:00
|
|
|
// Additionally, 2.5.30 had some problems related to
|
|
|
|
|
// https://github.com/akka/akka/issues/28807
|
|
|
|
|
expandVersions(2, 5, ((firstPatchOf25 to latestPatchOf25).toSet - 18 - 30).toList)
|
2019-12-04 15:40:38 +01:00
|
|
|
} else {
|
|
|
|
|
Nil
|
|
|
|
|
}
|
|
|
|
|
val akka26Previous = expandVersions(2, 6, 0 to latestPatchOf26)
|
|
|
|
|
|
|
|
|
|
akka25Previous ++ akka26Previous
|
2016-03-10 10:45:35 +02:00
|
|
|
}
|
2017-05-22 16:51:29 +02:00
|
|
|
|
2019-04-03 16:37:39 +02:00
|
|
|
val akka25PromotedArtifacts = Set("akka-distributed-data")
|
2016-03-10 10:45:35 +02:00
|
|
|
|
|
|
|
|
// check against all binary compatible artifacts
|
2019-02-09 15:25:39 +01:00
|
|
|
versions.map { v =>
|
2017-01-24 11:27:24 +01:00
|
|
|
val adjustedProjectName =
|
|
|
|
|
if (akka25PromotedArtifacts(projectName) && v.startsWith("2.4"))
|
|
|
|
|
projectName + "-experimental"
|
2017-05-22 16:51:29 +02:00
|
|
|
else
|
2017-01-24 11:27:24 +01:00
|
|
|
projectName
|
|
|
|
|
organization %% adjustedProjectName % v
|
|
|
|
|
}.toSet
|
2016-03-10 10:45:35 +02:00
|
|
|
}
|
2019-04-19 08:54:25 +02:00
|
|
|
|
|
|
|
|
private def expandVersions(major: Int, minor: Int, patches: immutable.Seq[Int]): immutable.Seq[String] =
|
|
|
|
|
patches.map(patch => s"$major.$minor.$patch")
|
2015-01-22 20:26:34 +02:00
|
|
|
}
|