Skip to content

Strengthen MiMa checks #20068

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 1 commit into from
Apr 19, 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: 16 additions & 11 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,22 @@ object Build {
val publishedDottyVersion = referenceVersion
val sbtDottyVersion = "0.5.5"

/** Version against which we check binary compatibility.
/** Minor version against which we check binary compatibility.
*
* This must be the latest published release in the same versioning line.
* For example, if the next version is going to be 3.1.4, then this must be
* set to 3.1.3. If it is going to be 3.1.0, it must be set to the latest
* 3.0.x release.
* This must be the earliest published release in the same versioning line.
* For a baseVersion `3.M.P` the mimaPreviousDottyVersion should be set to:
* - `3.M.0` if `P > 0`
* - `3.(M-1).0` if `P = 0`
*/
val previousDottyVersion = "3.4.1"
val mimaPreviousDottyVersion = "3.4.0"

/** Version against which we check binary compatibility. */
val ltsDottyVersion = "3.3.0"
/** LTS version against which we check binary compatibility.
*
* This must be the earliest published release in the LTS versioning line.
* For example, if the latest LTS release is be 3.3.4, then this must be
* set to 3.3.0.
*/
val mimaPreviousLTSDottyVersion = "3.3.0"

object CompatMode {
final val BinaryCompatible = 0
Expand Down Expand Up @@ -500,7 +505,7 @@ object Build {
case cv: Disabled => thisProjectID.name
case cv: Binary => s"${thisProjectID.name}_${cv.prefix}3${cv.suffix}"
}
(thisProjectID.organization % crossedName % previousDottyVersion)
(thisProjectID.organization % crossedName % mimaPreviousDottyVersion)
},

mimaCheckDirection := (compatMode match {
Expand Down Expand Up @@ -1149,7 +1154,7 @@ object Build {
},
tastyMiMaConfig ~= { _.withMoreProblemFilters(TastyMiMaFilters.StdlibBootstrapped) },
tastyMiMaReportIssues := tastyMiMaReportIssues.dependsOn(Def.task {
val minorVersion = previousDottyVersion.split('.')(1)
val minorVersion = mimaPreviousDottyVersion.split('.')(1)
// TODO find a way around this and test in the CI
streams.value.log.warn(
s"""To allow TASTy-MiMa to read TASTy files generated by this version of the compile you must:
Expand Down Expand Up @@ -2183,7 +2188,7 @@ object Build {
case cv: Disabled => thisProjectID.name
case cv: Binary => s"${thisProjectID.name}_${cv.prefix}3${cv.suffix}"
}
(thisProjectID.organization % crossedName % ltsDottyVersion)
(thisProjectID.organization % crossedName % mimaPreviousLTSDottyVersion)
},
mimaForwardIssueFilters := MiMaFilters.Scala3Library.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.Scala3Library.BackwardsBreakingChanges,
Expand Down
20 changes: 10 additions & 10 deletions project/MiMaFilters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ object MiMaFilters {

val ForwardsBreakingChanges: Map[String, Seq[ProblemFilter]] = Map(
// Additions that require a new minor version of the library
Build.previousDottyVersion -> Seq(
Build.mimaPreviousDottyVersion -> Seq(
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.annotation.experimental.this"),
),

// Additions since last LTS
Build.ltsDottyVersion -> Seq(
Build.mimaPreviousLTSDottyVersion -> Seq(
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule.ValOrDefDefMethods"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule.ValOrDefDefTypeTest"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule#defnModule.FunctionClass"),
Expand Down Expand Up @@ -48,10 +48,10 @@ object MiMaFilters {
// Only exceptional cases should be added here.

// Breaking changes since last reference version
Build.previousDottyVersion -> Seq.empty, // We should never break backwards compatibility
Build.mimaPreviousDottyVersion -> Seq.empty, // We should never break backwards compatibility

// Breaking changes since last LTS
Build.ltsDottyVersion -> Seq(
Build.mimaPreviousLTSDottyVersion -> Seq(
// Quotes is assumed to only be implemented by the compiler and on the same version of the library.
// It is exceptionally OK to break this compatibility. In these cases, there add new abstract methods that would
// potentially not be implemented by others. If some other library decides to implement these,
Expand All @@ -71,35 +71,35 @@ object MiMaFilters {
object TastyCore {
val ForwardsBreakingChanges: Map[String, Seq[ProblemFilter]] = Map(
// Additions that require a new minor version of tasty core
Build.previousDottyVersion -> Seq(
Build.mimaPreviousDottyVersion -> Seq(
ProblemFilters.exclude[DirectMissingMethodProblem]("dotty.tools.tasty.TastyFormat.FLEXIBLEtype")
),

// Additions since last LTS
Build.ltsDottyVersion -> Seq(
Build.mimaPreviousLTSDottyVersion -> Seq(
)
)

val BackwardsBreakingChanges: Map[String, Seq[ProblemFilter]] = Map(
// Breaking changes since last LTS
Build.ltsDottyVersion -> Seq.empty // We should never break backwards compatibility
Build.mimaPreviousLTSDottyVersion -> Seq.empty // We should never break backwards compatibility
)
}

object Interfaces {
val ForwardsBreakingChanges: Map[String, Seq[ProblemFilter]] = Map(
// Additions that require a new minor version of interfaces
Build.previousDottyVersion -> Seq(
Build.mimaPreviousDottyVersion -> Seq(
),

// Additions since last LTS
Build.ltsDottyVersion -> Seq(
Build.mimaPreviousLTSDottyVersion -> Seq(
)
)

val BackwardsBreakingChanges: Map[String, Seq[ProblemFilter]] = Map(
// Breaking changes since last LTS
Build.ltsDottyVersion -> Seq.empty // We should never break backwards compatibility
Build.mimaPreviousLTSDottyVersion -> Seq.empty // We should never break backwards compatibility
)
}

Expand Down
Loading