Skip to content

Improve MiMa failure error message #19613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,9 @@ object Build {
settings(commonMiMaSettings).
settings(
versionScheme := Some("semver-spec"),
mimaBinaryIssueFilters ++= MiMaFilters.Interfaces
mimaForwardIssueFilters := MiMaFilters.Interfaces.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.Interfaces.BackwardsBreakingChanges,
customMimaReportBinaryIssues("MiMaFilters.Interfaces"),
)

/** Find an artifact with the given `name` in `classpath` */
Expand Down Expand Up @@ -1115,8 +1117,9 @@ object Build {
_.filterNot(file => file.data.getName == s"scala-library-$stdlibBootstrappedVersion.jar")
},
mimaCheckDirection := "both",
mimaBackwardIssueFilters := MiMaFilters.StdlibBootstrappedBackwards,
mimaForwardIssueFilters := MiMaFilters.StdlibBootstrappedForward,
mimaBackwardIssueFilters := Scala2LibraryBootstrappedMiMaFilters.BackwardsBreakingChanges,
mimaForwardIssueFilters := Scala2LibraryBootstrappedMiMaFilters.ForwardsBreakingChanges,
customMimaReportBinaryIssues("Scala2LibraryBootstrappedMiMaFilters"),
mimaPreviousArtifacts += "org.scala-lang" % "scala-library" % stdlibBootstrappedVersion,
mimaExcludeAnnotations ++= Seq(
"scala.annotation.experimental",
Expand Down Expand Up @@ -2102,6 +2105,15 @@ object Build {
packResourceDir += (baseDirectory.value / "bin" -> "bin"),
)

private def customMimaReportBinaryIssues(issueFilterLocation: String) = mimaReportBinaryIssues := {
mimaReportBinaryIssues.result.value match {
case Inc(inc: Incomplete) =>
streams.value.log.error(s"\nFilers in $issueFilterLocation are used in this check.\n ")
throw inc
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if there is a cleaner way to do this.

case Value(v) => v
}
}

implicit class ProjectDefinitions(val project: Project) extends AnyVal {

// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
Expand Down Expand Up @@ -2166,8 +2178,9 @@ object Build {
}
(thisProjectID.organization % crossedName % ltsDottyVersion)
},
mimaBackwardIssueFilters := MiMaFilters.LibraryBackwards,
mimaForwardIssueFilters := MiMaFilters.LibraryForward,
mimaForwardIssueFilters := MiMaFilters.Scala3Library.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.Scala3Library.BackwardsBreakingChanges,
customMimaReportBinaryIssues("MiMaFilters.Scala3Library"),
)
} else base
}
Expand All @@ -2181,7 +2194,9 @@ object Build {
versionScheme := Some("semver-spec"),
if (mode == Bootstrapped) Def.settings(
commonMiMaSettings,
mimaBinaryIssueFilters ++= MiMaFilters.TastyCore,
mimaForwardIssueFilters := MiMaFilters.TastyCore.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.TastyCore.BackwardsBreakingChanges,
customMimaReportBinaryIssues("MiMaFilters.TastyCore"),
) else {
Nil
}
Expand Down
Loading