Skip to content

Commit

Permalink
Setup mima plugin to check for binary compatibility (#1494)
Browse files Browse the repository at this point in the history
* Setup mima plugin to check for binary compatibility
* Enable binary compatibility checks in CI
* Added MiMa problem filters for known issues

Pull request: #1494
  • Loading branch information
lefou authored Sep 29, 2021
1 parent 6299da1 commit e452241
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- |
./mill -i contrib.testng.publishLocal
./mill -i integration.test "mill.integration.local.CaffeineTests"
- ./mill -i -k __.mimaReportBinaryIssues
include:
- java-version: 8
# buildcmd: ./mill -i integration.test "mill.integration.local.{BetterFilesTests,UpickleTests}"
Expand Down
45 changes: 41 additions & 4 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import $file.ci.shared
import $file.ci.upload
import $ivy.`org.scalaj::scalaj-http:2.4.2`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.9:0.1.2`
import $ivy.`com.github.lolgab::mill-mima_mill0.9:0.0.4`
import $ivy.`net.sourceforge.htmlcleaner:htmlcleaner:2.24`
import java.nio.file.attribute.PosixFilePermission

import com.github.lolgab.mill.mima
import coursier.maven.MavenRepository
import de.tobiasroeser.mill.vcs.version.VcsVersion
import mill._
Expand Down Expand Up @@ -109,7 +111,9 @@ object Deps {
}

def millVersion: T[String] = T { VcsVersion.vcsState().format() }
def millLastTag: T[String] = T { VcsVersion.vcsState().lastTag.get }
def millLastTag: T[String] = T {
VcsVersion.vcsState().lastTag.getOrElse(sys.error("No (last) git tag found. Your git history seems incomplete!"))
}
def millBinPlatform: T[String] = T {
val tag = millLastTag()
if(tag.contains("-M")) tag
Expand Down Expand Up @@ -149,13 +153,14 @@ trait MillCoursierModule extends CoursierModule {
trait MillApiModule
extends MillPublishModule
with ScalaModule
with MillCoursierModule {
with MillCoursierModule
with mima.Mima {
def scalaVersion = Deps.scalaVersion
override def ammoniteVersion = Deps.ammonite.dep.version
// def compileIvyDeps = Agg(Deps.acyclic)
// def scalacOptions = Seq("-P:acyclic:force")
// def scalacPluginIvyDeps = Agg(Deps.acyclic)

override def mimaPreviousVersions: T[Seq[String]] = Seq("0.10.0-M2", millLastTag()).distinct
}

trait MillModule extends MillApiModule { outer =>
Expand Down Expand Up @@ -326,6 +331,17 @@ object scalalib extends MillModule {
super.generatedSources() ++ Seq(PathRef(dest))
}

override def mimaBinaryIssueFilters = T {
import com.typesafe.tools.mima.core._
// In Milestone-Phase we're allowed to break binary compatibility
Seq(
mima.ProblemFilter.exclude[DirectMissingMethodProblem]("mill.scalalib.GenIdeaImpl.libraryXmlTemplate"),
mima.ProblemFilter.exclude[NewMixinForwarderProblem]("mill.scalalib.ScalaModule.resolvedIvyDeps"),
mima.ProblemFilter.exclude[NewMixinForwarderProblem]("mill.scalalib.ScalaModule.resolvedRunIvyDeps"),
mima.ProblemFilter.exclude[ReversedMissingMethodProblem]("mill.scalalib.ScalaModule.mill$scalalib$ScalaModule$$super$mandatoryIvyDeps")
).filter(_ => mimaPreviousVersions().contains("0.10.0-M2"))
}

override def testIvyDeps = super.testIvyDeps() ++ Agg(Deps.scalaCheck)
def testArgs = T{
val genIdeaArgs =
Expand Down Expand Up @@ -434,6 +450,19 @@ object scalajslib extends MillModule {

override def generatedSources: Target[Seq[PathRef]] = Seq(generatedBuildInfo())

// In Milestone-Phase we're allowed to break binary compatibility
override def mimaBinaryIssueFilters = T {
import com.typesafe.tools.mima.core._
Seq(
mima.ProblemFilter.exclude[NewMixinForwarderProblem](
"mill.scalajslib.ScalaJSModule.scalaLibraryIvyDeps"
),
mima.ProblemFilter.exclude[ReversedMissingMethodProblem](
"mill.scalajslib.ScalaJSModule.mill$scalajslib$ScalaJSModule$$super$mandatoryIvyDeps"
)
).filter(_ => mimaPreviousVersions().contains("0.10.0-M2"))
}

object api extends MillApiModule {
override def moduleDeps = Seq(main.api)
override def ivyDeps = Agg(Deps.sbtTestInterface)
Expand Down Expand Up @@ -466,7 +495,6 @@ object scalajslib extends MillModule {
}
}


object contrib extends MillModule {
object testng extends JavaModule with MillModule {
// pure Java implementation
Expand Down Expand Up @@ -660,6 +688,15 @@ object scalanativelib extends MillModule {
scalalib.backgroundwrapper.testArgs() ++
(for((k, v) <- mapping.to(Seq)) yield s"-D$k=$v")
}
// In Milestone-Phase we're allowed to break binary compatibility
override def mimaBinaryIssueFilters = T {
import com.typesafe.tools.mima.core._
Seq(
mima.ProblemFilter.exclude[NewMixinForwarderProblem]("mill.scalanativelib.ScalaNativeModule.transitiveIvyDeps"),
mima.ProblemFilter.exclude[ReversedMissingMethodProblem]("mill.scalanativelib.ScalaNativeModule.mill$scalanativelib$ScalaNativeModule$$super$mandatoryIvyDeps")
).filter(_ => mimaPreviousVersions().contains("0.10.0-M2"))
}

object api extends MillPublishModule {
override def ivyDeps = Agg(Deps.sbtTestInterface)
}
Expand Down
81 changes: 78 additions & 3 deletions ci/mill-bootstrap.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,90 @@
# We need to load a external plugins from another binary compatible slot
# * We need to load a external plugins from another binary compatible slot
# * mima-plugin isn't available for 0.10 yet

diff --git a/build.sc b/build.sc
index 2b1c53b7..a24465f2 100755
index c93275a2..96ff97cf 100755
--- a/build.sc
+++ b/build.sc
@@ -1,7 +1,7 @@
@@ -1,12 +1,10 @@
import $file.ci.shared
import $file.ci.upload
import $ivy.`org.scalaj::scalaj-http:2.4.2`
-import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.9:0.1.2`
-import $ivy.`com.github.lolgab::mill-mima_mill0.9:0.0.4`
+import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.2`
import $ivy.`net.sourceforge.htmlcleaner:htmlcleaner:2.24`
import java.nio.file.attribute.PosixFilePermission

-import com.github.lolgab.mill.mima
import coursier.maven.MavenRepository
import de.tobiasroeser.mill.vcs.version.VcsVersion
import mill._
@@ -153,14 +151,12 @@ trait MillCoursierModule extends CoursierModule {
trait MillApiModule
extends MillPublishModule
with ScalaModule
- with MillCoursierModule
- with mima.Mima {
+ with MillCoursierModule {
def scalaVersion = Deps.scalaVersion
override def ammoniteVersion = Deps.ammonite.dep.version
// def compileIvyDeps = Agg(Deps.acyclic)
// def scalacOptions = Seq("-P:acyclic:force")
// def scalacPluginIvyDeps = Agg(Deps.acyclic)
- override def mimaPreviousVersions: T[Seq[String]] = Seq("0.10.0-M2", millLastTag()).distinct
}

trait MillModule extends MillApiModule { outer =>
@@ -331,17 +327,6 @@ object scalalib extends MillModule {
super.generatedSources() ++ Seq(PathRef(dest))
}

- override def mimaBinaryIssueFilters = T {
- import com.typesafe.tools.mima.core._
- // In Milestone-Phase we're allowed to break binary compatibility
- Seq(
- mima.ProblemFilter.exclude[DirectMissingMethodProblem]("mill.scalalib.GenIdeaImpl.libraryXmlTemplate"),
- mima.ProblemFilter.exclude[NewMixinForwarderProblem]("mill.scalalib.ScalaModule.resolvedIvyDeps"),
- mima.ProblemFilter.exclude[NewMixinForwarderProblem]("mill.scalalib.ScalaModule.resolvedRunIvyDeps"),
- mima.ProblemFilter.exclude[ReversedMissingMethodProblem]("mill.scalalib.ScalaModule.mill$scalalib$ScalaModule$$super$mandatoryIvyDeps")
- ).filter(_ => mimaPreviousVersions().contains("0.10.0-M2"))
- }
-
override def testIvyDeps = super.testIvyDeps() ++ Agg(Deps.scalaCheck)
def testArgs = T{
val genIdeaArgs =
@@ -450,19 +435,6 @@ object scalajslib extends MillModule {

override def generatedSources: Target[Seq[PathRef]] = Seq(generatedBuildInfo())

- // In Milestone-Phase we're allowed to break binary compatibility
- override def mimaBinaryIssueFilters = T {
- import com.typesafe.tools.mima.core._
- Seq(
- mima.ProblemFilter.exclude[NewMixinForwarderProblem](
- "mill.scalajslib.ScalaJSModule.scalaLibraryIvyDeps"
- ),
- mima.ProblemFilter.exclude[ReversedMissingMethodProblem](
- "mill.scalajslib.ScalaJSModule.mill$scalajslib$ScalaJSModule$$super$mandatoryIvyDeps"
- )
- ).filter(_ => mimaPreviousVersions().contains("0.10.0-M2"))
- }
-
object api extends MillApiModule {
override def moduleDeps = Seq(main.api)
override def ivyDeps = Agg(Deps.sbtTestInterface)
@@ -688,14 +660,6 @@ object scalanativelib extends MillModule {
scalalib.backgroundwrapper.testArgs() ++
(for((k, v) <- mapping.to(Seq)) yield s"-D$k=$v")
}
- // In Milestone-Phase we're allowed to break binary compatibility
- override def mimaBinaryIssueFilters = T {
- import com.typesafe.tools.mima.core._
- Seq(
- mima.ProblemFilter.exclude[NewMixinForwarderProblem]("mill.scalanativelib.ScalaNativeModule.transitiveIvyDeps"),
- mima.ProblemFilter.exclude[ReversedMissingMethodProblem]("mill.scalanativelib.ScalaNativeModule.mill$scalanativelib$ScalaNativeModule$$super$mandatoryIvyDeps")
- ).filter(_ => mimaPreviousVersions().contains("0.10.0-M2"))
- }

object api extends MillPublishModule {
override def ivyDeps = Agg(Deps.sbtTestInterface)

0 comments on commit e452241

Please sign in to comment.