Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
Enable MIMA in build, fix binary incompatibility (#195)
Browse files Browse the repository at this point in the history
* enable mima

* binary incompatibility fix

* revert ring change

* bumped version, disabled mima

* cache travis

* add ignored
  • Loading branch information
sritchie authored and johnynek committed Dec 19, 2016
1 parent 2c5bdad commit 29e4fc3
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ cache:
- $HOME/.ivy2/cache
- $HOME/.nvm

script: ./sbt ++$TRAVIS_SCALA_VERSION clean coreJS/test lawsJS/test && ./sbt ++$TRAVIS_SCALA_VERSION clean coverage coreJVM/test lawsJVM/test coverageReport && ./sbt ++$TRAVIS_SCALA_VERSION core:mimaReportBinaryIssues && ./sbt ++$TRAVIS_SCALA_VERSION docs/makeMicrosite
script:
- ./sbt ++$TRAVIS_SCALA_VERSION clean coreJS/test lawsJS/test
- ./sbt ++$TRAVIS_SCALA_VERSION clean coverage coreJVM/test lawsJVM/test coverageReport mimaReportBinaryIssues
- ./sbt ++$TRAVIS_SCALA_VERSION docs/makeMicrosite

after_success:
- bash <(curl -s https://codecov.io/bash)

notifications:
irc:
channels:
Expand Down
29 changes: 23 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import sbtunidoc.Plugin.UnidocKeys._
import ReleaseTransformations._
import com.typesafe.sbt.SbtGhPages.GhPagesKeys._
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact

lazy val scalaCheckVersion = "1.13.4"
lazy val scalaTestVersion = "3.0.0"
lazy val scalaTestVersion = "3.0.1"
lazy val disciplineVersion = "0.7.2"
lazy val catsVersion = "0.8.1"
lazy val catalystsVersion = "0.0.5"

lazy val buildSettings = Seq(
organization := "org.typelevel",
scalaVersion := "2.12.0",
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0")
scalaVersion := "2.12.1",
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1")
)

lazy val commonSettings = Seq(
Expand Down Expand Up @@ -101,12 +100,27 @@ lazy val aggregate = project.in(file("."))
.aggregate(coreJS, lawsJS)
.dependsOn(coreJS, lawsJS)

val binaryCompatibleVersion = "0.6.0"

/**
* Empty this each time we publish a new version (and bump the minor number)
*/
val ignoredABIProblems = {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
Seq(
exclude[ReversedMissingMethodProblem]("algebra.ring.RingFunctions.defaultFromDouble")
)
}

lazy val core = crossProject
.crossType(CrossType.Pure)
.settings(moduleName := "algebra")
.settings(mimaDefaultSettings: _*)
// TODO: update this to a published stable version, e.g. 0.4.0
//.settings(previousArtifact := Some("org.spire-math" %% "algebra" % "0.3.1"))
.settings(
mimaPreviousArtifacts := Set("org.typelevel" %% "algebra" % binaryCompatibleVersion),
mimaBinaryIssueFilters ++= ignoredABIProblems
)
.settings(libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-kernel" % catsVersion,
"org.scalacheck" %%% "scalacheck" % scalaCheckVersion % "test",
Expand All @@ -121,6 +135,9 @@ lazy val laws = crossProject
.crossType(CrossType.Pure)
.dependsOn(core)
.settings(moduleName := "algebra-laws")
.settings(mimaDefaultSettings: _*)
.settings(mimaPreviousArtifacts :=
Set("org.typelevel" %% "algebra-laws" % binaryCompatibleVersion))
.settings(algebraSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-kernel-laws" % catsVersion,
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/algebra/instances/bigDecimal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import algebra.ring._
package object bigDecimal extends BigDecimalInstances

trait BigDecimalInstances extends cats.kernel.instances.BigDecimalInstances {
implicit val bigDecimalAlgebra: BigDecimalAlgebra =
new BigDecimalAlgebra(MathContext.UNLIMITED)
implicit val bigDecimalAlgebra: BigDecimalAlgebra = new BigDecimalAlgebra()
}

class BigDecimalAlgebra(mc: MathContext) extends Field[BigDecimal] with Serializable {
def this() = this(MathContext.UNLIMITED)

val zero: BigDecimal = BigDecimal(0, mc)
val one: BigDecimal = BigDecimal(1, mc)

Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.11")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.12")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.18")
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "0.6.1-SNAPSHOT"
version in ThisBuild := "0.7.0-SNAPSHOT"

0 comments on commit 29e4fc3

Please sign in to comment.