Skip to content

Commit cb33801

Browse files
committed
Add separate module for fs2 v2 (with cats-effect 2)
1 parent d5950fa commit cb33801

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

build.sbt

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ val sttpModelVersion = "1.4.1"
1010

1111
val scalaTestVersion = "3.2.7"
1212
val zioVersion = "1.0.5"
13-
val fs2Version: Option[(Long, Long)] => String = {
13+
val fs2_2_version: Option[(Long, Long)] => String = {
1414
case Some((2, 11)) => "2.1.0"
1515
case _ => "2.5.4"
1616
}
17+
val fs2_3_version = "3.0.1"
1718

1819
excludeLintKeys in Global ++= Set(ideSkipProject)
1920

@@ -58,15 +59,17 @@ val commonNativeSettings = commonSettings ++ Seq(
5859

5960
lazy val projectAggregates: Seq[ProjectReference] = if (sys.env.isDefinedAt("STTP_NATIVE")) {
6061
println("[info] STTP_NATIVE defined, including sttp-native in the aggregate projects")
61-
core.projectRefs ++ ws.projectRefs ++ akka.projectRefs ++ fs2.projectRefs ++ monix.projectRefs ++ zio.projectRefs
62+
core.projectRefs ++ ws.projectRefs ++ akka.projectRefs ++ fs2ce2.projectRefs ++ fs2.projectRefs ++ monix.projectRefs ++ zio.projectRefs
6263
} else {
6364
println("[info] STTP_NATIVE *not* defined, *not* including sttp-native in the aggregate projects")
6465
scala2.flatMap(v => List[ProjectReference](core.js(v), ws.js(v))) ++
65-
scala2.flatMap(v => List[ProjectReference](core.jvm(v), ws.jvm(v), fs2.jvm(v), monix.jvm(v), zio.jvm(v))) ++
66-
scala3.flatMap(v => List[ProjectReference](core.jvm(v), ws.jvm(v), fs2.jvm(v))) ++
66+
scala2.flatMap(v => List[ProjectReference](core.jvm(v), ws.jvm(v), fs2ce2.jvm(v), monix.jvm(v), zio.jvm(v))) ++
67+
scala3.flatMap(v => List[ProjectReference](core.jvm(v), ws.jvm(v), fs2ce2.jvm(v), fs2.jvm(v))) ++
6768
List[ProjectReference](
6869
akka.jvm(scala2_12),
6970
akka.jvm(scala2_13),
71+
fs2.jvm(scala2_12),
72+
fs2.jvm(scala2_13),
7073
monix.js(scala2_12),
7174
monix.js(scala2_13),
7275
zio.js(scala2_12),
@@ -129,11 +132,11 @@ lazy val akka = (projectMatrix in file("akka"))
129132
)
130133
.dependsOn(core)
131134

132-
lazy val fs2 = (projectMatrix in file("fs2"))
135+
lazy val fs2ce2 = (projectMatrix in file("fs2-ce2"))
133136
.settings(
134-
name := "fs2",
137+
name := "fs2-ce2",
135138
libraryDependencies ++= dependenciesFor(scalaVersion.value)(
136-
"co.fs2" %% "fs2-io" % fs2Version(_)
139+
"co.fs2" %% "fs2-io" % fs2_2_version(_)
137140
)
138141
)
139142
.jvmPlatform(
@@ -142,6 +145,17 @@ lazy val fs2 = (projectMatrix in file("fs2"))
142145
)
143146
.dependsOn(core)
144147

148+
lazy val fs2 = (projectMatrix in file("fs2"))
149+
.settings(
150+
name := "fs2",
151+
libraryDependencies += "co.fs2" %% "fs2-io" % fs2_3_version
152+
)
153+
.jvmPlatform(
154+
scalaVersions = List(scala2_12, scala2_13) ++ scala3,
155+
settings = commonJvmSettings
156+
)
157+
.dependsOn(core)
158+
145159
lazy val monix = (projectMatrix in file("monix"))
146160
.settings(
147161
name := "monix",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package sttp.capabilities.fs2
2+
3+
import fs2.Stream
4+
import sttp.capabilities.Streams
5+
6+
trait Fs2Streams[F[_]] extends Streams[Fs2Streams[F]] {
7+
override type BinaryStream = Stream[F, Byte]
8+
override type Pipe[A, B] = fs2.Pipe[F, A, B]
9+
}
10+
object Fs2Streams {
11+
def apply[F[_]]: Fs2Streams[F] = new Fs2Streams[F] {}
12+
}

0 commit comments

Comments
 (0)