Skip to content

Commit 945d1c8

Browse files
Test skeleton for binary compat checks
1 parent 80548cc commit 945d1c8

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package org.example
2+
3+
object Lib
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package org.example
2+
3+
object Lib
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import org.junit.{Assert, Test}
2+
3+
import build.BuildInfo._
4+
5+
import com.typesafe.tools.mima.lib.MiMaLib
6+
import com.typesafe.tools.mima.core.Config
7+
8+
class BinaryCompaTest {
9+
@Test
10+
def compat(): Unit = {
11+
Config.setup("foo", Array(oldClasspath, newClasspath))
12+
val mima = new MiMaLib(Config.baseClassPath)
13+
val allProblems = mima.collectProblems(oldClasspath, newClasspath)
14+
Assert.assertTrue(allProblems.isEmpty)
15+
}
16+
}

build.sbt

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ lazy val root = project
1414

1515
// == Core Libraries ==
1616

17+
lazy val junit = libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test
18+
1719
lazy val compat = crossProject(JSPlatform, JVMPlatform)
1820
.withoutSuffixFor(JVMPlatform)
1921
.crossType(CrossType.Pure)
@@ -32,7 +34,7 @@ lazy val compat = crossProject(JSPlatform, JVMPlatform)
3234
)
3335
.jvmSettings(
3436
OsgiKeys.exportPackage := Seq(s"scala.collection.compat.*;version=${version.value}"),
35-
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test",
37+
junit,
3638
javaHome in Compile := {
3739
val oldValue = (javaHome in Compile).value
3840
val isOnCi = sys.env.get("CI").isDefined
@@ -65,6 +67,36 @@ lazy val compat = crossProject(JSPlatform, JVMPlatform)
6567
lazy val compatJVM = compat.jvm
6668
lazy val compatJS = compat.js
6769

70+
lazy val `binary-compat-old` = project
71+
.in(file("binary-compat/old"))
72+
.settings(scalaVersion := scala212)
73+
.disablePlugins(ScalafixPlugin)
74+
75+
lazy val `binary-compat-new` = project
76+
.in(file("binary-compat/new"))
77+
.settings(scalaVersion := scala212)
78+
.dependsOn(compatJVM)
79+
.disablePlugins(ScalafixPlugin)
80+
81+
lazy val `binary-compat` = project
82+
.in(file("binary-compat/test"))
83+
.settings(
84+
scalaVersion := scala212,
85+
libraryDependencies += "com.typesafe" %% "mima-reporter" % "0.3.0" % Test,
86+
junit,
87+
buildInfoPackage := "build",
88+
buildInfoKeys := Seq[BuildInfoKey](
89+
"oldClasspath" -> (classDirectory in (`binary-compat-old`, Compile)).value.toString,
90+
"newClasspath" -> (classDirectory in (`binary-compat-new`, Compile)).value.toString
91+
),
92+
test in Test := (test in Test).dependsOn(
93+
compile in (`binary-compat-old`, Compile),
94+
compile in (`binary-compat-new`, Compile)
95+
).value
96+
)
97+
.enablePlugins(BuildInfoPlugin)
98+
.disablePlugins(ScalafixPlugin)
99+
68100
lazy val scalafixRules = project
69101
.in(file("scalafix/rules"))
70102
.settings(

0 commit comments

Comments
 (0)