Exclude filter don't work in 0.0.6
lefou opened this issue ยท 7 comments
I have some version specific backward issue filters defined:
override def mimaBackwardIssueFilters: Target[Map[String, Seq[ProblemFilter]]] = Map(
// probably false positives after bump to Scala 2.13.7 from 2.13.6
"0.10.0-M4" -> Seq(
ProblemFilter.exclude[IncompatibleSignatureProblem]("mill.api.Ctx.args"),
ProblemFilter.exclude[IncompatibleSignatureProblem]("mill.api.Ctx.this"),
ProblemFilter.exclude[IncompatibleSignatureProblem]("mill.api.Ctx#Args.args")
)
)
When using mill-mima
in version 0.0.5
these are correctly ignored. After bumping the version to 0.0.6
they no longer work and the issues were reported. Both were run with mill 0.9.10.
$ mill main.api.mimaReportBinaryIssues
[50/50] main.api.mimaReportBinaryIssues
Scanning binary compatibility in /home/lefou/work/opensource/mill/out/main/api/compile/dest/classes ...
Found 3 issue when checking against com.lihaoyi:mill-main-api_2.13:0.10.0-M4
* method args()scala.collection.immutable.IndexedSeq in class mill.api.Ctx has a different generic signature in current version, where it is ()Lscala/collection/immutable/IndexedSeq<Ljava/lang/Object;>; rather than ()Lscala/collection/immutable/IndexedSeq<*>;. See https://github.com/lightbend/mima#incompatiblesignatureproblem
filter with: ProblemFilters.exclude[IncompatibleSignatureProblem]("mill.api.Ctx.args")
* method this(scala.collection.immutable.IndexedSeq,scala.Function0,mill.api.Logger,os.Path,scala.collection.immutable.Map,scala.Function1,mill.api.TestReporter,os.Path)Unit in class mill.api.Ctx has a different generic signature in current version, where it is (Lscala/collection/immutable/IndexedSeq<Ljava/lang/Object;>;Lscala/Function0<Los/Path;>;Lmill/api/Logger;Los/Path;Lscala/collection/immutable/Map<Ljava/lang/String;Ljava/lang/String;>;Lscala/Function1<Ljava/lang/Object;Lscala/Option<Lmill/api/CompileProblemReporter;>;>;Lmill/api/TestReporter;Los/Path;)V rather than (Lscala/collection/immutable/IndexedSeq<*>;Lscala/Function0<Los/Path;>;Lmill/api/Logger;Los/Path;Lscala/collection/immutable/Map<Ljava/lang/String;Ljava/lang/String;>;Lscala/Function1<Ljava/lang/Object;Lscala/Option<Lmill/api/CompileProblemReporter;>;>;Lmill/api/TestReporter;Los/Path;)V. See https://github.com/lightbend/mima#incompatiblesignatureproblem
filter with: ProblemFilters.exclude[IncompatibleSignatureProblem]("mill.api.Ctx.this")
* abstract method args()scala.collection.immutable.IndexedSeq in interface mill.api.Ctx#Args has a different generic signature in current version, where it is ()Lscala/collection/immutable/IndexedSeq<Ljava/lang/Object;>; rather than ()Lscala/collection/immutable/IndexedSeq<*>;. See https://github.com/lightbend/mima#incompatiblesignatureproblem
filter with: ProblemFilters.exclude[IncompatibleSignatureProblem]("mill.api.Ctx#Args.args")
1 targets failed
main.api.mimaReportBinaryIssues Failed binary compatibility check! Found 3 potential problems
This happened in mill repository, PR com-lihaoyi/mill#1569, GHA run https://github.com/com-lihaoyi/mill/runs/4217888475?check_suite_focus=true#step:5:2941
This is very weird. I checked the diff and no Scala files has changed in mill-mima.
Also I diffed the source files and the pom in the published artifacts and they are the same.
I tried to put again the manual suffix and the problem goes away ๐
diff --git a/build.sc b/build.sc
index a5cd112f..3edca301 100755
--- a/build.sc
+++ b/build.sc
@@ -2,7 +2,7 @@ import $file.ci.shared
import $file.ci.upload
import $ivy.`org.scalaj::scalaj-http:2.4.2`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.2-4-dcde72`
-import $ivy.`com.github.lolgab::mill-mima::0.0.6`
+import $ivy.`com.github.lolgab::mill-mima_mill0.9:0.0.6`
import $ivy.`net.sourceforge.htmlcleaner:htmlcleaner:2.24`
import java.nio.file.attribute.PosixFilePermission
I gets even weirder. It works as expected with the new syntax but the 0.0.5
version.
diff --git a/build.sc b/build.sc
index a5cd112f..6d29ba77 100755
--- a/build.sc
+++ b/build.sc
@@ -2,7 +2,7 @@ import $file.ci.shared
import $file.ci.upload
import $ivy.`org.scalaj::scalaj-http:2.4.2`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.2-4-dcde72`
-import $ivy.`com.github.lolgab::mill-mima::0.0.6`
+import $ivy.`com.github.lolgab::mill-mima::0.0.5`
import $ivy.`net.sourceforge.htmlcleaner:htmlcleaner:2.24`
import java.nio.file.attribute.PosixFilePermission
When I comment out one of these filter rules, I can see that the other are applied.
diff --git a/build.sc b/build.sc
index a5cd112f..6732a832 100755
--- a/build.sc
+++ b/build.sc
@@ -235,7 +235,7 @@ object main extends MillModule {
override def mimaBackwardIssueFilters: Target[Map[String, Seq[ProblemFilter]]] = Map(
// probably false positives after bump to Scala 2.13.7 from 2.13.6
"0.10.0-M4" -> Seq(
- ProblemFilter.exclude[IncompatibleSignatureProblem]("mill.api.Ctx.args"),
+// ProblemFilter.exclude[IncompatibleSignatureProblem]("mill.api.Ctx.args"),
ProblemFilter.exclude[IncompatibleSignatureProblem]("mill.api.Ctx.this"),
ProblemFilter.exclude[IncompatibleSignatureProblem]("mill.api.Ctx#Args.args")
)
$ mill -d main.api.mimaReportBinaryIssues
Using explicit system properties: Map()
[4/50] mill.scalalib.ZincWorkerModule.worker
ZinkWorker: using cache size 1
[33/50] de.tobiasroeser.mill.vcs.version.VcsVersion.vcsState
[50/50] main.api.mimaReportBinaryIssues
Scanning binary compatibility in /home/lefou/work/opensource/mill/out/main/api/compile/dest/classes ...
Found 1 issue when checking against com.lihaoyi:mill-main-api_2.13:0.10.0-M4
* method args()scala.collection.immutable.IndexedSeq in class mill.api.Ctx has a different generic signature in current version, where it is ()Lscala/collection/immutable/IndexedSeq<Ljava/lang/Object;>; rather than ()Lscala/collection/immutable/IndexedSeq<*>;. See https://github.com/lightbend/mima#incompatiblesignatureproblem
filter with: ProblemFilters.exclude[IncompatibleSignatureProblem]("mill.api.Ctx.args")
1 targets failed
main.api.mimaReportBinaryIssues Failed binary compatibility check! Found 1 potential problems (filtered 2)
At first, I had the suspicion that some classloading issues might be the culprit, but it could also be some other issue in MiMa, probably related to some equals/hashcode stuff. Maybe, the JSON-serialized ProblemFilter
that proxies the real filter to use should be reviewed. I'm still in the wild guessing phase, though.
I'm not sure why, but when I declare my ignore-filters as mimaBinaryIssueFilters
, it works as expected. In fact, it's the first time I tried to use the version-specific filters. Maybe there's a simple logic issue. It's probably worth to add some integration test for millBackwardIssueFilters
and ensure the test suite runs also against Mill 0.9.10.
Tested on Mill commit dc76ded83d625a1bd654a58eaa769bdb2d9c787b
it fails with mill-mima
<= 0.0.7
but works as expected for every mill-mima >= 0.0.8
.
diff --git a/build.sc b/build.sc
index 9e59eee16..15a09dd70 100755
--- a/build.sc
+++ b/build.sc
@@ -2,7 +2,7 @@ import $file.ci.shared
import $file.ci.upload
import $ivy.`org.scalaj::scalaj-http:2.4.2`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.2-4-dcde72`
-import $ivy.`com.github.lolgab::mill-mima::0.0.6`
+import $ivy.`com.github.lolgab::mill-mima::0.0.8`
import $ivy.`net.sourceforge.htmlcleaner:htmlcleaner:2.24`
import java.nio.file.attribute.PosixFilePermission
The diff between 0.0.7 and 0.0.8 is very small, so I don't know why this happens.
(END)
diff --git a/.mill-version b/.mill-version
index ea8f4fd..6889a31 100644
--- a/.mill-version
+++ b/.mill-version
@@ -1 +1 @@
-0.9.10
\ No newline at end of file
+0.9.11
\ No newline at end of file
diff --git a/.scala-steward b/.scala-steward.conf
similarity index 100%
rename from .scala-steward
rename to .scala-steward.conf
diff --git a/mill-mima/src/com/github/lolgab/mill/mima/MimaBase.scala b/mill-mima/src/com/github/lolgab/mill/mima/MimaBase.scala
index 89786b5..fdc5b13 100644
--- a/mill-mima/src/com/github/lolgab/mill/mima/MimaBase.scala
+++ b/mill-mima/src/com/github/lolgab/mill/mima/MimaBase.scala
@@ -158,7 +158,9 @@ private[mima] trait MimaBase
private def prettyProblem(affected: String)(p: Problem): String = {
val desc = p.description(affected)
- val howToFilter = p.howToFilter.fold("")(s => s"\n filter with: $s")
+ val howToFilter = p.howToFilter.fold("")(s =>
+ s"\n filter with: ${s.replace("ProblemFilters.exclude", ("ProblemFilter.exclude"))}"
+ )
s" * $desc$howToFilter"
}
I think we can close this as not reproducible anymore. I think that now with a separate clean classloader is less likely that we will see this kind of issue.
Yeah, let's close this one and forget about it. Programming is hard enough, no need to keep extra burden. ๐