cb372 / cats-retry

https://cb372.github.io/cats-retry/
Apache License 2.0
281 stars 45 forks source link

Cross-publish for Scala 3, update Scala and dependencies versions #327

Closed andreamarcolin closed 3 years ago

andreamarcolin commented 3 years ago

This PR is hugely inspired by the excellent job done in #291 and #294, and tries to address #249. I think it's now obvious that indeed the answer to the first question there was yes, it's possible to cross-build for 2.12, 2.13 and 3 at the same time. No code changes were required, apart from an added import and a trivial rewrite in some tests (catsInstancesForId, parenthesis around lambda arguments).

I didn't try to change the API to be more ergonomic (taking advantage of Scala 3 inference) given that 3.0.0 was already released, nor I tried to use new Scala 3 features, even if that should be possible by using version-specific source directory. So to answer the last question, yes it should be possible to start using those features and still being able to cross-publish for Scala 2.12, even if that would require maintaining separate sources for different Scala versions obviously.

On another topic, I didn't try to port tests to MUnit either, because Scalatest and Scalacheck are now published for Scala 3, so it wasn't strictly necessary. Moreover, I didn't want to steal too much from #291.

This should also unblock publishing libraries which depend on cats-retry for Scala 3 (e.g. cats-saga https://github.com/VladKopanev/cats-saga/issues/100)

andreamarcolin commented 3 years ago

@cb372 @LukaJCB could I get approval for GitHub workflows to run please? :)

LukaJCB commented 3 years ago

Sorry for the delay!

andreamarcolin commented 3 years ago

No worries! Workflows still can't run though :(

keynmol commented 3 years ago

How excellent is that I found this PR! :)

@LukaJCB wonder if you can merge/release this?

I'm thinking of also backporting this into the series/2.x branch, to get 2.1.1 with Scala 3 support

LukaJCB commented 3 years ago

Thanks so much again @andreamarcolin! Version 3.1.0 is out now!