diff --git a/build.sbt b/build.sbt index ee95cc523e..5a60ec5e05 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,3 @@ -import com.typesafe.tools.mima.core.* import org.scalajs.linker.interface.ModuleSplitStyle import sbtcrossproject.CrossPlugin.autoImport.{ crossProject, CrossType } @@ -16,23 +15,23 @@ val http4sVersion = "0.23.24" val javaTimeVersion = "2.5.0" val jsoniterVersion = "2.25.0" val laminextVersion = "0.16.2" -val magnoliaScala2Version = "1.1.6" +val magnoliaScala2Version = "1.1.8" val magnoliaScala3Version = "1.3.4" val pekkoHttpVersion = "1.0.0" -val playVersion = "3.0.0" +val playVersion = "3.0.1" val playJsonVersion = "3.0.1" val scalafmtVersion = "3.7.17" val sttpVersion = "3.9.1" -val tapirVersion = "1.9.4" -val zioVersion = "2.0.19" +val tapirVersion = "1.9.5" +val zioVersion = "2.0.20" val zioInteropCats2Version = "22.0.0.0" -val zioInteropCats3Version = "23.0.0.8" +val zioInteropCats3Version = "23.1.0.0" val zioInteropReactiveVersion = "2.0.2" val zioConfigVersion = "3.0.7" val zqueryVersion = "0.6.0" val zioJsonVersion = "0.6.2" val zioHttpVersion = "3.0.0-RC4" -val zioOpenTelemetryVersion = "3.0.0-RC15" +val zioOpenTelemetryVersion = "3.0.0-RC19" val zioPreludeVersion = "1.0.0-RC21" Global / onChangedBuildSource := ReloadOnSourceChanges @@ -646,17 +645,20 @@ lazy val commonSettings = Def.settings( "-Ywarn-unused:-nowarn", "-Ywarn-nullary-override", "-Ywarn-nullary-unit", - "-opt-inline-from:", "-opt-warnings", - "-opt:l:inline", "-opt:l:method", + "-opt:l:inline", + "-opt-inline-from:scala.**", "-explaintypes" ) case Some((2, 13)) => Seq( "-Xlint:-byname-implicit", - "-explaintypes", - "-opt:l:method" + "-Ybackend-parallelism:4", + "-opt:l:method", + "-opt:l:inline", + "-opt-inline-from:scala.**", + "-explaintypes" ) case Some((3, _)) => diff --git a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/project/build.properties b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/project/build.properties index b19d4e1ed7..0aa5c39b87 100644 --- a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/project/build.properties +++ b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/project/build.properties @@ -1 +1 @@ -sbt.version = 1.9.7 +sbt.version = 1.9.8 diff --git a/core/src/main/scala/caliban/parsing/parsers/StringParsers.scala b/core/src/main/scala/caliban/parsing/parsers/StringParsers.scala index dc8b48b5e0..4cc22e15ef 100644 --- a/core/src/main/scala/caliban/parsing/parsers/StringParsers.scala +++ b/core/src/main/scala/caliban/parsing/parsers/StringParsers.scala @@ -103,10 +103,11 @@ private[caliban] trait StringParsers { case (Some(value), head :: tail) => head :: tail.map(_.drop(value)) case _ => l1 } + // NOTE: @noinline annotation required as Scala 2.12 inlines `.dropWhile` which results in compilation error since these methods are used within fastparse's macros // remove start lines that are only whitespaces - val l3 = l2.dropWhile("[ \t]*".r.replaceAllIn(_, "").isEmpty) + val l3 = l2.dropWhile("[ \t]*".r.replaceAllIn(_, "").isEmpty): @noinline // remove end lines that are only whitespaces - val l4 = l3.reverse.dropWhile("[ \t]*".r.replaceAllIn(_, "").isEmpty).reverse + val l4 = (l3.reverse.dropWhile("[ \t]*".r.replaceAllIn(_, "").isEmpty): @noinline).reverse l4.mkString("\n") } } diff --git a/project/build.properties b/project/build.properties index b19d4e1ed7..0aa5c39b87 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.9.7 +sbt.version = 1.9.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 9266c98c22..1bf079c06c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,7 +6,7 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % sbtcrossProjectVersion) addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % sbtcrossProjectVersion) -addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7") addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.1") diff --git a/sbt b/sbt index cf2fb176ff..e184929823 100755 --- a/sbt +++ b/sbt @@ -34,8 +34,8 @@ set -o pipefail -declare -r sbt_release_version="1.9.7" -declare -r sbt_unreleased_version="1.9.7" +declare -r sbt_release_version="1.9.8" +declare -r sbt_unreleased_version="1.9.8" declare -r latest_dotty="3.3.1" declare -r latest_213="2.13.12" diff --git a/tracing/src/main/scala/caliban/tracing/FieldTracer.scala b/tracing/src/main/scala/caliban/tracing/FieldTracer.scala index 1bfc27272f..0eb75b5989 100644 --- a/tracing/src/main/scala/caliban/tracing/FieldTracer.scala +++ b/tracing/src/main/scala/caliban/tracing/FieldTracer.scala @@ -1,14 +1,12 @@ package caliban.tracing -import caliban.CalibanError -import caliban.ResponseValue +import caliban.{ CalibanError, ResponseValue } import caliban.execution.FieldInfo -import io.opentelemetry.api.trace.StatusCode import caliban.wrappers.Wrapper.FieldWrapper +import io.opentelemetry.api.trace.StatusCode import zio._ -import zio.query.{ QueryAspect, ZQuery } -import zio.query._ -import zio.telemetry.opentelemetry.tracing.{ ErrorMapper, Tracing } +import zio.query.ZQuery +import zio.telemetry.opentelemetry.tracing.{ StatusMapper, Tracing } object FieldTracer { val wrapper = new FieldWrapper[Tracing] { @@ -21,7 +19,8 @@ object FieldTracer { ) { case (span, end) => end } { case (span, _) => query.foldCauseQuery( cause => { - val status = cause.failureOption.flatMap(ErrorMapper.default.body.lift).getOrElse(StatusCode.ERROR) + val status = + cause.failureOption.flatMap(StatusMapper.default.failure.lift).fold(StatusCode.ERROR)(_.statusCode) ZQuery.fromZIO(ZIO.succeed(span.setStatus(status, cause.prettyPrint))) *> ZQuery.failCause(cause) }, value => ZQuery.succeed(value) diff --git a/tracing/src/main/scala/caliban/tracing/SchemaTracer.scala b/tracing/src/main/scala/caliban/tracing/SchemaTracer.scala index d787fe919a..6f5e0b666d 100644 --- a/tracing/src/main/scala/caliban/tracing/SchemaTracer.scala +++ b/tracing/src/main/scala/caliban/tracing/SchemaTracer.scala @@ -1,25 +1,20 @@ package caliban.tracing -import caliban.CalibanError -import caliban.GraphQLResponse -import caliban.InputValue import caliban.InputValue.ObjectValue -import caliban.Value import caliban.Value.FloatValue.FloatNumber import caliban.Value.IntValue.IntNumber import caliban.Value.StringValue -import caliban.execution.ExecutionRequest -import caliban.execution.Field +import caliban.execution.{ ExecutionRequest, Field } import caliban.parsing.adt.OperationType import caliban.tools.stitching.RemoteQuery import caliban.wrappers.Wrapper.ExecutionWrapper +import caliban.{ CalibanError, GraphQLResponse, InputValue, Value } import io.opentelemetry.api.trace.SpanKind -import zio.telemetry.opentelemetry.tracing.ErrorMapper -import zio.telemetry.opentelemetry.tracing.Tracing import zio._ +import zio.telemetry.opentelemetry.tracing.Tracing object SchemaTracer { - val wrapper = new ExecutionWrapper[Tracing] { + val wrapper: ExecutionWrapper[Tracing] = new ExecutionWrapper[Tracing] { def wrap[R <: Tracing]( f: ExecutionRequest => ZIO[R, Nothing, GraphQLResponse[CalibanError]] ): ExecutionRequest => ZIO[R, Nothing, GraphQLResponse[CalibanError]] = @@ -30,11 +25,11 @@ object SchemaTracer { if (parentField == "__schema") f(request) else ZIO.serviceWithZIO[Tracing](tracer => - tracer.span[R, Nothing, GraphQLResponse[CalibanError]]( + tracer.span( spanName(request), SpanKind.INTERNAL ) { - ZIO.foreach(attributes(request.field)) { case (k, v) => + ZIO.foreachDiscard(attributes(request.field)) { case (k, v) => tracer.setAttribute(k, v) } *> f(request) }