From 72f2da643d8cdd99712df8cd272ece64c34c1966 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 2 Apr 2024 13:14:28 +0200 Subject: [PATCH] Strengthen MiMa checks Using the latest patch release of the current minor version may lead to some breakages that are not properly checked/tagged in the MiMa filers. For example, if we accidentally introduce a breaking change in 3.M.1 but check against 3.M.2, we would lose this braking change before the next minor release. If we would check against 3.M.0, we would catch this. In general we need to track all the changes that have happened in the current minor version. There should not be any breaking changes unless the PR needs a minor release. --- project/Build.scala | 27 ++++++++++++++++----------- project/MiMaFilters.scala | 20 ++++++++++---------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 69441d0aaa01..d8bcd131f232 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -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 @@ -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 { @@ -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: @@ -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, diff --git a/project/MiMaFilters.scala b/project/MiMaFilters.scala index 0051d744f787..46c060cacf39 100644 --- a/project/MiMaFilters.scala +++ b/project/MiMaFilters.scala @@ -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"), @@ -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, @@ -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 ) }