Port of the MiMa Sbt Plugin
After importing it in the build.sc
file:
import $ivy.`com.github.lolgab::mill-mima::x.y.z`
import com.github.lolgab.mill.mima._
this plugin can be mixed in a ScalaModule with PublishModule
defining the mimaPreviousVersions
:
object module extends ScalaModule with PublishModule with Mima {
def mimaPreviousVersions = Seq("1.0.0", "1.5.0")
// ... other settings
}
The required direction of binary compatibility can be set in two ways:
-
By setting the
MIMA_CHECK_DIRECTION
environment variable when running MillMIMA_CHECK_DIRECTION=forward mill __.mimaReportBinaryIssues
The possible values are
backward
(default),forward
andboth
.This is useful when you want to check for different directions at the same time, for example when you might want to have separate CI checks for forward and backward compatibility to evaluate if changes introduce source compatibilities.
-
By overriding
mimaCheckDirection
:override def mimaCheckDirection = CheckDirection.Both
The possible values are
CheckDirection.Backward
(default),CheckDirection/Forward
andCheckDirection.Both
.This is useful when the setting is static and you want to keep the setting in your
build.sc
file.
When MiMa reports a binary incompatibility that you consider acceptable, such as a change in an internal package,
you need to use the mimaBinaryIssueFilters
setting to filter it out and get mimaReportBinaryIssues
to
pass, like so:
import com.github.lolgab.mill.mima._
object mylibrary extends ScalaModule with PublishModule with Mima {
override def mimaBinaryIssueFilters = super.mimaBinaryIssueFilters() ++ Seq(
ProblemFilter.exclude[MissingClassProblem]("com.example.mylibrary.internal.Foo")
)
// ... other settings
}
You may also use wildcards in the package and/or the top Problem
parent type for such situations:
import com.github.lolgab.mill.mima._
override def mimaBinaryIssueFilters = super.mimaBinaryIssueFilters() ++ Seq(
ProblemFilter.exclude[MissingClassProblem]("com.example.mylibrary.internal.*")
)
The fully-qualified class names of annotations that exclude parts of the API from problem checking.
import com.github.lolgab.mill.mima._
object mylibrary extends ScalaModule with PublishModule with Mima {
override def mimaExcludeAnnotations = Seq(
Seq("mima.annotation.exclude")
)
// ... other settings
}
If your previous artifacts have a different groupId
or artifactId
you can check against them
using mimaPreviousArtifacts
instead of millPreviousVersions
(since millPreviousVersions
assumes the same groupId
and artifactId
):
def mimaPreviousArtifacts = Agg(
ivy"my_group_id::module:my_previous_version"
)
The PathRef
to the actual artifact that is being checked for binary compatibility. Defaults to use the result of the jar
target.
Up until version 0.0.24
, this was implemented as compile().classes
, for compatibility to the sbt plugin.
def mimaCurrentArtifact = T {
compile().classes
}
Filters to apply to binary issues found grouped by version of a module checked against. These filters only apply to backward compatibility checking.
Signature:
def mimaBackwardIssueFilters: Target[Map[String, Seq[ProblemFilter]]]
Filters to apply to binary issues found grouped by version of a module checked against. These filters only apply to forward compatibility checking.
Signature:
def mimaForwardIssueFilters: Target[Map[String, Seq[ProblemFilter]]]
Most MiMa checks (DirectMissingMethod
,IncompatibleResultType
, IncompatibleMethType
, etc) are against the "method descriptor", which is the "raw" type signature, without any information about generic parameters.
The IncompatibleSignature
check compares the Signature
, which includes the full signature including generic parameters. This can catch real incompatibilities, but also sometimes triggers for a change in generics that would not in fact cause problems at run time. Notably, it will warn when updating your project to scala 2.12.9+ or 2.13.1+, see this issue for details.
You can opt-in to this check by setting:
def mimaReportSignatureProblems = true
- Update MiMa to
1.1.3
- Support Mill
0.11.0
- Support Mill
0.11.0-M11
- Support Mill
0.11.0-M10
- Support Mill
0.11.0-M9
- Support Mill
0.11.0-M8
- Add support for
MIMA_CHECK_DIRECTION
environment variable
- Update MiMa to
1.1.2
- Support Mill
0.11.0-M7
- Update MiMa to
1.1.1
- Add
ReadWriter
s forCheckDirection
- Run Mima in a separate classloader.
Now
Problem
s are mirrored in thecom.github.lolgab.mill.mima
package instead and thecom.typesafe.tools.mima.core
package
- Support Mill 0.10
- Correct hint in error message to match plugin's ProblemFilter class
- Support Mill 0.10.0-M5
- Support Mill 0.10.0-M4
- Add
mimaExcludeAnnotations
target - Bump MiMa to
1.0.1
- Fix
mill-scalalib
dependency to be incompileIvyDeps
- Add support to resolve multiple previous artifacts
- Add
mimaPreviousVersions
target - Redefine
prepareOffline
to include MiMa artifacts
- Support problem filters
- Change artifact name from
mima_mill0.9
tomill-mima_mill0.9
First release