Skip to content

Commit cb27efc

Browse files
committed
Spring cleaning / dependency bumps
1 parent 30237c4 commit cb27efc

6 files changed

Lines changed: 52 additions & 50 deletions

File tree

build.sbt

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ ThisBuild / organizationName := "Polyvariant"
44
ThisBuild / startYear := Some(2024)
55
ThisBuild / licenses := Seq(License.Apache2)
66
ThisBuild / developers := List(tlGitHubDev("kubukoz", "Jakub Kozłowski"))
7+
ThisBuild / tlJdkRelease := Some(17)
78

89
def crossPlugin(x: sbt.librarymanagement.ModuleID) = compilerPlugin(x.cross(CrossVersion.full))
910

1011
val compilerPlugins = List(
1112
crossPlugin("org.polyvariant" % "better-tostring" % "0.3.17")
1213
)
1314

14-
val Scala3 = "3.3.5"
15+
val Scala3 = "3.8.3"
1516

1617
ThisBuild / scalaVersion := Scala3
1718

@@ -20,12 +21,12 @@ ThisBuild / tlFatalWarnings := false
2021
val commonSettings = Seq(
2122
libraryDependencies ++=
2223
List(
23-
"org.http4s" %%% "http4s-client" % "0.23.25",
24-
"org.http4s" %%% "http4s-circe" % "0.23.25",
24+
"org.http4s" %%% "http4s-client" % "0.23.34",
25+
"org.http4s" %%% "http4s-circe" % "0.23.34",
2526
"com.kubukoz" %% "debug-utils" % "1.1.3",
26-
"org.typelevel" %%% "kittens" % "3.2.0" % Test,
27-
"com.disneystreaming" %%% "weaver-cats" % "0.8.4" % Test,
28-
"com.disneystreaming" %%% "weaver-scalacheck" % "0.8.4" % Test,
27+
"org.typelevel" %%% "kittens" % "3.5.0" % Test,
28+
"org.typelevel" %%% "weaver-cats" % "0.12.0" % Test,
29+
"org.typelevel" %%% "weaver-scalacheck" % "0.12.0" % Test,
2930
) ++
3031
compilerPlugins,
3132
scalacOptions ++= Seq(
@@ -51,9 +52,8 @@ lazy val example = crossProject(JVMPlatform, JSPlatform, NativePlatform)
5152
name := "respectfully-example",
5253
commonSettings,
5354
libraryDependencies ++= Seq(
54-
"org.http4s" %%% "http4s-ember-client" % "0.23.25",
55-
"org.http4s" %%% "http4s-ember-server" % "0.23.25",
56-
"io.chrisdavenport" %%% "crossplatformioapp" % "0.1.0",
55+
"org.http4s" %%% "http4s-ember-client" % "0.23.34",
56+
"org.http4s" %%% "http4s-ember-server" % "0.23.34",
5757
),
5858
)
5959
.jsSettings(
@@ -63,11 +63,6 @@ lazy val example = crossProject(JVMPlatform, JSPlatform, NativePlatform)
6363
.jvmSettings(
6464
Compile / fork := true
6565
)
66-
.nativeSettings(
67-
libraryDependencies ++= Seq(
68-
"com.armanbilge" %%% "epollcat" % "0.1.6"
69-
)
70-
)
7166
.enablePlugins(NoPublishPlugin)
7267

7368
lazy val root = tlCrossRootProject

core/src/test/scala/respectfully/test/ClientTests.scala

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,26 @@ object ClientTests extends SimpleIOSuite {
7272
req: Request[IO]
7373
)(
7474
modDecoder: Decoder[A] => Decoder[A]
75-
): A = req.attributes.lookup(BodyJson).get.as[A](modDecoder(summon[Decoder[A]])).toTry.get
75+
): A =
76+
req
77+
.attributes
78+
.lookup(BodyJson)
79+
.get
80+
.as[A](
81+
using modDecoder(summon[Decoder[A]])
82+
)
83+
.toTry
84+
.get
7685

7786
test("one op") {
7887
trait SimpleApi derives API {
7988
def op(): IO[Int]
8089
}
8190

8291
fakeClient(42).flatMap { (client, uri, captured) =>
83-
API[SimpleApi].toClient(client, uri).op().map(assert.eql(42, _)) *>
92+
API[SimpleApi].toClient(client, uri).op().map(expect.eql(42, _)) *>
8493
captured.map { req =>
85-
assert.eql("op", methodHeader(req)) &&
94+
expect.eql("op", methodHeader(req)) &&
8695
succeed(bodyJsonDecode[Unit](req))
8796
}
8897
}
@@ -94,9 +103,9 @@ object ClientTests extends SimpleIOSuite {
94103
}
95104

96105
fakeClient(42).flatMap { (client, uri, captured) =>
97-
API[SimpleApi].toClient(client, uri).op.map(assert.eql(42, _)) *>
106+
API[SimpleApi].toClient(client, uri).op.map(expect.eql(42, _)) *>
98107
captured.map { req =>
99-
assert.eql("op", methodHeader(req)) &&
108+
expect.eql("op", methodHeader(req)) &&
100109
succeed(bodyJsonDecode[Unit](req))
101110
}
102111
}
@@ -108,10 +117,10 @@ object ClientTests extends SimpleIOSuite {
108117
}
109118

110119
fakeClient("output").flatMap { (client, uri, captured) =>
111-
API[SimpleApi].toClient(client, uri).operation(42).map(assert.eql("output", _)) *>
120+
API[SimpleApi].toClient(client, uri).operation(42).map(expect.eql("output", _)) *>
112121
captured.map { req =>
113-
assert.eql("operation", methodHeader(req)) &&
114-
assert.eql(42, bodyJsonDecode[Int](req)(_.at("a")))
122+
expect.eql("operation", methodHeader(req)) &&
123+
expect.eql(42, bodyJsonDecode[Int](req)(_.at("a")))
115124
}
116125
}
117126
}
@@ -127,10 +136,10 @@ object ClientTests extends SimpleIOSuite {
127136
API[SimpleApi]
128137
.toClient(client, uri)
129138
.operation(Person("John", 42))
130-
.map(assert.eql(Person("John", 43), _)) *>
139+
.map(expect.eql(Person("John", 43), _)) *>
131140
captured.map { req =>
132-
assert.eql("operation", methodHeader(req)) &&
133-
assert.eql(Person("John", 42), bodyJsonDecode[Person](req)(_.at("a")))
141+
expect.eql("operation", methodHeader(req)) &&
142+
expect.eql(Person("John", 42), bodyJsonDecode[Person](req)(_.at("a")))
134143
}
135144
}
136145
}
@@ -142,11 +151,11 @@ object ClientTests extends SimpleIOSuite {
142151
}
143152

144153
fakeClient("42 foo").flatMap { (client, uri, captured) =>
145-
API[SimpleApi].toClient(client, uri).operation(42, "foo").map(assert.eql("42 foo", _)) *>
154+
API[SimpleApi].toClient(client, uri).operation(42, "foo").map(expect.eql("42 foo", _)) *>
146155
captured.map { req =>
147-
assert.eql("operation", methodHeader(req)) &&
148-
assert.eql(42, bodyJsonDecode[Int](req)(_.at("a"))) &&
149-
assert.eql("foo", bodyJsonDecode[String](req)(_.at("b")))
156+
expect.eql("operation", methodHeader(req)) &&
157+
expect.eql(42, bodyJsonDecode[Int](req)(_.at("a"))) &&
158+
expect.eql("foo", bodyJsonDecode[String](req)(_.at("b")))
150159
}
151160
}
152161
}
@@ -158,11 +167,11 @@ object ClientTests extends SimpleIOSuite {
158167
}
159168

160169
fakeClient("42 foo").flatMap { (client, uri, captured) =>
161-
API[SimpleApi].toClient(client, uri).operation(42)("foo").map(assert.eql("42 foo", _)) *>
170+
API[SimpleApi].toClient(client, uri).operation(42)("foo").map(expect.eql("42 foo", _)) *>
162171
captured.map { req =>
163-
assert.eql("operation", methodHeader(req)) &&
164-
assert.eql(42, bodyJsonDecode[Int](req)(_.at("a"))) &&
165-
assert.eql("foo", bodyJsonDecode[String](req)(_.at("b")))
172+
expect.eql("operation", methodHeader(req)) &&
173+
expect.eql(42, bodyJsonDecode[Int](req)(_.at("a"))) &&
174+
expect.eql("foo", bodyJsonDecode[String](req)(_.at("b")))
166175
}
167176
}
168177
}

core/src/test/scala/respectfully/test/ServerTests.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ object ServerTests extends SimpleIOSuite {
4848
.withEntity(body)
4949
.withHeaders("X-Method" -> method)
5050

51-
private def assertSuccess[A: Decoder: Eq](
51+
private def expectSuccess[A: Decoder: Eq](
5252
response: Response[IO],
5353
expected: A,
5454
) = response.as[A].map { body =>
55-
assert(response.status == Status.Ok) &&
56-
assert.eql(expected, body)
55+
expect(response.status == Status.Ok) &&
56+
expect.eql(expected, body)
5757
}
5858

5959
test("one op") {
@@ -66,7 +66,7 @@ object ServerTests extends SimpleIOSuite {
6666
API[SimpleApi]
6767
.toRoutes(impl)
6868
.run(request("op")(JsonObject.empty))
69-
.flatMap(assertSuccess(_, 42))
69+
.flatMap(expectSuccess(_, 42))
7070
}
7171

7272
test("one op without parameter lists") {
@@ -82,7 +82,7 @@ object ServerTests extends SimpleIOSuite {
8282
API[SimpleApi]
8383
.toRoutes(impl)
8484
.run(request("op")(JsonObject.empty))
85-
.flatMap(assertSuccess(_, 42))
85+
.flatMap(expectSuccess(_, 42))
8686
}
8787

8888
test("one op with param") {
@@ -95,7 +95,7 @@ object ServerTests extends SimpleIOSuite {
9595
API[SimpleApi]
9696
.toRoutes(impl)
9797
.run(request("operation")(JsonObject("a" := 42)))
98-
.flatMap(assertSuccess(_, 43))
98+
.flatMap(expectSuccess(_, 43))
9999
}
100100

101101
test("one op with more complex param") {
@@ -110,7 +110,7 @@ object ServerTests extends SimpleIOSuite {
110110
API[SimpleApi]
111111
.toRoutes(impl)
112112
.run(request("operation")(JsonObject("a" := Person("John", 42))))
113-
.flatMap(assertSuccess(_, Person("John", 43)))
113+
.flatMap(expectSuccess(_, Person("John", 43)))
114114
}
115115

116116
test("two params") {
@@ -124,7 +124,7 @@ object ServerTests extends SimpleIOSuite {
124124
API[SimpleApi]
125125
.toRoutes(impl)
126126
.run(request("operation")(JsonObject("a" := 42, "b" := "John")))
127-
.flatMap(assertSuccess(_, "42 John"))
127+
.flatMap(expectSuccess(_, "42 John"))
128128
}
129129

130130
test("two parameter lists") {
@@ -141,6 +141,6 @@ object ServerTests extends SimpleIOSuite {
141141
API[SimpleApi]
142142
.toRoutes(impl)
143143
.run(request("operation")(JsonObject("a" := 42, "b" := "John")))
144-
.flatMap(assertSuccess(_, "42 John"))
144+
.flatMap(expectSuccess(_, "42 John"))
145145
}
146146
}

example/src/main/scala/respectfully/Demo.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@
1717
package respectfully
1818

1919
import cats.effect.IO
20+
import cats.effect.IOApp
2021
import io.circe.Codec
2122
import io.circe.Decoder
2223
import io.circe.Encoder
2324
import org.http4s.HttpApp
24-
import org.http4s.Response
2525
import org.http4s.Uri
26-
import org.http4s.circe.CirceEntityCodec.*
2726
import org.http4s.client.Client
2827
import org.http4s.ember.client.EmberClientBuilder
2928
import org.http4s.ember.server.EmberServerBuilder
30-
import io.chrisdavenport.crossplatformioapp.CrossPlatformIOApp
3129

32-
object Demo extends CrossPlatformIOApp.Simple {
30+
object Demo extends IOApp.Simple {
3331

3432
case class User(id: Int, name: String, age: Int) derives Codec.AsObject
3533

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.11.2
1+
sbt.version=1.12.9

project/plugins.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.8.0")
2-
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17")
3-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.19.0")
1+
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.8.5")
2+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.11")
3+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.21.0")

0 commit comments

Comments
 (0)