Skip to content

Commit 7c28acb

Browse files
committed
Revert "Merge branch 'main' into caliban"
This reverts commit 49d21c5, reversing changes made to 6832b30.
1 parent 49d21c5 commit 7c28acb

11 files changed

Lines changed: 41 additions & 46 deletions

File tree

build.sbt

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys.process.*
2+
13
val scala3Version = "3.4.2"
24
val scala212Version = "2.12.19"
35
val scala213Version = "2.13.14"
@@ -15,7 +17,7 @@ val compilerOptions = Seq(
1517
"-language:strictEquality"
1618
)
1719

18-
ThisBuild / scalaVersion := scala3Version
20+
scalaVersion := scala3Version
1921
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"
2022
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
2123
sonatypeProfileName := "io.getkyo"
@@ -96,15 +98,13 @@ lazy val `kyo-scheduler` =
9698
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.16" % Test,
9799
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.5.5" % Test
98100
)
99-
.jsSettings(
100-
`js-settings`,
101-
libraryDependencies += "org.scala-js" %%% "scala-js-macrotask-executor" % "1.1.1"
102-
)
101+
.jsSettings(`js-settings`)
103102

104-
def `kyo-scheduler-zio-base` =
105-
sbtcrossproject.CrossProject("kyo-scheduler-zio", file("kyo-scheduler-zio"))(JVMPlatform)
103+
lazy val `kyo-scheduler-zio` =
104+
crossProject(JVMPlatform)
106105
.withoutSuffixFor(JVMPlatform)
107106
.crossType(CrossType.Full)
107+
.in(file("kyo-scheduler-zio"))
108108
.dependsOn(`kyo-scheduler`)
109109
.settings(
110110
`kyo-settings`,
@@ -113,19 +113,12 @@ def `kyo-scheduler-zio-base` =
113113
"-Wunused:all",
114114
"-language:strictEquality"
115115
),
116+
scalacOptions += "-Xsource:3",
116117
libraryDependencies += "dev.zio" %%% "zio" % zioVersion,
117-
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.16" % Test
118+
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.16" % Test,
119+
crossScalaVersions := List(scala3Version, scala212Version, scala213Version)
118120
)
119121

120-
lazy val `kyo-scheduler-zio-3` = `kyo-scheduler-zio-base`.settings(
121-
crossScalaVersions := List(scala3Version)
122-
)
123-
124-
lazy val `kyo-scheduler-zio` = `kyo-scheduler-zio-base`.settings(
125-
scalacOptions ++= (if (CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)) Seq("-Xsource:3") else Nil),
126-
crossScalaVersions := List(scala3Version, scala212Version, scala213Version)
127-
)
128-
129122
lazy val `kyo-tag` =
130123
crossProject(JSPlatform, JVMPlatform)
131124
.withoutSuffixFor(JVMPlatform)
@@ -318,14 +311,15 @@ lazy val `kyo-bench` =
318311
.enablePlugins(JmhPlugin)
319312
.dependsOn(`kyo-core`)
320313
.dependsOn(`kyo-sttp`)
321-
.dependsOn(`kyo-scheduler-zio-3`)
314+
.dependsOn(`kyo-scheduler-zio`)
322315
.settings(
323316
`kyo-settings`,
324317
// Forks each test suite individually
325318
Test / testGrouping := {
326319
val javaOptionsValue = javaOptions.value.toVector
327320
val envsVarsValue = envVars.value
328321
(Test / definedTests).value map { test =>
322+
import sbt.dsl.LinterLevel.Ignore
329323
Tests.Group(
330324
name = test.name,
331325
tests = Seq(test),
@@ -357,8 +351,8 @@ lazy val `kyo-bench` =
357351
libraryDependencies += "org.http4s" %% "http4s-ember-client" % "0.23.27",
358352
libraryDependencies += "org.http4s" %% "http4s-dsl" % "0.23.27",
359353
libraryDependencies += "dev.zio" %% "zio-http" % "3.0.0-RC7",
360-
libraryDependencies += "io.vertx" % "vertx-core" % "4.5.8",
361-
libraryDependencies += "io.vertx" % "vertx-web" % "4.5.8",
354+
libraryDependencies += "io.vertx" % "vertx-core" % "4.5.7",
355+
libraryDependencies += "io.vertx" % "vertx-web" % "4.5.7",
362356
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.16" % Test
363357
)
364358

@@ -400,5 +394,5 @@ lazy val `js-settings` = Seq(
400394
Compile / doc / sources := Seq.empty,
401395
fork := false,
402396
jsEnv := new NodeJSEnv(NodeJSEnv.Config().withArgs(List("--max_old_space_size=5120"))),
403-
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.5.0" % "provided"
397+
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
404398
)

kyo-bench/src/main/scala/kyo/bench/Bench.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ abstract class Bench[T](val expectedResult: T):
3131
def tearDown(): Unit = finalizers.foreach(_())
3232

3333
def zioRuntimeLayer: ZLayer[Any, Any, Any] =
34-
if System.getProperty("replaceZIOExecutor", "false") == "true" then
35-
KyoSchedulerZIORuntime.layer
34+
if System.getProperty("replaceZioExecutor", "false") == "true" then
35+
KyoSchedulerZioRuntime.layer
3636
else
3737
ZLayer.empty
3838

@@ -64,7 +64,7 @@ object Bench:
6464
def forkCats(): T = IO.cede.flatMap(_ => catsBench()).unsafeRunSync()
6565

6666
@Benchmark
67-
def forkZIO(): T = zio.Unsafe.unsafe(implicit u =>
67+
def forkZio(): T = zio.Unsafe.unsafe(implicit u =>
6868
zioRuntime.run(zio.ZIO.yieldNow.flatMap(_ => zioBench())).getOrThrow()
6969
)
7070
end Fork
@@ -81,7 +81,7 @@ object Bench:
8181
def syncCats(): T = catsBench().unsafeRunSync()
8282

8383
@Benchmark
84-
def syncZIO(): T = zio.Unsafe.unsafe(implicit u =>
84+
def syncZio(): T = zio.Unsafe.unsafe(implicit u =>
8585
zioRuntime.run(zioBench()).getOrThrow()
8686
)
8787
end SyncAndFork

kyo-bench/src/test/scala/kyo/benchTest/BenchTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ abstract class BenchTest extends AsyncFreeSpec with Assertions:
1010
enum Target:
1111
case Cats
1212
case Kyo
13-
case ZIO
13+
case Zio
1414
end Target
1515

1616
def target: Target

kyo-bench/src/test/scala/kyo/benchTest/ZIOBenchTest.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package kyo.benchTest
2+
3+
import kyo.bench.*
4+
5+
class ZioBenchTest extends BenchTest:
6+
7+
def target = Target.Zio
8+
def runFork[T](b: Bench.Fork[T]): T = b.forkZio()
9+
def runSync[T](b: Bench.SyncAndFork[T]): T = b.syncZio()
10+
11+
end ZioBenchTest

kyo-core/js/src/test/scala/kyoTest/Platform.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package kyoTest
22

33
object Platform:
4-
def executionContext = org.scalajs.macrotaskexecutor.MacrotaskExecutor
4+
def executionContext = scala.scalajs.concurrent.JSExecutionContext.queue
55
def isJVM: Boolean = false
66
def isJS: Boolean = true
77
def isDebugEnabled: Boolean = false

kyo-scheduler-zio/jvm/src/main/scala/kyo/KyoSchedulerZIOAppDefault.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ package kyo
33
import zio.ZIOAppDefault
44

55
trait KyoSchedulerZIOAppDefault extends ZIOAppDefault {
6-
override val runtime = KyoSchedulerZIORuntime.default
6+
override val runtime = KyoSchedulerZioRuntime.default
77
}

kyo-scheduler-zio/jvm/src/main/scala/kyo/KyoSchedulerZIORuntime.scala renamed to kyo-scheduler-zio/jvm/src/main/scala/kyo/KyoSchedulerZioRuntime.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import zio.*
55
import zio.internal.ExecutionMetrics
66
import zio.internal.FiberRuntime
77

8-
object KyoSchedulerZIORuntime {
8+
object KyoSchedulerZioRuntime {
99
private[kyo] lazy val layer = {
1010
val exec =
1111
new Executor {

kyo-scheduler-zio/jvm/src/test/scala/kyo/KyoSchedulerZIORuntimeTest.scala renamed to kyo-scheduler-zio/jvm/src/test/scala/kyo/KyoSchedulerZioRuntimeTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package kyo
33
import org.scalatest.freespec.AsyncFreeSpec
44
import zio.*
55

6-
class KyoSchedulerZIORuntimeTest extends AsyncFreeSpec {
6+
class KyoSchedulerZioRuntimeTest extends AsyncFreeSpec {
77

88
"run" in {
99
Unsafe.unsafe { implicit u =>
1010
val io = ZIO.succeed(Thread.currentThread().getName()).fork.flatMap(_.join)
11-
val thread = KyoSchedulerZIORuntime.default.unsafe.run(io).getOrThrow()
11+
val thread = KyoSchedulerZioRuntime.default.unsafe.run(io).getOrThrow()
1212
assert(thread.contains("kyo"))
1313
}
1414
}

kyo-scheduler/js/src/main/scala/kyo/scheduler/Scheduler.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package kyo.scheduler
22

3-
import org.scalajs.macrotaskexecutor.MacrotaskExecutor
3+
import scala.scalajs.concurrent.JSExecutionContext
44

55
object Scheduler {
66
val get = new Scheduler
@@ -10,11 +10,12 @@ class Scheduler {
1010

1111
private val clock = new InternalClock()
1212

13-
def schedule(t: Task): Unit =
14-
MacrotaskExecutor.execute { () =>
13+
def schedule(t: Task): Unit = {
14+
JSExecutionContext.queue.execute { () =>
1515
if (t.run(clock.currentMillis(), clock) == Task.Preempted)
1616
schedule(t)
1717
}
18+
}
1819

1920
def flush(): Unit = {}
2021

0 commit comments

Comments
 (0)