Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
981f886
Use Typelevel scalac-options
steinybot Jun 2, 2024
7c9dd57
Fix warnings
steinybot Jun 2, 2024
d1e10b6
Fix unused warning for Scala 2.12
steinybot Jun 2, 2024
914ab9c
Add kyo-grpc project
steinybot May 28, 2024
0d3c3fe
Add temporary gRPC server example
steinybot May 30, 2024
1c1de9f
Create new projects from scalapb template
steinybot Jun 2, 2024
a3ecc0d
Fix build
steinybot Jun 2, 2024
8d51bb4
Attempt to fix collection conversions
steinybot Jun 2, 2024
1f85c2b
Fix collection conversions
steinybot Jun 2, 2024
db630b5
Use Scala 2.12 for code gen classpath
steinybot Jun 2, 2024
68ba2af
Get JS E2E tests working
steinybot Jun 3, 2024
923de9d
Migrate test to scalatest
steinybot Jun 3, 2024
64ad69d
Add GrpcResponse
steinybot Jun 3, 2024
785c80c
Update gRPC example to use GrpcResponses
steinybot Jun 3, 2024
7b42cc7
Fix build aggregates
steinybot Jun 3, 2024
cec0856
Add PB.targets
steinybot Jun 3, 2024
13b065c
Update example
steinybot Jun 3, 2024
6bc4ffc
Generate single file unary method
steinybot Jun 4, 2024
f05fa0a
Add AbstractService parent
steinybot Jun 4, 2024
f47c11d
Partial commit for code gen
steinybot Jun 9, 2024
8b66f96
Fix object builder
steinybot Jun 16, 2024
a643dbb
Generate service companion
steinybot Jun 18, 2024
7beb4b6
Simplify generated code
steinybot Jun 18, 2024
6ac8580
Handle shutdown gracefully
steinybot Jun 21, 2024
2ce84e4
Update test.proto
steinybot Jun 23, 2024
e39ec54
Fix implicits
steinybot Jun 23, 2024
0d3ed0c
Add server test
steinybot Jun 23, 2024
f74c6ee
Add test for aborts
steinybot Jun 23, 2024
6bdad01
Add fail test
steinybot Jun 23, 2024
845835c
Tidy up tests
steinybot Jun 23, 2024
74469bc
Start writing client
steinybot Jul 13, 2024
c5804cc
Add basic client implementation
steinybot Jul 15, 2024
e4905b7
Update grpc example
steinybot Jul 21, 2024
0ef2cae
Add placeholder grpc benchmarks
steinybot Aug 4, 2024
9601353
Implement basic unary benchmark
steinybot Aug 5, 2024
952a84e
Add grpc server unary bench
steinybot Aug 6, 2024
9328546
Add gRPC helpers
steinybot Sep 3, 2024
269a903
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Sep 16, 2024
76a3893
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Sep 16, 2024
1ad73e2
Handle abort first
steinybot Sep 16, 2024
dada1e3
Update gRPC example
steinybot Sep 16, 2024
3be41ea
Rename package
steinybot Sep 16, 2024
0448c7b
Fix gRPC tests
steinybot Sep 17, 2024
f2cb617
Add gRPC stream observers
steinybot Sep 23, 2024
48827a1
Implement streaming handlers
steinybot Sep 26, 2024
71cc5d8
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Sep 26, 2024
3c2675d
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Oct 1, 2024
acbaa4a
Continue implementing gRPC streams
steinybot Oct 1, 2024
6094c66
Fix tests
steinybot Oct 1, 2024
b171c43
Implement client streaming
steinybot Oct 3, 2024
715b465
Get streaming working
steinybot Oct 5, 2024
33338c2
Fix test service
steinybot Oct 6, 2024
52987c4
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Jan 20, 2025
61b8790
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Jan 20, 2025
369063f
Fix compilation errors
steinybot Feb 17, 2025
83eb25a
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Feb 17, 2025
368a813
Fix gRPC benchmarks
steinybot Feb 18, 2025
476b5fe
Fix kyo-bench build
steinybot Feb 23, 2025
6df9c33
Remove unnecessary build changes
steinybot Feb 23, 2025
ca8d606
Update gRPC libraries
steinybot Feb 23, 2025
287f39c
Add cats gRPC benchmarks
steinybot Feb 23, 2025
cfa7da3
Fix ZIO gRPC benchmarks
steinybot Feb 24, 2025
20265ca
Update README
steinybot Mar 1, 2025
11bbc5b
Update README
steinybot Mar 1, 2025
61e5a03
Fix typo
steinybot Mar 1, 2025
8d16764
Remove unused build file
steinybot Mar 1, 2025
12fbdd0
Add observer tests
steinybot Mar 9, 2025
0ec55cf
Fix stream closing
steinybot Mar 23, 2025
65a8832
Add gRPC stream tests
steinybot Mar 30, 2025
1aba0ff
Fix StreamNotifierTests
steinybot Apr 16, 2025
c0ff6d0
Remove commented out code
steinybot Apr 16, 2025
85edd9f
Add StreamChannelTests
steinybot Apr 16, 2025
3acbb74
Simplify ResponseStreamObserverTests
steinybot Apr 16, 2025
b5e3ceb
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Apr 16, 2025
c980ab7
Fix compilation errors from merge
steinybot Apr 16, 2025
9ca1ccc
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Apr 22, 2025
53e51e4
Fix ResponseStreamObserverTests
steinybot Apr 23, 2025
f42485f
Add UnaryResponseStreamObserver tests
steinybot Apr 23, 2025
91b38f8
Add tests
steinybot Apr 24, 2025
9a9910c
Update ClientTests
steinybot Apr 24, 2025
01a5b24
Add ClientCallTest
steinybot Apr 25, 2025
c2fa0e1
Fix StreamChannel
steinybot Apr 26, 2025
3606e33
Fix StreamChannel
steinybot Apr 26, 2025
20bfead
Tidy up tests
steinybot Apr 26, 2025
179a419
Fix race conditions
steinybot Apr 27, 2025
4ccd670
Update ServiceTests
steinybot Apr 27, 2025
74308e0
Add ServiceTests
steinybot Apr 27, 2025
155ab37
Add RequestStreamObserverTest
steinybot Apr 27, 2025
dc8ad1e
Add BidiRequestStreamObserverTest
steinybot Apr 27, 2025
a66b3a2
Fix ServiceTests
steinybot Apr 27, 2025
8fa145d
Complete ServiceTests
steinybot Apr 28, 2025
696b646
Remove unused imports
steinybot Apr 28, 2025
3a65b16
Rename protoc-gen projects
steinybot Apr 28, 2025
8af4273
Update dependencies
steinybot Apr 28, 2025
e7763b4
Update kyo-bench dependencies
steinybot Apr 28, 2025
2753e4e
Replace testservice.proto
steinybot Apr 28, 2025
f733afc
Add test debugging
steinybot May 9, 2025
85946fd
Add success message
steinybot May 9, 2025
520992d
Minimize tests
steinybot May 11, 2025
9572c98
Minimize tests
steinybot May 11, 2025
4340399
Minimize tests
steinybot May 11, 2025
5edc558
Minimize tests
steinybot May 11, 2025
cee90a5
Minimize tests
steinybot May 11, 2025
a69c28e
Pass name to StreamChannel for debugging
steinybot May 13, 2025
8c30dae
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot May 13, 2025
2c892c4
[core] Channel/Queue closeAndWaitEmpty
fwbrasil May 14, 2025
d92759c
fix scaladoc
fwbrasil May 14, 2025
9940bd2
HalfClosed => HalfOpen
fwbrasil May 14, 2025
81daae4
Fix dynamic tags
steinybot May 14, 2025
91fe19f
Merge remote-tracking branch 'upstream/closeAwaitEmpty' into kyo-grpc
steinybot May 14, 2025
c6e6de5
Reproduce drain close race condition
steinybot May 16, 2025
c09b22b
Reproduce drain close race condition for zero capacity channel
steinybot May 16, 2025
d6a57ac
Fix formatting
steinybot May 16, 2025
9d7ad88
Fix channel drain close race
steinybot May 16, 2025
d17b9f2
Rename and document asResult methods
steinybot May 17, 2025
c1a92b6
Remove unused parameter
steinybot May 17, 2025
4bc12f4
Refactor channel drain close race tests
steinybot May 16, 2025
d99df87
Remove logging
steinybot May 18, 2025
9851b38
Merge branch 'channel-drain-close-race' into kyo-grpc
steinybot May 18, 2025
c42344a
Include Queue changes from upstream
steinybot May 18, 2025
dee60d5
Remove testOnlyUntilFixed
steinybot May 18, 2025
c0c7dd2
Tidy up GrpcE2EUnaryBench
steinybot May 18, 2025
e18227b
Update benchmarks
steinybot May 19, 2025
f1186fb
Remove StatusRuntimeException from GrpcRequest
steinybot May 19, 2025
d0097ed
Remove logging
steinybot May 19, 2025
d9cbb5b
Refactor Grpc Benchmarks
steinybot May 20, 2025
74ee65d
Add netty resource leak options
steinybot May 21, 2025
5cec283
Fix oneToMany benchmark
steinybot May 24, 2025
1f6d17d
Add many to many benchmark
steinybot May 24, 2025
673f7f0
Add many to one benchmark
steinybot May 24, 2025
2aef482
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot May 24, 2025
9f287a3
Revert changes
steinybot May 24, 2025
523fce5
Minor tidy up
steinybot May 25, 2025
806b441
Fix Kyo client and server shutdown
steinybot May 25, 2025
9e2c9f0
Make server shutdown more reliable
steinybot May 26, 2025
3d62405
Add GrpcClientUnaryBench
steinybot May 26, 2025
772887e
Add client benchmarks
steinybot May 31, 2025
fa612de
Add E2E benchmarks
steinybot May 31, 2025
9e88e76
Remove TODO
steinybot May 31, 2025
565df3a
Remove TODO
steinybot May 31, 2025
fbc84f5
Revert Channel changes
steinybot May 31, 2025
2224b5b
Use Loop.foreach
steinybot May 31, 2025
1b029ec
Add lastMaybe tests
steinybot May 31, 2025
e4d9b15
Fix Chunk lastMaybe tests
steinybot May 31, 2025
2519e61
Refactor code generator
steinybot Jun 1, 2025
7bcd929
Remove unused fields
steinybot Jun 1, 2025
902a578
Add code generator test
steinybot Jun 2, 2025
41f435b
Remove TODO
steinybot Jun 2, 2025
215ba3a
Refactor ServicePrinter
steinybot Jun 2, 2025
f25a8cb
Remove TODO
steinybot Jun 2, 2025
1ad431c
Refactor code gen
steinybot Jun 2, 2025
101941e
Refactory code gen tests
steinybot Jun 2, 2025
c6bf7ba
Fix CodeGeneratorTest
steinybot Jun 2, 2025
d177cc2
Remove TODOs
steinybot Jun 4, 2025
c86f3f6
Remove unused Tags
steinybot Jun 4, 2025
8352276
Add docs
steinybot Jun 4, 2025
471a995
Format code
steinybot Jun 12, 2025
c9f5b05
Add ScalaDoc
steinybot Jun 12, 2025
3ade0fc
Remove comment
steinybot Jun 12, 2025
e925e9b
Add ScalaDoc
steinybot Jun 12, 2025
05a3a79
Format example
steinybot Jun 12, 2025
87bcd76
Improve client creation
steinybot Jun 12, 2025
2e1f1c1
Remove TODOs
steinybot Jun 12, 2025
d95702c
Update ScalaDoc
steinybot Jun 12, 2025
6a47972
Fix ClientTests
steinybot Jun 12, 2025
96d9601
Fix ResponseStreamObserverTest
steinybot Jun 12, 2025
e0530e6
Fix StreamChannel tests
steinybot Jun 15, 2025
20f1654
Add QueueTests for closeAwaitEmptyFiber and open state
steinybot Jun 15, 2025
692b327
Add channel and queue tests
steinybot Jun 15, 2025
96b406c
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Jul 2, 2025
8e68761
Rename IO to Sync
steinybot Jul 2, 2025
e250391
Rename IO to Sync
steinybot Jul 2, 2025
7948fff
Do not run QueueTests in native build
steinybot Jul 2, 2025
65c06cd
Remove TODOs
steinybot Jul 2, 2025
061b1d1
Add docs to ClientCall
steinybot Jul 2, 2025
f31fc05
Rename GrpcRequest to Grpc
steinybot Jul 3, 2025
4d963a9
Refactory Grpc effect
steinybot Jul 3, 2025
4ced936
Add response observer docs
steinybot Jul 4, 2025
8e77bce
Make StreamChannel.closed checks a lazy or
steinybot Jul 4, 2025
47534c9
Close the requestChannel in RequestStreamObserver on early responses
steinybot Jul 4, 2025
c2235b1
Combine request stream observers
steinybot Jul 4, 2025
cb74c78
Rename parameter
steinybot Jul 4, 2025
8250373
Fix match error
steinybot Jul 4, 2025
4768593
Fix scaladoc
steinybot Jul 4, 2025
0c2b155
Run scalafmt
steinybot Jul 4, 2025
370ab29
Fix scaladoc
steinybot Jul 4, 2025
ac35f9b
Fix StreamNotifier handling of errors during onNext
steinybot Jul 5, 2025
37f702b
Run scalafmt
steinybot Jul 5, 2025
1e01819
Add Client scaladoc
steinybot Jul 5, 2025
b4e8a38
Update ScalaMock and remove workaround
steinybot Jul 5, 2025
c38d0cd
Fix ServiceTests
steinybot Jul 5, 2025
ef403b3
Remove TODO
steinybot Jul 5, 2025
c8b90b4
Update helloworld example
steinybot Jul 5, 2025
7e13f22
Use nicer PB.target
steinybot Jul 5, 2025
98744f7
Remove copilot-instructions.md
steinybot Jul 5, 2025
25fb785
Tidy up build.sbt
steinybot Jul 5, 2025
494d393
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Jul 19, 2025
72be9cc
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Jul 20, 2025
386d3c9
Fix compilation errors
steinybot Jul 20, 2025
63ff4a7
Implement UnaryServerCallHandler
steinybot Jul 23, 2025
3518f52
Add ServerStreamingServerCallHandler
steinybot Jul 24, 2025
37839a8
Add ClientStreamingServerCallHandler
steinybot Jul 27, 2025
729d97a
Respect isReady
steinybot Jul 27, 2025
0cbc0c7
Use Env and Emit for Metadata and ResponseOptions
steinybot Aug 6, 2025
6a44409
Run unary call handler in fiber
steinybot Aug 6, 2025
a54988e
Use same pattern for all call handlers
steinybot Aug 9, 2025
1789f79
Extract Base ServerCallHandlers
steinybot Aug 12, 2025
e059ba8
Refactor ServerCallHandlers
steinybot Aug 14, 2025
08829aa
Partially implement unary client call
steinybot Aug 19, 2025
fda371b
Handle trailers
steinybot Aug 27, 2025
d976eb4
Support cancellation
steinybot Aug 28, 2025
781a245
Wrap newCall in an effect
steinybot Aug 28, 2025
804336f
Reformat
steinybot Aug 28, 2025
e3d8bd0
Reimplement client server streaming
steinybot Aug 30, 2025
2c8cce4
Reimplement client streaming call
steinybot Aug 31, 2025
51af35f
Add explicit types
steinybot Aug 31, 2025
6f24891
Ensure call cancellation on error
steinybot Aug 31, 2025
cfcccc0
Remove unused channel and notifier
steinybot Sep 1, 2025
cc9e7ab
Add additional expectations
steinybot Sep 15, 2025
dfc1929
Add UnaryServerCallHandlerTest
steinybot Sep 22, 2025
8712eba
Fix some UnaryServerCallHandlerTests
steinybot Oct 7, 2025
615afbd
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Oct 7, 2025
2bf9772
Merge remote-tracking branch 'upstream/main' into kyo-grpc
steinybot Oct 7, 2025
9ea512f
Fix tests from merge
steinybot Oct 7, 2025
73d267f
Fix unary server call handler tests
steinybot Oct 23, 2025
941fd87
Fix client backpressure
steinybot Oct 24, 2025
d6b3ce1
Add call listener tests
steinybot Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ fileOverride {
"glob:**/kyo-stats-otel/**" {
runner.dialect = scala212source3
}
"glob:**/kyo-grpc/code-gen/**" {
runner.dialect = scala212source3
}
"glob:**/scala-3/**" {
runner.dialect = scala3
}
Expand Down
226 changes: 194 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import org.scalajs.jsenv.nodejs.*
import org.typelevel.scalacoptions.ScalacOption
import org.typelevel.scalacoptions.ScalacOptions
import org.typelevel.scalacoptions.ScalaVersion
import protocbridge.Target
import sbtdynver.DynVerPlugin.autoImport.*

val scala3Version = "3.7.2"
val scala3LTSVersion = "3.3.6"
val scala213Version = "2.13.16"
val scala212Version = "2.12.20"

val zioVersion = "2.1.17"
val catsVersion = "3.6.1"
Expand Down Expand Up @@ -56,7 +58,7 @@ lazy val `kyo-settings` = Seq(
crossScalaVersions := List(scala3Version),
scalacOptions ++= scalacOptionTokens(compilerOptions).value,
Test / scalacOptions --= scalacOptionTokens(Set(ScalacOptions.warnNonUnitStatement)).value,
scalafmtOnCompile := true,
scalafmtOnCompile := false,
scalacOptions += compilerOptionFailDiscard,
Test / testOptions += Tests.Argument("-oDG"),
ThisBuild / versionScheme := Some("early-semver"),
Expand Down Expand Up @@ -125,7 +127,8 @@ lazy val kyoJVM = project
`kyo-combinators`.jvm,
`kyo-playwright`.jvm,
`kyo-examples`.jvm,
`kyo-actor`.jvm
`kyo-actor`.jvm,
`kyo-grpc`.jvm
)

lazy val kyoJS = project
Expand All @@ -150,7 +153,8 @@ lazy val kyoJS = project
`kyo-zio`.js,
`kyo-cats`.js,
`kyo-combinators`.js,
`kyo-actor`.js
`kyo-actor`.js,
`kyo-grpc`.js
)

lazy val kyoNative = project
Expand Down Expand Up @@ -586,8 +590,124 @@ lazy val `kyo-cats` =
)
.jsSettings(
`js-settings`
).jvmSettings(mimaCheck(false))

lazy val `kyo-grpc` =
crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.settings(
crossScalaVersions := Seq.empty,
publishArtifact := false,
publish := {},
publishLocal := {}
)
.aggregate(
`kyo-grpc-core`,
`kyo-grpc-code-gen`,
`kyo-grpc-e2e`
)

lazy val `kyo-grpc-jvm` =
`kyo-grpc`
.jvm
.aggregate(`kyo-grpc-protoc-gen`.componentProjects.map(p => p: ProjectReference) *)

lazy val `kyo-grpc-core` =
crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.in(file("kyo-grpc") / "core")
.dependsOn(`kyo-core`)
.settings(`kyo-settings`)
.settings(
libraryDependencies += "org.scalamock" %% "scalamock" % "7.5.0" % Test
)
.jvmSettings(
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion,
"io.grpc" % "grpc-api" % "1.72.0",
// It is a little unusual to include this here but it greatly reduces the amount of generated code.
"io.grpc" % "grpc-stub" % "1.72.0",
"ch.qos.logback" % "logback-classic" % "1.5.18" % Test
)
).jsSettings(
`js-settings`,
libraryDependencies ++= Seq( //
"com.thesamet.scalapb.grpcweb" %%% "scalapb-grpcweb" % "0.7.0")
)

lazy val `kyo-grpc-code-gen` =
crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.in(file("kyo-grpc") / "code-gen")
.enablePlugins(BuildInfoPlugin)
.settings(
`kyo-settings`,
buildInfoKeys := Seq[BuildInfoKey](name, organization, version, scalaVersion, sbtVersion),
buildInfoPackage := "kyo.grpc.compiler",
crossScalaVersions := List(scala213Version, scala3Version),
scalacOptions ++= scalacOptionToken(ScalacOptions.source3).value,
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "compilerplugin" % scalapb.compiler.Version.scalapbVersion,
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.12.0",
"org.typelevel" %%% "paiges-core" % "0.4.3"
)
).jsSettings(
`js-settings`
)

lazy val `kyo-grpc-code-gen_2.12` =
`kyo-grpc-code-gen`
.jvm
.settings(scalaVersion := scala212Version)

lazy val `kyo-grpc-code-genJS_2.12` =
`kyo-grpc-code-gen`
.js
.settings(scalaVersion := scala212Version)

lazy val `kyo-grpc-protoc-gen` =
protocGenProject("kyo-grpc-protoc-gen", `kyo-grpc-code-gen_2.12`)
.settings(
`kyo-settings`,
scalaVersion := scala212Version,
crossScalaVersions := Seq(scala212Version),
Compile / mainClass := Some("kyo.grpc.compiler.CodeGenerator")
)
.aggregateProjectSettings(
scalaVersion := scala212Version,
crossScalaVersions := Seq(scala212Version)
)

lazy val `kyo-grpc-e2e` =
crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.in(file("kyo-grpc") / "e2e")
.enablePlugins(LocalCodeGenPlugin)
.dependsOn(`kyo-grpc-core` % "compile->compile;test->test")
.settings(
`kyo-settings`,
publish / skip := true,
Compile / PB.protoSources += sharedSourceDir("main").value / "protobuf",
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb",
// Users of the plugin can use: kyo.grpc.gen() -> (Compile / sourceManaged).value / "scalapb"
genModule("kyo.grpc.compiler.CodeGenerator$") -> (Compile / sourceManaged).value / "scalapb"
),
Compile / scalacOptions ++= scalacOptionToken(ScalacOptions.warnOption("conf:src=.*/src_managed/main/scalapb/kgrpc/.*:silent")).value
).jvmSettings(
codeGenClasspath := (`kyo-grpc-code-gen_2.12` / Compile / fullClasspath).value,
libraryDependencies ++= Seq(
"io.grpc" % "grpc-netty-shaded" % "1.72.0",
"ch.qos.logback" % "logback-classic" % "1.5.18" % Test
)
).jsSettings(
`js-settings`,
codeGenClasspath := (`kyo-grpc-code-genJS_2.12` / Compile / fullClasspath).value,
libraryDependencies += "com.thesamet.scalapb.grpcweb" %%% "scalapb-grpcweb" % "0.7.0"
)
.jvmSettings(mimaCheck(false))

lazy val `kyo-combinators` =
crossProject(JSPlatform, JVMPlatform, NativePlatform)
Expand Down Expand Up @@ -640,17 +760,52 @@ lazy val `kyo-bench` =
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("kyo-bench"))
.enablePlugins(JmhPlugin)
.dependsOn(`kyo-core`)
.dependsOn(`kyo-parse`)
.dependsOn(`kyo-sttp`)
.dependsOn(`kyo-stm`)
.dependsOn(`kyo-direct`)
.dependsOn(`kyo-scheduler-zio`)
.dependsOn(`kyo-scheduler-cats`)
.enablePlugins(Fs2Grpc, JmhPlugin, LocalCodeGenPlugin)
.disablePlugins(MimaPlugin)
.dependsOn(
`kyo-core`,
`kyo-direct`,
`kyo-grpc-core`,
`kyo-parse`,
`kyo-scheduler-cats`,
`kyo-scheduler-zio`,
`kyo-stm`,
`kyo-sttp`
)
.settings(
`kyo-settings`,
publish / skip := true,
Compile / PB.protoSources += baseDirectory.value.getParentFile / "src" / "main" / "protobuf",
Compile / PB.targets := {
val scalapbDir = (Compile / sourceManaged).value / "scalapb"
// This includes the base scalapb.gen.
val catsGen = Fs2GrpcPlugin.autoImport.scalapbCodeGenerators.value
catsGen ++ Seq[Target](
scalapb.gen(scala3Sources = true) -> scalapbDir / "vanilla",
scalapb.zio_grpc.ZioCodeGenerator -> scalapbDir,
genModule("kyo.grpc.compiler.CodeGenerator$") -> scalapbDir
)
},
Compile / PB.generate ~= { files =>
files.filter(_.isFile).filter(_.getPath.contains("/vanilla/")).foreach { file =>
val fileContent = IO.read(file)
val updatedContent = fileContent
// Workaround for https://github.com/scalapb/ScalaPB/issues/1816.
.replace(
"_unknownFields__.parseField(tag, _input__)",
"_unknownFields__.parseField(tag, _input__): Unit"
)
// Hacky workaround to not get a collision with the one generated by Kyo and ZIO.
.replace(
"kgrpc.bench",
"vanilla.kgrpc.bench",
)
IO.write(file, updatedContent)
}
files
},
codeGenClasspath := (`kyo-grpc-code-gen_2.12` / Compile / fullClasspath).value,
Compile / scalacOptions ++= scalacOptionToken(ScalacOptions.warnOption("conf:src=.*/src_managed/main/scalapb/kgrpc/.*:silent")).value,
Test / testForkedParallel := true,
// Forks each test suite individually
Test / testGrouping := {
Expand All @@ -674,26 +829,28 @@ lazy val `kyo-bench` =
)
}
},
libraryDependencies += "dev.zio" %% "izumi-reflect" % "3.0.3",
libraryDependencies += "org.typelevel" %% "cats-effect" % catsVersion,
libraryDependencies += "org.typelevel" %% "log4cats-core" % "2.7.1",
libraryDependencies += "org.typelevel" %% "log4cats-slf4j" % "2.7.1",
libraryDependencies += "org.typelevel" %% "cats-mtl" % "1.5.0",
libraryDependencies += "io.github.timwspence" %% "cats-stm" % "0.13.5",
libraryDependencies += "com.47deg" %% "fetch" % "3.2.0",
libraryDependencies += "dev.zio" %% "zio-logging" % "2.5.0",
libraryDependencies += "dev.zio" %% "zio-logging-slf4j2" % "2.5.0",
libraryDependencies += "dev.zio" %% "zio" % zioVersion,
libraryDependencies += "dev.zio" %% "zio-concurrent" % zioVersion,
libraryDependencies += "dev.zio" %% "zio-query" % "0.7.7",
libraryDependencies += "dev.zio" %% "zio-parser" % "0.1.11",
libraryDependencies += "dev.zio" %% "zio-prelude" % "1.0.0-RC41",
libraryDependencies += "co.fs2" %% "fs2-core" % "3.12.0",
libraryDependencies += "org.http4s" %% "http4s-ember-client" % "1.0.0-M44",
libraryDependencies += "org.http4s" %% "http4s-dsl" % "1.0.0-M44",
libraryDependencies += "dev.zio" %% "zio-http" % "3.3.3",
libraryDependencies += "io.vertx" % "vertx-core" % "5.0.0",
libraryDependencies += "io.vertx" % "vertx-web" % "5.0.0"
libraryDependencies += "dev.zio" %% "izumi-reflect" % "3.0.3",
libraryDependencies += "org.typelevel" %% "cats-effect" % catsVersion,
libraryDependencies += "org.typelevel" %% "log4cats-core" % "2.7.1",
libraryDependencies += "org.typelevel" %% "log4cats-slf4j" % "2.7.1",
libraryDependencies += "org.typelevel" %% "cats-mtl" % "1.5.0",
libraryDependencies += "io.github.timwspence" %% "cats-stm" % "0.13.5",
libraryDependencies += "com.47deg" %% "fetch" % "3.2.0",
libraryDependencies += "dev.zio" %% "zio-logging" % "2.5.0",
libraryDependencies += "dev.zio" %% "zio-logging-slf4j2" % "2.5.0",
libraryDependencies += "dev.zio" %% "zio" % zioVersion,
libraryDependencies += "dev.zio" %% "zio-concurrent" % zioVersion,
libraryDependencies += "dev.zio" %% "zio-query" % "0.7.7",
libraryDependencies += "dev.zio" %% "zio-parser" % "0.1.11",
libraryDependencies += "dev.zio" %% "zio-prelude" % "1.0.0-RC41",
libraryDependencies += "com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion,
libraryDependencies += "co.fs2" %% "fs2-core" % "3.12.0",
libraryDependencies += "org.http4s" %% "http4s-ember-client" % "1.0.0-M44",
libraryDependencies += "org.http4s" %% "http4s-dsl" % "1.0.0-M44",
libraryDependencies += "dev.zio" %% "zio-http" % "3.3.3",
libraryDependencies += "io.grpc" % "grpc-netty-shaded" % "1.72.0",
libraryDependencies += "io.vertx" % "vertx-core" % "5.0.0",
libraryDependencies += "io.vertx" % "vertx-web" % "5.0.0"
)

lazy val rewriteReadmeFile = taskKey[Unit]("Rewrite README file")
Expand All @@ -706,6 +863,7 @@ lazy val readme =
.crossType(CrossType.Full)
.in(file("target/readme"))
.enablePlugins(MdocPlugin)
.disablePlugins(ProtocPlugin)
.settings(
`kyo-settings`,
mdocIn := new File("./../../README-in.md"),
Expand Down Expand Up @@ -766,6 +924,10 @@ def mimaCheck(failOnProblem: Boolean) =
mimaFailOnProblem := failOnProblem
)

def sharedSourceDir(conf: String) = Def.setting {
CrossType.Full.sharedSrcDir(baseDirectory.value, conf).get.getParentFile
}

// --- Scalafix

lazy val V = _root_.scalafix.sbt.BuildInfo
Expand Down
19 changes: 19 additions & 0 deletions kyo-bench/src/main/protobuf/bench.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";

// Don't use kyo here because otherwise it cannot derive the Frame.
package kgrpc;

service TestService {
rpc OneToOne(Request) returns (Response);
rpc OneToMany(Request) returns (stream Response);
rpc ManyToOne(stream Request) returns (Response);
rpc ManyToMany(stream Request) returns (stream Response);
}

message Request {
string message = 1;
}

message Response {
string message = 1;
}
Loading
Loading