Skip to content
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

Cross scala 3 #645

Merged
merged 19 commits into from
Feb 7, 2023
Merged

Cross scala 3 #645

merged 19 commits into from
Feb 7, 2023

Conversation

fedefernandez
Copy link
Contributor

@fedefernandez fedefernandez commented Jan 27, 2023

Overview

This PR brings cross-compilation with Scala 3 to memeid. The trickiest part was the memeid4s-literal, where a new Scala 3 macro was implemented.

I've also added the sbt-projectmatrix plugin and re-configured the modules. The main purpose is to be able to maintain different modules with different crossScalaVersions.

Caveats

Some caveats from the current upgrade:

  1. The build fails due to a misconfiguration with scalafix. For some reason, the sbt-scalafix-defaults plugin is bringing Scala 2 config in a Scala 3 build. Locally works fine. For now, the decision I made is to remove the plugin. The error can be seen here
  2. The mdoc compilation fails with doobie code and Scala 3. In this PR we're just compiling the documentation against Scala 2.12 and Scala 2.13. I'll create an issue with the error once this is merged.
error:
Exception occurred while executing macro expansion.
java.lang.NullPointerException
	at doobie.util.PosPlatform$.originImpl(PosPlatform.scala:21)

info: Compiled in 20.61s (1 error)
[error] java.lang.RuntimeException: mdoc failed
[error] 	at scala.sys.package$.error(package.scala:27)
[error] 	at mdoc.SbtMain$.main(Main.scala:30)
[error] 	at mdoc.SbtMain.main(Main.scala)
[error] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[error] stack trace is suppressed; run last microsite3 / Compile / runMain for the full output
[error] (microsite3 / Compile / runMain) mdoc failed
[error] Total time: 35 s, completed Feb 2, 2023, 11:03:25 PM

@codecov
Copy link

codecov bot commented Jan 27, 2023

Codecov Report

Merging #645 (d2bcf1e) into main (a353f16) will increase coverage by 0.61%.
The diff coverage is 94.44%.

@@            Coverage Diff             @@
##             main     #645      +/-   ##
==========================================
+ Coverage   98.85%   99.46%   +0.61%     
==========================================
  Files          14       18       +4     
  Lines          87      187     +100     
  Branches        7        5       -2     
==========================================
+ Hits           86      186     +100     
  Misses          1        1              
Impacted Files Coverage Δ
...-cats/src/main/scala/memeid4s/cats/instances.scala 100.00% <ø> (ø)
...ral/src/main/scala-2/memeid4s/literal/Macros.scala 100.00% <ø> (ø)
...al/src/main/scala-2/memeid4s/literal/package.scala 100.00% <ø> (ø)
...4s/src/main/scala/memeid4s/digest/Digestible.scala 100.00% <ø> (ø)
...odules/memeid4s/src/main/scala/memeid4s/UUID.scala 97.61% <75.00%> (-2.39%) ⬇️
...ral/src/main/scala-3/memeid4s/literal/Macros.scala 100.00% <100.00%> (ø)
...al/src/main/scala-3/memeid4s/literal/package.scala 100.00% <100.00%> (ø)
...s/memeid4s/src/main/scala/memeid4s/node/Node.scala 100.00% <0.00%> (ø)
...s/memeid4s/src/main/scala/memeid4s/time/Time.scala 100.00% <0.00%> (ø)
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@fedefernandez fedefernandez marked this pull request as ready for review January 30, 2023 12:24
@fedefernandez fedefernandez marked this pull request as draft January 30, 2023 12:30
@fedefernandez
Copy link
Contributor Author

The doobie mdoc is still to be implemented

@fedefernandez
Copy link
Contributor Author

Pending to improve the build.sbt

@fedefernandez fedefernandez marked this pull request as ready for review February 2, 2023 22:20
@fedefernandez
Copy link
Contributor Author

@gutiory this is ready for review. Thanks

project/plugins.sbt Outdated Show resolved Hide resolved
gutiory
gutiory previously approved these changes Feb 6, 2023
Copy link
Contributor

@gutiory gutiory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astonishing work @fedefernandez!. I've just left a minor comment.

Co-authored-by: Jose Gutiérrez de Ory <[email protected]>
@fedefernandez
Copy link
Contributor Author

@gutiory I've applied your changes. I'm not sure why the patch is complaining, but the changes look good to me. Could you please review it again?

@fedefernandez fedefernandez merged commit 39fb243 into main Feb 7, 2023
@fedefernandez fedefernandez deleted the cross-scala-3 branch February 7, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants