-
Notifications
You must be signed in to change notification settings - Fork 24
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 compile scala 3 #504
Conversation
c3d9c9d
to
a547e16
Compare
|
5b82bdf
to
03eb141
Compare
cron4s compiles in Scala 3! |
val g = "https://raw.githubusercontent.com/alonsodomin/cron4s/" + tagOrHash | ||
s"-P:scalajs:mapSourceURI:$a->$g/" | ||
}, | ||
scalacOptions ++= (if (scalaVersion.value.startsWith("2.")) Seq { |
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 causes bad option error in scala 3 scala.js: https://github.com/alonsodomin/cron4s/actions/runs/5435520680
implicit lazy val arbitraryBetweenDayOfMonth = Arbitrary(betweenGen[DayOfMonth]) | ||
implicit lazy val arbitraryBetweenMonth = Arbitrary(betweenGen[Month]) | ||
implicit lazy val arbitraryBetweenDayOfWeek = Arbitrary(betweenGen[DayOfWeek]) | ||
implicit lazy val arbitraryBetweenSecond: Arbitrary[BetweenNode[Second]] = Arbitrary( |
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.
explicit types for implicit vals/defs
@@ -17,17 +17,22 @@ | |||
package cron4s.testkit.gen | |||
|
|||
import cron4s.CronField._ | |||
import cron4s.expr.ConstNode | |||
|
|||
import org.scalacheck.Arbitrary | |||
|
|||
/** | |||
* Created by alonsodomin on 28/08/2016. | |||
*/ | |||
trait ArbitraryConstNode extends NodeGenerators { |
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.
explicit types for implicit vals/defs
implicit lazy val arbitraryDaysOfMonthUnit = Arbitrary(Gen.const(CronUnit[DayOfMonth])) | ||
implicit lazy val arbitraryMonthsUnit = Arbitrary(Gen.const(CronUnit[Month])) | ||
implicit lazy val arbitraryDaysOfWeekUnit = Arbitrary(Gen.const(CronUnit[DayOfWeek])) | ||
implicit lazy val arbitrarySecondsUnit: Arbitrary[CronUnit[Second]] = Arbitrary( |
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.
explicit types for implicit vals/defs
), | ||
libraryDependencies ++= (if (scalaVersion.value.startsWith("2.")) | ||
Seq("com.chuusai" %%% "shapeless" % version.shapeless) | ||
else Seq.empty) |
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.
shapeless is no longer necessary in Scala 3. We can use union type and Tuple instead of Coproduct and HList.
import cron4s.expr._ | ||
|
||
import org.scalacheck._ | ||
|
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 file is almost the same as https://github.com/alonsodomin/cron4s/pull/504/files#diff-fe082e93829b26c97f89813516bdfd1efa4b2f6cc1d26d5dcd7aa2dcec929e03.
The differences are
- explicit type annotations for implicit vals/defs
- shapeless import removal
There are around 1700 lines of changes. However, changes in test and testkit modules are just explicit type annotations and imports for implicit conversions. There is a few changes in core modules, but most of them are just replacement from scala directory to scala-2 directory to hide shapeless from Scala 3. All tests pass for both Scala 2 and Scala 3. Therefore, I think whole changes in this PR are safe to some extent. |
@alonsodomin Hi, all cron4s modules compile in Scala 3 now. Please check when you have free time. |
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 hard work, I truly believe this was some tedious effort. I'll publish a new version of the library ready for Scala 3 after merging this. Let me know if you have any outstanding things you would like to include before I do that.
complete #468
This PR supports cross build of all modules in Scala 3.
The most changes are introduced with the aim of hiding shapeless from shared files in core modules and filling the gap of implicit conversions and implicit defs/vals between scala 2.x and 3.x.
In addition, other changes address Scala 3 compiler/linter warnings.