Skip to content

Commit 30cd883

Browse files
authored
Improve MiMa failure error message (#19613)
Now it tells which filer list is related to this test. Example failure: ``` [error] scala3-library-bootstrapped: Failed binary compatibility check against org.scala-lang:scala3-library_3:3.3.0! Found 1 potential problems (filtered 35) [error] * abstract method ValOrDefDefMethods()scala.quoted.Quotes#reflectModule#ValOrDefDefMethods in interface scala.quoted.Quotes#reflectModule does not have a correspondent in other version [error] filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule.ValOrDefDefMethods") [error] [error] Filers in MiMaFilters.Scala3Library are used in this check [error] [error] stack trace is suppressed; run last scala3-library-bootstrapped / mimaReportBinaryIssues for the full output [error] (scala3-library-bootstrapped / mimaReportBinaryIssues) Failed binary compatibility check against org.scala-lang:scala3-library_3:3.3.0! Found 1 potential problems (filtered 35) ``` More documentation is available in `MiMaFilters.Scala3Library`. Refactored filter lists to strengthen TastyCore and Interfaces to use separate backward and forwards lists. Also extracted the Scala2LibraryBootstrappedMiMaFileters to reduce noise in the MiMaFilter files.
2 parents c6a0360 + 7fb1d8b commit 30cd883

File tree

3 files changed

+354
-298
lines changed

3 files changed

+354
-298
lines changed

Diff for: project/Build.scala

+21-6
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,9 @@ object Build {
531531
settings(commonMiMaSettings).
532532
settings(
533533
versionScheme := Some("semver-spec"),
534-
mimaBinaryIssueFilters ++= MiMaFilters.Interfaces
534+
mimaForwardIssueFilters := MiMaFilters.Interfaces.ForwardsBreakingChanges,
535+
mimaBackwardIssueFilters := MiMaFilters.Interfaces.BackwardsBreakingChanges,
536+
customMimaReportBinaryIssues("MiMaFilters.Interfaces"),
535537
)
536538

537539
/** Find an artifact with the given `name` in `classpath` */
@@ -1115,8 +1117,9 @@ object Build {
11151117
_.filterNot(file => file.data.getName == s"scala-library-$stdlibBootstrappedVersion.jar")
11161118
},
11171119
mimaCheckDirection := "both",
1118-
mimaBackwardIssueFilters := MiMaFilters.StdlibBootstrappedBackwards,
1119-
mimaForwardIssueFilters := MiMaFilters.StdlibBootstrappedForward,
1120+
mimaBackwardIssueFilters := Scala2LibraryBootstrappedMiMaFilters.BackwardsBreakingChanges,
1121+
mimaForwardIssueFilters := Scala2LibraryBootstrappedMiMaFilters.ForwardsBreakingChanges,
1122+
customMimaReportBinaryIssues("Scala2LibraryBootstrappedMiMaFilters"),
11201123
mimaPreviousArtifacts += "org.scala-lang" % "scala-library" % stdlibBootstrappedVersion,
11211124
mimaExcludeAnnotations ++= Seq(
11221125
"scala.annotation.experimental",
@@ -2102,6 +2105,15 @@ object Build {
21022105
packResourceDir += (baseDirectory.value / "bin" -> "bin"),
21032106
)
21042107

2108+
private def customMimaReportBinaryIssues(issueFilterLocation: String) = mimaReportBinaryIssues := {
2109+
mimaReportBinaryIssues.result.value match {
2110+
case Inc(inc: Incomplete) =>
2111+
streams.value.log.error(s"\nFilers in $issueFilterLocation are used in this check.\n ")
2112+
throw inc
2113+
case Value(v) => v
2114+
}
2115+
}
2116+
21052117
implicit class ProjectDefinitions(val project: Project) extends AnyVal {
21062118

21072119
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
@@ -2166,8 +2178,9 @@ object Build {
21662178
}
21672179
(thisProjectID.organization % crossedName % ltsDottyVersion)
21682180
},
2169-
mimaBackwardIssueFilters := MiMaFilters.LibraryBackwards,
2170-
mimaForwardIssueFilters := MiMaFilters.LibraryForward,
2181+
mimaForwardIssueFilters := MiMaFilters.Scala3Library.ForwardsBreakingChanges,
2182+
mimaBackwardIssueFilters := MiMaFilters.Scala3Library.BackwardsBreakingChanges,
2183+
customMimaReportBinaryIssues("MiMaFilters.Scala3Library"),
21712184
)
21722185
} else base
21732186
}
@@ -2181,7 +2194,9 @@ object Build {
21812194
versionScheme := Some("semver-spec"),
21822195
if (mode == Bootstrapped) Def.settings(
21832196
commonMiMaSettings,
2184-
mimaBinaryIssueFilters ++= MiMaFilters.TastyCore,
2197+
mimaForwardIssueFilters := MiMaFilters.TastyCore.ForwardsBreakingChanges,
2198+
mimaBackwardIssueFilters := MiMaFilters.TastyCore.BackwardsBreakingChanges,
2199+
customMimaReportBinaryIssues("MiMaFilters.TastyCore"),
21852200
) else {
21862201
Nil
21872202
}

0 commit comments

Comments
 (0)