From 62d1ab0249b3a477f5c6f2d3b7d9e934a17afb94 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Thu, 25 Apr 2019 17:16:49 +0200 Subject: [PATCH] Ensure we don't break binary compatibility in lm-coursier --- build.sbt | 1 + project/Mima.scala | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 project/Mima.scala diff --git a/build.sbt b/build.sbt index 4ed64a8d7..266635dac 100644 --- a/build.sbt +++ b/build.sbt @@ -21,6 +21,7 @@ lazy val `lm-coursier` = project .in(file("modules/lm-coursier")) .settings( shared, + Mima.settings, libraryDependencies ++= Seq( "io.get-coursier" %% "coursier" % coursierVersion0, // We depend on librarymanagement-ivy rather than just diff --git a/project/Mima.scala b/project/Mima.scala new file mode 100644 index 000000000..bdb5dfb02 --- /dev/null +++ b/project/Mima.scala @@ -0,0 +1,33 @@ + +import com.typesafe.tools.mima.plugin.MimaPlugin +import sbt._ +import sbt.Keys._ +import sys.process._ + +object Mima { + + private def stable(ver: String): Boolean = + ver.exists(c => c != '0' && c != '.') && + ver + .replace("-RC", "-") + .forall(c => c == '.' || c == '-' || c.isDigit) + + def binaryCompatibilityVersions: Set[String] = + Seq("git", "tag", "--merged", "HEAD^", "--contains", "736d5c11") + .!! + .linesIterator + .map(_.trim) + .filter(_.startsWith("v")) + .map(_.stripPrefix("v")) + .filter(stable) + .toSet + + def settings: Seq[Setting[_]] = Seq( + MimaPlugin.autoImport.mimaPreviousArtifacts := { + binaryCompatibilityVersions.map { ver => + (organization.value % moduleName.value % ver).cross(crossVersion.value) + } + } + ) + +}