-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Scalacheck version update #2312
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2312 +/- ##
=======================================
Coverage 95.03% 95.03%
=======================================
Files 338 338
Lines 5878 5878
Branches 210 210
=======================================
Hits 5586 5586
Misses 292 292 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks the binary compatibly of cats-laws. We were hoping to have a cross build solution. Not sure how that looks now, cc @BennyHill
My problem is in fact that I cannot use
may be you know if I have a workaround ? |
This is why binary versioning is pretty tough. If we bump this for you, everyone using 1.13 is hosed. We could imagine expanding a matrix of compatibility. Side note, I bet this is source compatible. One day, maybe we will have source builds that can deal with this. Cc @non here is an example where maybe we could have minimized the changes in 1.14 to make it more compatible. We need to not view binary compatibility as binary and instead what is the probability a project is broken by a change. We still want to minimize that probability even when it is not zero. |
I understand perfectly, thanks. Also I can stay on |
I would still appreciate a cross-build with this. Without cats-laws, scalacheck-1.14 might as well not exist for me. |
Cross building on Scalacheck would require a cross build on discipline as well (which is already on ScalaCheck 1.14). For now I am going to schedule it for 1.2 |
The cross-build solution suggested seems involves Sbt 1.2 (just released RC1) and sbt-projectmatrix . both very young and I am not sure if they support scalajs yet. My proposal is that we release 1.2 with ScalaCheck 1.14 for now and, if we really need to, we can find a way to release a Update: |
@kailuowang Should be possible to do this without SBT 1.2 or a separate plugin, unless I'm missing something. djspiewak/smock does something actually even a bit more intricate than what you're trying to accomplish here: https://github.com/djspiewak/smock/blob/master/build.sbt#L17-L31 |
Another irritant is that this matrix is only applicable to three modules. It can still be done, but I think the stack o' hacks is one deeper than smock's. |
@rossabaker I agree the stack-o-hacks is a little deeper (especially since it involves discipline, which is a separate repo), but the approach seems relatively general to me. |
The biggest worry I see in dropping 1.13 is that scalatest is not there yet. specs2 and minitest have already switched to 1.14. Imposing 1.14 becomes more tenable if we have all the major test libraries on board. I tried to analyze downstream projects, but I don't know how to filter test-scoped from runtime dependencies. The latter set of projects would need to rebuild for their own consumers. This includes cats-effect, circe, and http4s. It would be nice if these projects all followed cats' lead, whether that's a crossbuild or a simple upgrade. |
I spent the last 2 hours trying to write a cross build hack in cats. The fact that we only have 3 modules that need to be cross build+ we cross build I suspect that Scalatest's integration with ScalaCheck doesn't suffer a binary compatibility issue. At least discipline was able to update to ScalaCheck 1.14 without problems. The BC issue reported by @barambani is on |
I forgot about sbt-release. I hate sbt-release. A lot. That definitely puts things a bit beyond the pale.
My proposal, if we do pursue an SBT hack, would be to only apply it to the 2.13 build. Downstream projects have no expectations at that point. For the most part, they're only going to be affected if they depend on cats-laws, and especially if they pass along cats-laws as a dependency. Broadly, this means cats-effect is going to get the worst of it, but most other projects shouldn't care. Endpoint downstream projects, which don't cross-build across Scala versions, shouldn't be affected at all. |
I suspect cats-effect-laws has few consumers, though its |
@djspiewak Are you suggesting we cross build ScalaCheck on Scala 2.13? or are you suggesting we have 2.13 build on ScalaCheck 1.14 and the rest 2.10-2.12 on ScalaCheck 1.13? |
@kailuowang At least for the time being, yes. The concept basically being that we can push a 2.13 build by depending on 1.14, but the rest of all the things can still depend on 1.13 and retain compatibility. Obviously this would be a temporary situation. |
BTW, this should be relatively achievable by doing something like: libraryDependencies += "org.scalacheck" %% "scalacheck" % {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, major)) if major < 13 => "1.13.5"
case Some((2, major)) if major >= 13 => "1.14.0"
}
} % Test More or less. (note: isolating this to a custom setting key will be more elegant and allow reuse) The differences between the two frameworks in terms of source compatibility (should be negligible) then can be factored out using the normal cross-building mechanisms (e.g. |
@rossabaker I'm not too worried about bumping the ScalaCheck version in circe-testing to 1.14, given that we have no guarantees of compatibility between minor versions before 1.0, and I almost certainly wouldn't cross-build for 1.13 / 1.14 even if cats-laws did (unless someone paying me wanted it or someone opened a PR and promised to maintain it forever). |
Actually the newer crossProject that we don't use yet. And I'm actually camping at the moment, typing away under canvas ⛺ But reading the above does suggest a better/proper cross versioning build is worth the effort including for related projects such as discipline,etc that, IMHO, should remain separate. But the fact remains that the (ideal) required infra projects are not there yet - sbt, crossproject, etc. But I believe it would be quite straightforward to mimic the output, but I suggest gitter would be better for me to air my thoughts for now |
@BennyHill @kailuowang If you could describe your ideal infrastructural solution to this problem, what would it be? I don't mind whipping up SBT plugins which solve plumbing projects like this (actually, I quite enjoy that sort of thing). The only reason I haven't is I don't have any immediate inspiration for what a good solution would look like. |
Is perhaps the root problem 😜 And awesome offer, @djspiewak , btw 👍 My (our?) current thoughts I've summarized as per gitter link^^, but the end result would be that cats 1.2 would still scalacheck 1.3 and be fully bin compat, but we would have another lib with a classifier of say "BC1", in the same way that classifiers are added for different target architectures and/or environments - and that would use SC 1.4 and any other different library versions. |
@djspiewak I believe sbt-projectmatrix (cc @eed3si9n) is trying to provide a unified solution for cross- building. For now, we need something that can work with sbt-crossproject. I can imagine the usage would be something like lazy val laws = crossProject(JSPlatform, JVMPlatform).in(file("."))
.settings(
commenSettings,
moduleName := "cats-laws",
libraryDependencies +=
"org.scalacheck" %%% "scalacheck" % "1.14.0"
)
lazy val lawsJVM = laws.jvm
lazy val lawsJS = laws.js
val lawsSC1_13 = laws.settings(
libraryDependencies +=
"org.scalacheck" %%% "scalacheck" % "1.13.5",
versionSuffix := "ScalaCheck1.13"
)
lazy val lawsSC1_13JVM = lawsSC1_13.jvm
lazy val lawsSC1_13JS = lawsSC1_13.js Obviously We'll also need to add This should result in testing and publishing additional If we use this setup the only magic the plugin needs to provide is probably just appending the Update: I forgot to mention, that at least for now, integration with |
@BennyHill @kailuowang I'll give it some thought. I will warn you though that sbt-release integration is probably relatively low on my motivational TODO list. This is for two reasons:
It's doable, just a massive pain. :-) Anyway, I'll look into it and see if I can come up with something. |
To me, the ideal solution is for the community to work towards source builds (like Rust and Haskell have). It’s not a quick fix, but if we had source builds we would detect these issues at compile time, and avoid many of them due to how much easier source compatibility is than binary for scala. |
@djspiewak I am open to a replacement of sbt-release in Cats. The main benefit of sbt-release is that the release process enabled by it is scripted and well known. As long as the replacement is equally straightforward for a new maintainer to do a Cats release, I am all for it. |
@johnynek I'm still not convinced that source dependencies are the promised land. They just have a very different set of tradeoffs, and they haven't been in wide use since the days of gnu autoconf, so the warts aren't as familiar or as widely understood. I've spent enough time with Gentoo and similar to be extremely leery of source dependencies, though obviously a Linux distribution is a slightly bigger problem than a PL ecosystem. At any rate, we've had this discussion in parts before. :-) And it's more future-speculative-ish. @kailuowang This is what I use on my projects, which in turn enables this versioning outcome. (basically semver with stable snapshots and better major/minor bump determination) It wouldn't be hard to split this away from sbt-spiewak and make it a bit more configurable. I've been meaning to extend it with support for matrix releases (e.g. for smock). Basing things around I agree that scripting, repeatability, and accessibility are 100% essential components of any release process. |
@djspiewak That would be amazing. As a side note, in regards to mima check, we check against all previous minor versions with patch ver 0, i.e. |
@kailuowang / anyone Your source example above looks good, 👍 , but I wonder if that should be for a cats 2.0 release when we break BC? So for now, 1.2, we would have instead : lazy val laws = crossProject(JSPlatform, JVMPlatform).in(file("."))
.settings(
commenSettings,
moduleName := "cats-laws",
libraryDependencies +=
"org.scalacheck" %%% "scalacheck" % "1.13.5"
)
lazy val lawsJVM = laws.jvm
lazy val lawsJS = laws.js
val lawsSC1_14 = laws.settings(
libraryDependencies +=
"org.scalacheck" %%% "scalacheck" % "1.14.0",
versionSuffix := "ScalaCheck1.14"
)
lazy val lawsSC1_14JVM = lawsSC1_14.jvm
lazy val lawsSC1_14JS = lawsSC1_14.js So for now , breaking BC is opt-in, but for a major release, old library versions are opt-in. And before I disappear, I kinda agree with @djspiewak re source builds - they're cool, but I don't think they will solve all the problems that folk want 😄 |
@BennyHill agree, we should make default not binary breaking. |
Quick update: I haven't forgotten about this! I spent a bit of time playing around with how I wanted this to work, ran into a major blocker, and found a nice solution to it last night in a random revelation. |
cats-laws 1.x depends on scalacheck 1.13.5, which is binary-incompatible with the newer 1.14.0 - causing NoSuchMethodErrors in law tests for MonadError See typelevel/cats#2312
An update: I tried several approaches for cross releasing for scalacheck 1.14, they either don't work or introduce a heck amount of complexity to the build. I ran out of steam for this. Considering the fact that other libs need to do the same thing, I start to believe that cost wise, it's probably just easier to have the whole ecosystem upgrade to scalacheck 1.14 at one go - i.e. cats upgrades it in 1.6 and projects follows. |
PS could we upstream our concerns about better binary compatibility checking (cc @non ) or maybe introduce typeclasses to abstract out scalacheck and allow users to work with hedgehog, scalacheck, etc... via a module. |
This is made obsolete by #2734 and can be closed when that's merged. |
No description provided.