Skip to content

Commit

Permalink
[data] fix Duration in scala native (#867)
Browse files Browse the repository at this point in the history
I'm having trouble to port support Scala Native in `kyo-core` because of
missing classes. The problem isn't shown in tests because zio tests are
disabled in Scala Native and the `zio-test-sbt` dependency adds the
necessary stubs.

This PR removes the dependency on `zio-test-sbt` and adds an explicit
dependency to `scala-java-time`.
  • Loading branch information
fwbrasil authored Nov 26, 2024
1 parent 9368c6b commit 63f4923
Show file tree
Hide file tree
Showing 4 changed files with 297 additions and 316 deletions.
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ lazy val kyoNative = project
`kyo-data`.native,
`kyo-prelude`.native,
`kyo-stats-registry`.native,
`kyo-scheduler`.native,
`kyo-scheduler`.native
)

lazy val `kyo-scheduler` =
Expand Down Expand Up @@ -188,7 +188,6 @@ lazy val `kyo-data` =
.settings(
`kyo-settings`,
libraryDependencies += "com.lihaoyi" %%% "pprint" % "0.9.0",
libraryDependencies += "dev.zio" %%% "zio-test-sbt" % zioVersion % Test,
libraryDependencies += "org.scalatest" %%% "scalatest" % scalaTestVersion % Test,
libraryDependencies += "dev.zio" %%% "izumi-reflect" % "2.3.10" % Test
)
Expand Down Expand Up @@ -389,7 +388,7 @@ lazy val `kyo-monix` =
.dependsOn(`kyo-core`)
.settings(
`kyo-settings`,
libraryDependencies += "io.monix" %% "monix" % "3.4.1",
libraryDependencies += "io.monix" %% "monix" % "3.4.1",
libraryDependencies += "org.scalatest" %%% "scalatest" % scalaTestVersion % Test
)
.jvmSettings(mimaCheck(false))
Expand Down Expand Up @@ -527,16 +526,17 @@ lazy val readme =
)

lazy val `native-settings` = Seq(
fork := false,
bspEnabled := false
fork := false,
bspEnabled := false,
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.6.0" % "provided"
)

lazy val `js-settings` = Seq(
Compile / doc / sources := Seq.empty,
fork := false,
bspEnabled := false,
jsEnv := new NodeJSEnv(NodeJSEnv.Config().withArgs(List("--max_old_space_size=5120"))),
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.5.0" % "provided"
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.6.0" % "provided"
)

def scalacOptionToken(proposedScalacOption: ScalacOption) =
Expand Down
13 changes: 5 additions & 8 deletions kyo-core/shared/src/test/scala/kyo/FiberTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -965,12 +965,10 @@ class FiberTest extends Test:
startLatch.release.andThen(promise2.get),
startLatch.release.andThen(promise3.get)
))
_ <- startLatch.await
_ <- fiber.interrupt
count <- interruptCount.get
yield
assert(count == 3)
()
_ <- startLatch.await
_ <- fiber.interrupt
_ <- untilTrue(interruptCount.get.map(_ == 3))
yield ()
}.andThen(succeed)
}

Expand All @@ -996,11 +994,10 @@ class FiberTest extends Test:
done2 <- fiber.done
_ <- promise2.complete(Result.success(1))
result <- fiber.get
count <- interruptCount.get
_ <- untilTrue(interruptCount.get.map(_ == 1))
yield
assert(!done1 && !done2)
assert(result == Seq(1, 1))
assert(count == 1)
()
}.andThen(succeed)
}
Expand Down
302 changes: 0 additions & 302 deletions kyo-data/shared/src/test/scala/kyo/DurationSpec.scala

This file was deleted.

Loading

0 comments on commit 63f4923

Please sign in to comment.