From 527430cf9bc8fdb181a8700940cbeb2d55bc8a28 Mon Sep 17 00:00:00 2001 From: Pierre Ricadat Date: Wed, 27 May 2020 18:18:02 +0900 Subject: [PATCH] Upgrade ZIO to 1.0.0-RC20 (#160) --- .../opentelemetry/example/BackendServer.scala | 5 +++-- .../opentelemetry/example/ProxyServer.scala | 5 +++-- .../opentracing/example/BackendServer.scala | 12 ++++++------ .../telemetry/opentracing/example/ProxyServer.scala | 12 ++++++------ project/Dependencies.scala | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/opentelemetry-example/src/main/scala/zio/telemetry/opentelemetry/example/BackendServer.scala b/opentelemetry-example/src/main/scala/zio/telemetry/opentelemetry/example/BackendServer.scala index ab288d60..30b0e727 100644 --- a/opentelemetry-example/src/main/scala/zio/telemetry/opentelemetry/example/BackendServer.scala +++ b/opentelemetry-example/src/main/scala/zio/telemetry/opentelemetry/example/BackendServer.scala @@ -7,7 +7,7 @@ import zio.interop.catz._ import zio.telemetry.opentelemetry.Tracing import zio.telemetry.opentelemetry.example.config.{ Config, Configuration } import zio.telemetry.opentelemetry.example.http.{ AppEnv, AppTask, Client, StatusService } -import zio.{ Managed, ZIO, ZLayer } +import zio.{ ExitCode, Managed, ZIO, ZLayer } import org.http4s.syntax.kleisli._ import sttp.client.asynchttpclient.zio.AsyncHttpClientZioBackend @@ -34,5 +34,6 @@ object BackendServer extends zio.App { val tracer = Configuration.live >>> JaegerTracer.live("zio-backend") val envLayer = tracer ++ Clock.live >>> Tracing.live ++ Configuration.live ++ client - override def run(args: List[String]) = server.provideCustomLayer(envLayer).fold(_ => 1, _ => 0) + override def run(args: List[String]) = + server.provideCustomLayer(envLayer).fold(_ => ExitCode.failure, _ => ExitCode.success) } diff --git a/opentelemetry-example/src/main/scala/zio/telemetry/opentelemetry/example/ProxyServer.scala b/opentelemetry-example/src/main/scala/zio/telemetry/opentelemetry/example/ProxyServer.scala index 24d66408..09c96cfb 100644 --- a/opentelemetry-example/src/main/scala/zio/telemetry/opentelemetry/example/ProxyServer.scala +++ b/opentelemetry-example/src/main/scala/zio/telemetry/opentelemetry/example/ProxyServer.scala @@ -7,7 +7,7 @@ import zio.interop.catz._ import zio.telemetry.opentelemetry.Tracing import zio.telemetry.opentelemetry.example.config.{ Config, Configuration } import zio.telemetry.opentelemetry.example.http.{ AppEnv, AppTask, Client, StatusesService } -import zio.{ Managed, ZIO, ZLayer } +import zio.{ ExitCode, Managed, ZIO, ZLayer } import org.http4s.syntax.kleisli._ import sttp.client.asynchttpclient.zio.AsyncHttpClientZioBackend @@ -35,5 +35,6 @@ object ProxyServer extends zio.App { val tracer = Configuration.live >>> JaegerTracer.live("zio-proxy") val envLayer = tracer ++ Clock.live >>> Tracing.live ++ Configuration.live ++ client - override def run(args: List[String]) = server.provideCustomLayer(envLayer).fold(_ => 1, _ => 0) + override def run(args: List[String]) = + server.provideCustomLayer(envLayer).fold(_ => ExitCode.failure, _ => ExitCode.success) } diff --git a/opentracing-example/src/main/scala/zio/telemetry/opentracing/example/BackendServer.scala b/opentracing-example/src/main/scala/zio/telemetry/opentracing/example/BackendServer.scala index 4d1d754e..6c08bd32 100644 --- a/opentracing-example/src/main/scala/zio/telemetry/opentracing/example/BackendServer.scala +++ b/opentracing-example/src/main/scala/zio/telemetry/opentracing/example/BackendServer.scala @@ -1,6 +1,6 @@ package zio.telemetry.opentracing.example -import cats.effect.ExitCode +import cats.effect.{ ExitCode => catsExitCode } import org.http4s.server.Router import org.http4s.server.blaze.BlazeServerBuilder import org.http4s.syntax.kleisli._ @@ -8,11 +8,11 @@ import zio.interop.catz._ import zio.telemetry.opentracing.example.JaegerTracer.makeService import zio.telemetry.opentracing.example.config.Configuration import zio.telemetry.opentracing.example.http.{ AppTask, StatusService } -import zio.{ ZEnv, ZIO } +import zio.{ ExitCode, ZEnv, ZIO } object BackendServer extends CatsApp { - override def run(args: List[String]): ZIO[ZEnv, Nothing, Int] = + override def run(args: List[String]): ZIO[ZEnv, Nothing, ExitCode] = (for { conf <- Configuration.load.provideLayer(Configuration.live) service = makeService(conf.tracer.host, "zio-backend") @@ -21,8 +21,8 @@ object BackendServer extends CatsApp { .bindHttp(conf.backend.port, conf.backend.host) .withHttpApp(router) .serve - .compile[AppTask, AppTask, ExitCode] + .compile[AppTask, AppTask, catsExitCode] .drain - .as(0) - } yield result).orElse(ZIO.succeed(1)) + .as(ExitCode.success) + } yield result).orElse(ZIO.succeed(ExitCode.failure)) } diff --git a/opentracing-example/src/main/scala/zio/telemetry/opentracing/example/ProxyServer.scala b/opentracing-example/src/main/scala/zio/telemetry/opentracing/example/ProxyServer.scala index 35c2d500..f9eb5413 100644 --- a/opentracing-example/src/main/scala/zio/telemetry/opentracing/example/ProxyServer.scala +++ b/opentracing-example/src/main/scala/zio/telemetry/opentracing/example/ProxyServer.scala @@ -1,6 +1,6 @@ package zio.telemetry.opentracing.example -import cats.effect.ExitCode +import cats.effect.{ ExitCode => catsExitCode } import org.http4s.server.Router import org.http4s.server.blaze.BlazeServerBuilder import org.http4s.syntax.kleisli._ @@ -9,11 +9,11 @@ import zio.interop.catz._ import zio.telemetry.opentracing.example.JaegerTracer.makeService import zio.telemetry.opentracing.example.config.Configuration import zio.telemetry.opentracing.example.http.{ AppTask, StatusesService } -import zio.{ ZEnv, ZIO } +import zio.{ ExitCode, ZEnv, ZIO } object ProxyServer extends CatsApp { - override def run(args: List[String]): ZIO[ZEnv, Nothing, Int] = + override def run(args: List[String]): ZIO[ZEnv, Nothing, ExitCode] = (for { conf <- Configuration.load.provideLayer(Configuration.live) service = makeService(conf.tracer.host, "zio-proxy") @@ -23,9 +23,9 @@ object ProxyServer extends CatsApp { .bindHttp(conf.proxy.port, conf.proxy.host) .withHttpApp(router) .serve - .compile[AppTask, AppTask, ExitCode] + .compile[AppTask, AppTask, catsExitCode] .drain - .as(0) - } yield result) orElse ZIO.succeed(1) + .as(ExitCode.success) + } yield result) orElse ZIO.succeed(ExitCode.failure) } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index f42fc7a7..3e5bdf25 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -9,7 +9,7 @@ object Dependencies { val opentelemetry = "0.3.0" val opencensus = "0.26.0" val zipkin = "2.15.0" - val zio = "1.0.0-RC19-2" + val zio = "1.0.0-RC20" } lazy val zio = Seq(