gmethvin commented on code in PR #532:
URL: https://github.com/apache/incubator-pekko/pull/532#discussion_r1468685903


##########
project/MiMa.scala:
##########
@@ -29,35 +27,36 @@ object MiMa extends AutoPlugin {
 
   override val projectSettings = Seq(
     mimaReportSignatureProblems := true,
-    mimaPreviousArtifacts := pekkoPreviousArtifacts(name.value, 
organization.value),
-    checkMimaFilterDirectories := checkFilterDirectories(baseDirectory.value))
-
-  def checkFilterDirectories(moduleRoot: File): Unit = {
-    val nextVersionFilterDir =
-      moduleRoot / "src" / "main" / "mima-filters" / s"1.0.${latestPatchOf10 + 
1}.backwards.excludes"
-    if (nextVersionFilterDir.exists()) {
-      throw new IllegalArgumentException(s"Incorrect mima filter directory 
exists: '$nextVersionFilterDir' " +
-        s"should be with number from current release '${moduleRoot / "src" / 
"main" / "mima-filters" / s"1.0.$latestPatchOf10.backwards.excludes"}")
-    }
-  }
-
-  def pekkoPreviousArtifacts(
-      projectName: String,
-      organization: String): Set[sbt.ModuleID] = {
-    val versions: Seq[String] = {
-      val firstPatchOf10 = 0
-
-      val pekko10Previous = expandVersions(1, 0, 0 to latestPatchOf10)
-
-      pekko10Previous
+    mimaPreviousArtifacts := {
+      previousStableVersion.value match {
+        case Some(previousStableVersion) =>
+          val Some((currentMajor, currentMinor)) = 
CrossVersion.partialVersion(version.value)
+          val Some((previousStableMajor, _)) = 
CrossVersion.partialVersion(previousStableVersion)
+          // If we bump up the major then lets assume this intentionally 
breaks binary compatibility
+          // so lets not check any artifacts
+          // See 
https://github.com/sbt/sbt-dynver/issues/70#issuecomment-458620722
+          if (currentMajor == previousStableMajor + 1 && currentMinor == 0)
+            Set.empty
+          else
+            Set(organization.value %% moduleName.value % previousStableVersion)
+        case None => Set.empty
+      }
+    },
+    checkMimaFilterDirectories := checkFilterDirectories(baseDirectory.value, 
version.value))
+
+  def checkFilterDirectories(moduleRoot: File, version: String): Unit = {
+    val strippedPatchRegex = """(\d+)(.*)""".r

Review Comment:
   This regex doesn't make sense if we're matching against the whole version—if 
you have a version of `1.1.0` then you're extracting `.1.0` as the patch 
version which doesn't parse as an int. Did you want something like 
`\d+[.]\d+[.](\d+).*`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org
For additional commands, e-mail: notifications-h...@pekko.apache.org

Reply via email to