From 03ed05c0fcb948237d66f032c4e530b2349404b9 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 11 Oct 2018 12:28:03 -0700 Subject: Enable the Migration Manager Plugin to check for ABI changes --- .travis.yml | 2 +- build.sbt | 1 + project/MiMaSettings.scala | 28 ++++++++++++++++++++++++++++ project/plugins.sbt | 3 ++- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 project/MiMaSettings.scala diff --git a/.travis.yml b/.travis.yml index 7845eae..5ab8328 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,5 +8,5 @@ scala: script: - echo 'credentials += Credentials("Artifactory Realm", "drivergrp.jfrog.io", "sbt-publisher", sys.env("ARTIFACTORY_PASSWORD"))' > project/credentials.sbt - - sbt clean +test + - sbt clean compile checkAbi +test - if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_TAG" =~ ^v[0-9].* ]]; then sbt publish; fi diff --git a/build.sbt b/build.sbt index 18ab657..d4b3470 100644 --- a/build.sbt +++ b/build.sbt @@ -10,6 +10,7 @@ scalacOptions in ThisBuild in (Compile, doc) ++= Seq( "-doc-source-url", s"https://github.com/drivergroup/driver-core/blob/master€{FILE_PATH}.scala" ) +abiVersion in ThisBuild := "2.0.0-M3" val mockito = "org.mockito" % "mockito-core" % "1.9.5" val scalatest = "org.scalatest" %% "scalatest" % "3.0.5" diff --git a/project/MiMaSettings.scala b/project/MiMaSettings.scala new file mode 100644 index 0000000..d3ec3c1 --- /dev/null +++ b/project/MiMaSettings.scala @@ -0,0 +1,28 @@ +import com.typesafe.tools.mima.plugin.MimaPlugin +import sbt.{Def, _} +import sbt.Keys._ + +/** This plugin extends the Migration Manager (MiMa) Plugin with common settings + * for driver-core projects. + */ +object MiMaSettings extends AutoPlugin { + + override def requires = MimaPlugin + override def trigger = allRequirements + + object autoImport { + val abiVersion = settingKey[String]("Previous version of binary-compatible projects") + val checkAbi = taskKey[Unit]("Check ABI compatibility with declared abiVersion") + } + import autoImport._ + import MimaPlugin.autoImport._ + + override def buildSettings: Seq[Def.Setting[_]] = Seq(abiVersion := "") + override def projectSettings: Seq[Def.Setting[_]] = Seq( + mimaPreviousArtifacts := Set( + "xyz.driver" %% name.value % abiVersion.value + ), + checkAbi := mimaReportBinaryIssues.value + ) + +} diff --git a/project/plugins.sbt b/project/plugins.sbt index 736226d..f0e3a6d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1,2 @@ -addSbtPlugin("xyz.driver" % "sbt-settings" % "2.0.9") +addSbtPlugin("xyz.driver" % "sbt-settings" % "2.0.9") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0") -- cgit v1.2.3