armanbilge / gcp4s

Cross-platform JVM/JS Google Cloud Platform integrations for fs2 and friends
Apache License 2.0
7 stars 2 forks source link

Scala 2.13 Support #131

Open bpholt opened 2 years ago

bpholt commented 2 years ago

This is pretty cool! I was able to copy DiscoveryPlugin into another project and generate the model for the Google Drive API (using its discovery JSON document). Unfortunately, that project is stuck on Scala 2.13. (Generating compilable code took a little tweaking but it was pretty straightforward.)

I'm curious if you have any interest in supporting Scala 2 in this project, or if you're aware of any workarounds for using the core artifact from 2.13. I tried using

("com.armanbilge" %% "gcp4s" % "0.1-9eab0c1").cross(CrossVersion.for2_13Use3)

but ran into errors with transitive dependencies:

[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef(…), "drive-client"):
[error]    org.scodec:scodec-bits _2.13, _3
[error]    io.circe:circe-scodec _2.13, _3
[error]    io.circe:circe-core _2.13, _3
[error]    org.typelevel:simulacrum-scalafix-annotations _3, _2.13
[error]    org.typelevel:cats-kernel _3, _2.13
[error]    org.typelevel:cats-core _3, _2.13
[error]    io.circe:circe-numbers _2.13, _3
[error] stack trace is suppressed; run last drive-client / update for the full output
[error] stack trace is suppressed; run last drive-client / ssExtractDependencies for the full output
[error] (drive-client / update) Conflicting cross-version suffixes in: org.scodec:scodec-bits, io.circe:circe-scodec, io.circe:circe-core, org.typelevel:simulacrum-scalafix-annotations, org.typelevel:cats-kernel, org.typelevel:cats-core, io.circe:circe-numbers
[error] (drive-client / ssExtractDependencies) Conflicting cross-version suffixes in: org.scodec:scodec-bits, io.circe:circe-scodec, io.circe:circe-core, org.typelevel:simulacrum-scalafix-annotations, org.typelevel:cats-kernel, org.typelevel:cats-core, io.circe:circe-numbers
[error] Total time: 2 s, completed Jun 8, 2022, 6:01:51 PM

I poked around a little more beyond that but it feels like it's spiraling a little bit and I'm not really sure where to focus (or if this is even likely to work at all).

armanbilge commented 2 years ago

Thanks, I'm glad it's (almost) useful to you! The module that's most tied to Scala 3 is BigQuery because it uses shapeless 3 to derive encoders/decoders.

Everything else should cross-compile easily I think, if all the syntax is rewritten 🙃

If you're willing to try one more experiment, in topic/2.13 I tried building a Scala 3 core against all 2.13 dependencies. This will avoid the conflicting suffix problem. I think you will need to add the -Ytasty-reader flag as well (or something like that).

Sadly I had to disable one of the tests to get it to publish, I'll try and take a deeper look at it later. Not sure why it's broken.

bpholt commented 2 years ago

Thanks! It looks like it imports into sbt ok—at least, the conflicting cross-version suffixes stuff doesn't come up anymore. I probably won't have a chance to dig deeper until next week though.

armanbilge commented 2 years ago

Btw, if you have a chance to put up a branch with the changes you made to the DiscoveryPlugin to get it to work on Scala 2.13, that would be really helpful to figuring out how viable a 2.13 cross of this project is :)

bpholt commented 2 years ago

Oh yeah, sure thing!

armanbilge commented 2 years ago

Good news! The failing test was just a very silly typo. https://github.com/armanbilge/gcp4s/commit/e4b7179084eeb5810341ec78edec882cf807ad08