Skip to content

Commit

Permalink
Make signature problems opt-in
Browse files Browse the repository at this point in the history
Set `ThisBuild / mimaReportSignatureProblems := true` to opt-in.
  • Loading branch information
dwijnand committed Feb 10, 2020
1 parent 3908e67 commit 972e1a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ object MimaKeys extends MimaKeys

class MimaKeys {

final val mimaPreviousArtifacts = settingKey[Set[ModuleID]]("Previous released artifacts used to test binary compatibility.")
final val mimaReportBinaryIssues = taskKey[Unit]("Logs all binary incompatibilities to the sbt console/logs.")
final val mimaBinaryIssueFilters = taskKey[Seq[ProblemFilter]]("Filters to apply to binary issues found. Applies both to backward and forward binary compatibility checking.")
final val mimaFailOnProblem = settingKey[Boolean]("if true, fail the build on binary incompatibility detection.")
final val mimaFailOnNoPrevious = settingKey[Boolean]("if true, fail the build if no previous artifacts are set.")
final val mimaPreviousArtifacts = settingKey[Set[ModuleID]]("Previous released artifacts used to test binary compatibility.")
final val mimaReportBinaryIssues = taskKey[Unit]("Logs all binary incompatibilities to the sbt console/logs.")
final val mimaBinaryIssueFilters = taskKey[Seq[ProblemFilter]]("Filters to apply to binary issues found. Applies both to backward and forward binary compatibility checking.")
final val mimaFailOnProblem = settingKey[Boolean]("if true, fail the build on binary incompatibility detection.")
final val mimaFailOnNoPrevious = settingKey[Boolean]("if true, fail the build if no previous artifacts are set.")
final val mimaReportSignatureProblems = settingKey[Boolean]("if true, report `IncompatibleSignatureProblem`s.")

final val mimaPreviousClassfiles = taskKey[Map[ModuleID, File]]("Directories or jars containing the previous class files used to test compatibility with a given module.")
final val mimaCurrentClassfiles = taskKey[File]("Directory or jar containing the current class files used to test compatibility.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package plugin

import sbt._
import sbt.Keys._
import com.typesafe.tools.mima.core.{ IncompatibleSignatureProblem, ProblemFilters }

/** MiMa's sbt plugin. */
object MimaPlugin extends AutoPlugin {
Expand All @@ -17,6 +18,7 @@ object MimaPlugin extends AutoPlugin {
mimaBinaryIssueFilters := Nil,
mimaFailOnProblem := true,
mimaFailOnNoPrevious := true,
mimaReportSignatureProblems := false,
mimaCheckDirection := "backward",
)

Expand All @@ -29,7 +31,7 @@ object MimaPlugin extends AutoPlugin {
problems._1,
problems._2,
mimaFailOnProblem.value,
mimaBinaryIssueFilters.value,
binaryIssueFilters.value,
mimaBackwardIssueFilters.value,
mimaForwardIssueFilters.value,
log,
Expand Down Expand Up @@ -63,6 +65,11 @@ object MimaPlugin extends AutoPlugin {
/** Setup MiMa with default settings, applicable for most projects. */
def mimaDefaultSettings: Seq[Setting[_]] = globalSettings ++ buildSettings ++ projectSettings

private def binaryIssueFilters = Def.task {
val noSigs = ProblemFilters.exclude[IncompatibleSignatureProblem]("*")
mimaBinaryIssueFilters.value ++ (if (mimaReportSignatureProblems.value) Nil else Seq(noSigs))
}

// Allows reuse between mimaFindBinaryIssues and mimaReportBinaryIssues
// without blowing up the Akka build's heap
private def binaryIssuesIterator = Def.task {
Expand Down

0 comments on commit 972e1a7

Please sign in to comment.