Skip to content

Commit

Permalink
fix scala3 build, naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Caparow committed Sep 21, 2023
1 parent 98d4c2e commit 1afdbde
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 66 deletions.
38 changes: 19 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ lazy val `idealingua-v1-model` = crossProject(JVMPlatform, JSPlatform).crossType
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand All @@ -143,15 +143,15 @@ lazy val `idealingua-v1-model` = crossProject(JVMPlatform, JSPlatform).crossType
)
.jvmSettings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
scalaVersion := crossScalaVersions.value.head
)
.jsSettings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
Expand Down Expand Up @@ -275,7 +275,7 @@ lazy val `idealingua-v1-core` = crossProject(JVMPlatform, JSPlatform).crossType(
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand Down Expand Up @@ -439,7 +439,7 @@ lazy val `idealingua-v1-runtime-rpc-scala` = crossProject(JVMPlatform, JSPlatfor
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand All @@ -458,15 +458,15 @@ lazy val `idealingua-v1-runtime-rpc-scala` = crossProject(JVMPlatform, JSPlatfor
)
.jvmSettings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
scalaVersion := crossScalaVersions.value.head
)
.jsSettings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
Expand Down Expand Up @@ -508,7 +508,7 @@ lazy val `idealingua-v1-runtime-rpc-http4s` = project.in(file("idealingua-v1/ide
)
.settings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
Expand Down Expand Up @@ -608,7 +608,7 @@ lazy val `idealingua-v1-runtime-rpc-http4s` = project.in(file("idealingua-v1/ide
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand Down Expand Up @@ -752,7 +752,7 @@ lazy val `idealingua-v1-transpilers` = crossProject(JVMPlatform, JSPlatform).cro
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand Down Expand Up @@ -820,7 +820,7 @@ lazy val `idealingua-v1-test-defs` = project.in(file("idealingua-v1/idealingua-v
)
.settings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
Expand Down Expand Up @@ -920,7 +920,7 @@ lazy val `idealingua-v1-test-defs` = project.in(file("idealingua-v1/idealingua-v
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand Down Expand Up @@ -951,7 +951,7 @@ lazy val `idealingua-v1-runtime-rpc-typescript` = project.in(file("idealingua-v1
)
.settings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
Expand Down Expand Up @@ -1051,7 +1051,7 @@ lazy val `idealingua-v1-runtime-rpc-typescript` = project.in(file("idealingua-v1
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand Down Expand Up @@ -1082,7 +1082,7 @@ lazy val `idealingua-v1-runtime-rpc-go` = project.in(file("idealingua-v1/idealin
)
.settings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
Expand Down Expand Up @@ -1182,7 +1182,7 @@ lazy val `idealingua-v1-runtime-rpc-go` = project.in(file("idealingua-v1/idealin
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand Down Expand Up @@ -1213,7 +1213,7 @@ lazy val `idealingua-v1-runtime-rpc-csharp` = project.in(file("idealingua-v1/ide
)
.settings(
crossScalaVersions := Seq(
"3.3.1-RC4",
"3.3.1",
"2.13.11",
"2.12.18"
),
Expand Down Expand Up @@ -1313,7 +1313,7 @@ lazy val `idealingua-v1-runtime-rpc-csharp` = project.in(file("idealingua-v1/ide
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand Down Expand Up @@ -1452,7 +1452,7 @@ lazy val `idealingua-v1-compiler` = project.in(file("idealingua-v1/idealingua-v1
"-Ycache-plugin-class-loader:always",
"-Ycache-macro-class-loader:last-modified"
)
case (_, "3.3.1-RC4") => Seq(
case (_, "3.3.1") => Seq(
"-release:8",
"-Ykind-projector:underscores",
"-no-indent",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import izumi.functional.bio.{Exit, F, IO2, Primitives2, Temporal2, UnsafeRun2}
import izumi.fundamentals.platform.language.Quirks
import izumi.fundamentals.platform.time.IzTime
import izumi.idealingua.runtime.rpc.*
import izumi.idealingua.runtime.rpc.http4s.HttpServer.{ServerWsMessageHandler, WsResponseMarker}
import izumi.idealingua.runtime.rpc.http4s.HttpServer.{ServerWsRpcHandler, WsResponseMarker}
import izumi.idealingua.runtime.rpc.http4s.ws.*
import izumi.idealingua.runtime.rpc.http4s.ws.WsClientSession.WsClientSessionImpl
import izumi.idealingua.runtime.rpc.http4s.ws.WsContextProvider.WsAuthResult
Expand Down Expand Up @@ -153,8 +153,8 @@ class HttpServer[F[+_, +_]: IO2: Temporal2: Primitives2: UnsafeRun2, RequestCtx,
}).map(_.map(p => printer.print(p.asJson)))
}

protected def wsHandler(context: WsClientSession[F, RequestCtx, ClientId]): WsMessageHandler[F, RequestCtx] = {
new ServerWsMessageHandler(muxer, wsContextProvider, context, logger)
protected def wsHandler(context: WsClientSession[F, RequestCtx, ClientId]): WsRpcHandler[F, RequestCtx] = {
new ServerWsRpcHandler(muxer, wsContextProvider, context, logger)
}

protected def onWsHeartbeat(requestTime: ZonedDateTime): F[Throwable, Unit] = {
Expand Down Expand Up @@ -232,12 +232,12 @@ class HttpServer[F[+_, +_]: IO2: Temporal2: Primitives2: UnsafeRun2, RequestCtx,

object HttpServer {
case object WsResponseMarker
class ServerWsMessageHandler[F[+_, +_]: IO2, RequestCtx, ClientId](
class ServerWsRpcHandler[F[+_, +_]: IO2, RequestCtx, ClientId](
muxer: IRTServerMultiplexor[F, RequestCtx],
wsContextProvider: WsContextProvider[F, RequestCtx, ClientId],
context: WsClientSession[F, RequestCtx, ClientId],
logger: LogIO2[F],
) extends WsMessageHandler[F, RequestCtx](muxer, context, logger) {
) extends WsRpcHandler[F, RequestCtx](muxer, context, logger) {
override def handlePacket(packet: RpcPacket): F[Throwable, Unit] = {
wsContextProvider.toId(context.initialContext, context.id, packet).flatMap(context.updateId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import io.circe.parser.parse
import izumi.functional.bio.{Exit, F, IO2}
import izumi.functional.lifecycle.Lifecycle
import izumi.idealingua.runtime.rpc.*
import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcClientDispatcher.IRTDispatcherRaw
import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcDispatcher.IRTDispatcherRaw
import izumi.idealingua.runtime.rpc.http4s.{HttpExecutionContext, IRTUnexpectedHttpStatus}
import logstage.LogIO2
import org.http4s.*
import org.http4s.blaze.client.*
import org.http4s.client.Client

class HttpRpcClientDispatcher[F[+_, +_]: IO2](
class HttpRpcDispatcher[F[+_, +_]: IO2](
uri: Uri,
codec: IRTClientMultiplexor[F],
executionContext: HttpExecutionContext,
Expand Down Expand Up @@ -121,7 +121,7 @@ class HttpRpcClientDispatcher[F[+_, +_]: IO2](
}
}

object HttpRpcClientDispatcher {
object HttpRpcDispatcher {
trait IRTDispatcherRaw[F[_, _]] extends IRTDispatcher[F] {
def dispatchRaw(method: IRTMethodId, body: String): F[Throwable, IRTMuxResponse]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import izumi.functional.bio.{F, IO2}
import izumi.fundamentals.platform.language.Quirks.Discarder
import izumi.idealingua.runtime.rpc.*
import izumi.idealingua.runtime.rpc.http4s.HttpExecutionContext
import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcClientDispatcher.IRTDispatcherRaw
import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcDispatcher.IRTDispatcherRaw
import logstage.LogIO2
import org.http4s.*
import org.http4s.blaze.client.BlazeClientBuilder
import org.typelevel.ci.*

class HttpRpcClientDispatcherFactory[F[+_, +_]: IO2](
class HttpRpcDispatcherFactory[F[+_, +_]: IO2](
codec: IRTClientMultiplexor[F],
executionContext: HttpExecutionContext,
printer: circe.Printer,
Expand All @@ -25,7 +25,7 @@ class HttpRpcClientDispatcherFactory[F[+_, +_]: IO2](
tweakRequest: Request[F[Throwable, _]] => Request[F[Throwable, _]] = (req: Request[F[Throwable, _]]) => req,
resourceCheck: F[Throwable, Unit] = F.unit,
): IRTDispatcherRaw[F] = {
new HttpRpcClientDispatcher[F](uri, codec, executionContext, printer, dispatcherLogger(uri, logger)) {
new HttpRpcDispatcher[F](uri, codec, executionContext, printer, dispatcherLogger(uri, logger)) {
override def dispatch(input: IRTMuxRequest): F[Throwable, IRTMuxResponse] = {
resourceCheck *> super.dispatch(input)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ package izumi.idealingua.runtime.rpc.http4s.clients
import io.circe.Json
import izumi.functional.bio.{Async2, F, Temporal2}
import izumi.idealingua.runtime.rpc.*
import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcher.WsRpcDispatcher
import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcherFactory.WsRpcClientConnection
import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcher.IRTDispatcherWs
import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcherFactory.WsRpcClientConnection
import izumi.idealingua.runtime.rpc.http4s.ws.RawResponse
import logstage.LogIO2

import java.util.concurrent.TimeoutException
import scala.concurrent.duration.FiniteDuration

class WsRpcClientDispatcher[F[+_, +_]: Async2](
class WsRpcDispatcher[F[+_, +_]: Async2](
connection: WsRpcClientConnection[F],
timeout: FiniteDuration,
codec: IRTClientMultiplexor[F],
logger: LogIO2[F],
) extends WsRpcDispatcher[F] {
) extends IRTDispatcherWs[F] {

override def authorize(headers: Map[String, String]): F[Throwable, Unit] = {
connection.authorize(headers, timeout)
Expand Down Expand Up @@ -60,8 +60,8 @@ class WsRpcClientDispatcher[F[+_, +_]: Async2](
}
}

object WsRpcClientDispatcher {
trait WsRpcDispatcher[F[_, _]] extends IRTDispatcher[F] {
object WsRpcDispatcher {
trait IRTDispatcherWs[F[_, _]] extends IRTDispatcher[F] {
def authorize(headers: Map[String, String]): F[Throwable, Unit]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import izumi.functional.bio.{Async2, F, IO2, Primitives2, Temporal2, UnsafeRun2}
import izumi.functional.lifecycle.Lifecycle
import izumi.fundamentals.platform.language.Quirks.Discarder
import izumi.idealingua.runtime.rpc.*
import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcher.WsRpcDispatcher
import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcherFactory.{ClientWsMessageHandler, WsRpcClientConnection, WsRpcContextProvider}
import izumi.idealingua.runtime.rpc.http4s.ws.{RawResponse, WsMessageHandler, WsRequestState}
import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcher.IRTDispatcherWs
import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcherFactory.{ClientWsRpcHandler, WsRpcClientConnection, WsRpcContextProvider}
import izumi.idealingua.runtime.rpc.http4s.ws.{RawResponse, WsRequestState, WsRpcHandler}
import logstage.LogIO2
import org.asynchttpclient.netty.ws.NettyWebSocket
import org.asynchttpclient.ws.{WebSocket, WebSocketListener, WebSocketUpgradeHandler}
Expand All @@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicReference
import scala.concurrent.duration.{DurationInt, FiniteDuration}
import scala.jdk.CollectionConverters.*

class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: UnsafeRun2](
class WsRpcDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: UnsafeRun2](
codec: IRTClientMultiplexor[F],
printer: Printer,
logger: LogIO2[F],
Expand All @@ -31,7 +31,7 @@ class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: Un
contextProvider: WsRpcContextProvider[ServerContext],
): Lifecycle[F[Throwable, _], WsRpcClientConnection[F]] = {
for {
client <- WsRpcClientDispatcherFactory.asyncHttpClient[F]
client <- WsRpcDispatcherFactory.asyncHttpClient[F]
requestState = new WsRequestState[F]
listener <- Lifecycle.liftF(F.syncThrowable(createListener(muxer, contextProvider, requestState, dispatcherLogger(uri, logger))))
handler <- Lifecycle.liftF(F.syncThrowable(new WebSocketUpgradeHandler(List(listener).asJava)))
Expand All @@ -47,11 +47,11 @@ class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: Un
uri: Uri,
muxer: IRTServerMultiplexor[F, ServerContext],
contextProvider: WsRpcContextProvider[ServerContext],
tweakRequest: RpcPacket => RpcPacket,
timeout: FiniteDuration = 30.seconds,
): Lifecycle[F[Throwable, _], WsRpcDispatcher[F]] = {
tweakRequest: RpcPacket => RpcPacket = identity,
timeout: FiniteDuration = 30.seconds,
): Lifecycle[F[Throwable, _], IRTDispatcherWs[F]] = {
connect(uri, muxer, contextProvider).map {
new WsRpcClientDispatcher(_, timeout, codec, dispatcherLogger(uri, logger)) {
new WsRpcDispatcher(_, timeout, codec, dispatcherLogger(uri, logger)) {
override protected def buildRequest(rpcPacketId: RpcPacketId, method: IRTMethodId, body: Json): RpcPacket = {
tweakRequest(super.buildRequest(rpcPacketId, method, body))
}
Expand All @@ -64,8 +64,8 @@ class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: Un
muxer: IRTServerMultiplexor[F, ServerContext],
contextProvider: WsRpcContextProvider[ServerContext],
requestState: WsRequestState[F],
): WsMessageHandler[F, ServerContext] = {
new ClientWsMessageHandler(muxer, requestState, contextProvider, logger)
): WsRpcHandler[F, ServerContext] = {
new ClientWsRpcHandler(muxer, requestState, contextProvider, logger)
}

protected def createListener[ServerContext](
Expand Down Expand Up @@ -110,7 +110,7 @@ class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: Un
}
}

object WsRpcClientDispatcherFactory {
object WsRpcDispatcherFactory {
def asyncHttpClient[F[+_, +_]: IO2]: Lifecycle[F[Throwable, _], DefaultAsyncHttpClient] = {
Lifecycle.fromAutoCloseable(F.syncThrowable {
new DefaultAsyncHttpClient(
Expand All @@ -129,12 +129,12 @@ object WsRpcClientDispatcherFactory {
})
}

class ClientWsMessageHandler[F[+_, +_]: IO2, ServerCtx](
class ClientWsRpcHandler[F[+_, +_]: IO2, ServerCtx](
muxer: IRTServerMultiplexor[F, ServerCtx],
requestState: WsRequestState[F],
contextProvider: WsRpcContextProvider[ServerCtx],
logger: LogIO2[F],
) extends WsMessageHandler[F, ServerCtx](muxer, requestState, logger) {
) extends WsRpcHandler[F, ServerCtx](muxer, requestState, logger) {
override def handlePacket(packet: RpcPacket): F[Throwable, Unit] = {
F.unit
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import izumi.functional.bio.{F, IO2, Primitives2, Temporal2}
import izumi.fundamentals.platform.time.IzTime
import izumi.fundamentals.platform.uuid.UUIDGen
import izumi.idealingua.runtime.rpc.*
import izumi.idealingua.runtime.rpc.http4s.ws.WsMessageHandler.WsClientResponder
import izumi.idealingua.runtime.rpc.http4s.ws.WsRpcHandler.WsClientResponder
import logstage.LogIO2
import org.http4s.websocket.WebSocketFrame
import org.http4s.websocket.WebSocketFrame.Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import izumi.functional.bio.{F, IO2, Primitives2, Promise2, Temporal2}
import izumi.fundamentals.platform.language.Quirks.*
import izumi.idealingua.runtime.rpc.*
import izumi.idealingua.runtime.rpc.http4s.ws.RawResponse.BadRawResponse
import izumi.idealingua.runtime.rpc.http4s.ws.WsMessageHandler.WsClientResponder
import izumi.idealingua.runtime.rpc.http4s.ws.WsRpcHandler.WsClientResponder

import java.util.concurrent.ConcurrentHashMap
import scala.concurrent.duration.FiniteDuration
Expand Down
Loading

0 comments on commit 1afdbde

Please sign in to comment.