-
Notifications
You must be signed in to change notification settings - Fork 106
Scala3 upgrade #488
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
Scala3 upgrade #488
Conversation
|
Thanks a lot @seroperson I will try to upgrade some small project of mine with this version (without migrating them to scala 3), see how painful/not painful the process is. Hopefully I should be able to do that today. Let me know when you have the chance to test it on a real app, that might also be of interest for @viperey as they had the need to a version that support scala 3. |
|
@seroperson the CI is failing because of mill version, I will upgrade that right now Edit: now the CI has the same stack overflow error you had before I believe. I don't have them locally |
Well, that's weird, I don't have it locally too. Before
I guess that's because previously all decoders were in scope explicitly because they were defined right in the single |
|
Great ! CI is now green. I still need to find the time to upgrade my projects to test now |
ofc, it's better to wait than release bad package. This week I'll try too I think. |
|
I added a comment based on a test I just did. The good news is that I upgraded one of my simple project and I had to change exactly 0 lines (public API seems to be untouched), I believe that I will still release it as 6.0.0 when we are sure that it works. Changing |
|
I've migrated my bots to Scala3 and they seem run okay too 🎉At least locally. |
| private val apiBaseUrl = s"https://$telegramHost/bot$token/" | ||
|
|
||
| override def sendRequest[R, T <: BotRequest[_]](request: T)(implicit encT: Encoder[T], decR: Decoder[R]): F[R] = { | ||
| override def sendRequest[T <: BotRequest: Encoder]( |
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.
@ex0ns out of curiosity, did your test hit this area of the code?
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.
I would have to double check as I only did a very small set of tests, but I would say yes as RandomBot is based on ExampleBot which should be using the SttpClient.
Let me make sure of it 👌
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.
Okay, that line change broke my private code, but, minor adjustments apart, it works.
In general the new version seems to be smoothly working, great job.
cc/ @seroperson
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.
yea, it broke mine too just a little. Well, anyway I guess we're going to up major version.
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.
Would you be able to share what you changed? I will include it in the release notes
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.
Like this?:
- Circe Codecs from `com.bot4s.telegram.marshalling.CirceDecoders` and `com.bot4s.telegram.marshalling.CirceEncoders` were moved to corresponding models.
- `com.bot4s.telegram.methods.Request`, `com.bot4s.telegram.methods.JsonRequest` and `com.bot4s.telegram.methods.MultipartRequest` aren't type-parameterized anymore, `R` type parameter was replaced with a dependent type `Response`.
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.
I was more talking about what you had to change in the code of your bots to align with the new version, but I guess it was mostly removing type parameters ?
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.
|
Thanks a lot for the work ! I'm going to merge that. Due to some changes to the publication of the artifact, we will not have a snapshot release for this one yet, but I will make sure to publish version 6.0.0 before the end of the week It will be hard to test/cover each an every scenario that this lib cover in the current state, but I updated a few of my bot, and ran the example available in this repo and they all worked as expected |
|
I upgraded to mill 1.0 in the meantime to have working snapshot, I will now merge this on main and leave the snapshot to be tested for a few days before doing the proper release. |
|
5.8.4-65f7d08f-SNAPSHOT is now available |
Is it really available? Where can I find it? |
|
I'm sorry it's not, sonatype changed recently and it failed silently. https://mill-build.org/mill/scalalib/publishing.html#_snapshot_versions |
|
@seroperson the CI ran: |
Thank you! |




Continuing #383 (comment) and #485 discussion:
What I did here:
-rewrite -source:3.7-migration.Decoderdefinitions, as they weren't resolved otherwise.src-jvmtosrc-jvm2, because it also depends on scalaj-http.CirceDecoders, movingDecoderdefinitions to their modelsCirceDecoders, now the sameStackOverflowExceptionwere occuring onCirceEncoders🤡, so I splitted it the same way too, bf55b75RequestHandler.scala. I guess that's because of different implicit resolution mechanism on Scala2 and Scala3, and Scala2 isn't clever enough to actually matchRwithRequest's type parameter and find implicit in its' object. That's why I've rewritten it using dependent types, b9bd2d2 (seeRequest,RequestHandlerand implementations):I haven't tested it in real application yet, don't have anything suitable at the moment, but at least tests are green.
Thank you for your attempt @viperey and @ex0ns for your great library 👍