Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/jsoniter scala core 2.13.13 #179

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 22 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,11 @@ lazy val http4s = projectMatrix
.settings(
isCE3 := virtualAxes.value.contains(CatsEffect3Axis),
libraryDependencies ++= {
Seq(
val ce3 =
if (isCE3.value) Seq(Dependencies.CatsEffect3.value)
else Seq.empty

ce3 ++ Seq(
Dependencies.Http4s.core.value,
Dependencies.Http4s.dsl.value,
Dependencies.Http4s.client.value,
Expand Down Expand Up @@ -547,8 +551,11 @@ lazy val tests = projectMatrix
.settings(
isCE3 := virtualAxes.value.contains(CatsEffect3Axis),
libraryDependencies ++= {
val ce3 =
if (isCE3.value) Seq(Dependencies.CatsEffect3.value)
else Seq.empty

Seq(
ce3 ++ Seq(
Dependencies.Http4s.core.value,
Dependencies.Http4s.dsl.value,
Dependencies.Http4s.emberClient.value,
Expand Down Expand Up @@ -641,7 +648,7 @@ lazy val Dependencies = new {

val Jsoniter =
Def.setting(
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-core" % "2.13.12"
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-core" % "2.13.13"
)

val Smithy = new {
Expand Down Expand Up @@ -669,14 +676,25 @@ lazy val Dependencies = new {
Def.setting("io.circe" %%% "circe-generic" % "0.14.1")
}

/*
* we override the version to use the fix included in
* https://github.com/typelevel/cats-effect/pull/2945
* it allows us to use UUIDGen instead of calling
* UUID.randomUUID manually
*
* we also provide a 2.12 shim under:
* modules/tests/src-ce2/UUIDGen.scala
*/
val CatsEffect3: Def.Initialize[ModuleID] =
Def.setting("org.typelevel" %%% "cats-effect" % "3.3.11")

object Http4s {
val http4sVersion = Def.setting(if (isCE3.value) "0.23.11" else "0.22.12")

val emberServer: Def.Initialize[ModuleID] =
Def.setting("org.http4s" %%% "http4s-ember-server" % http4sVersion.value)
val emberClient: Def.Initialize[ModuleID] =
Def.setting("org.http4s" %%% "http4s-ember-client" % http4sVersion.value)

val circe: Def.Initialize[ModuleID] =
Def.setting("org.http4s" %%% "http4s-circe" % http4sVersion.value)
val core: Def.Initialize[ModuleID] =
Expand Down
24 changes: 24 additions & 0 deletions modules/tests/src-ce2/UUIDGen.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2021 Disney Streaming
*
* Licensed under the Tomorrow Open Source Technology License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://disneystreaming.github.io/TOST-1.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cats.effect.std
daddykotex marked this conversation as resolved.
Show resolved Hide resolved

import java.util.UUID
import cats.effect._

object UUIDGen {
def randomUUID[F[_]: Sync]: F[UUID] = Sync[F].delay(UUID.randomUUID())
}
3 changes: 2 additions & 1 deletion modules/tests/src/smithy4s/tests/PizzaAdminServiceImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import smithy4s.example._
import java.util.UUID

import PizzaAdminServiceImpl._
import cats.effect.std.UUIDGen

object PizzaAdminServiceImpl {
case class Item(food: Food, price: Float, addedAt: Timestamp)
Expand All @@ -50,7 +51,7 @@ class PizzaAdminServiceImpl(ref: Compat.Ref[IO, State])
PriceError(s"Prices must be whole numbers: ${menuItem.price}")
)
.unlessA(menuItem.price.isWhole)
uuid <- IO(java.util.UUID.randomUUID())
uuid <- UUIDGen.randomUUID[IO]
timestamp <- IO(Timestamp.nowUTC())
_ <- ref.update { state =>
val item = Item(menuItem.food, menuItem.price, timestamp)
Expand Down
6 changes: 2 additions & 4 deletions modules/tests/src/smithy4s/tests/PizzaClientSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package smithy4s.tests

import cats.data.Chain
import cats.effect.Resource
import cats.effect._
import cats.effect.std.UUIDGen
import cats.syntax.all._
import io.circe.Json
import org.http4s.HttpApp
Expand All @@ -31,8 +31,6 @@ import smithy4s.Timestamp
import smithy4s.example._
import weaver._

import java.util.UUID

abstract class PizzaClientSpec extends IOSuite {

val pizzaItem = Json.obj(
Expand All @@ -49,7 +47,7 @@ abstract class PizzaClientSpec extends IOSuite {
clientTest("Errors make it through") { (client, backend, log) =>
for {
ts <- IO(Timestamp.nowUTC())
uuid <- IO(UUID.randomUUID())
uuid <- UUIDGen.randomUUID[IO]
response <- Created(
Json.fromString(uuid.toString),
Header.Raw(
Expand Down