From 429568e8edf1baccfca5606c6431caf886aec11b Mon Sep 17 00:00:00 2001 From: calvinlfer Date: Sun, 18 Feb 2024 21:30:37 -0500 Subject: [PATCH 1/4] Update Cats Effect and FS2 - Update Cats Effect to 3.5.3 - Update FS2 to 3.9.4 and use updated APIs --- build.sbt | 4 ++-- .../jvm/src/test/scala/zio/interop/fs2StreamSpec.scala | 2 +- .../src/main/scala/zio/stream/interop/FS2StreamSyntax.scala | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 80175134..383e520a 100644 --- a/build.sbt +++ b/build.sbt @@ -53,10 +53,10 @@ lazy val root = project val zioVersion = "2.0.21" val catsVersion = "2.9.0" -val catsEffectVersion = "3.4.8" +val catsEffectVersion = "3.5.3" val catsMtlVersion = "1.3.0" val disciplineScalaTestVersion = "2.2.0" -val fs2Version = "3.6.1" +val fs2Version = "3.9.4" val scalaJavaTimeVersion = "2.5.0" lazy val zioInteropTracer = crossProject(JSPlatform, JVMPlatform) diff --git a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/fs2StreamSpec.scala b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/fs2StreamSpec.scala index 14835ba2..99870c38 100644 --- a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/fs2StreamSpec.scala +++ b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/fs2StreamSpec.scala @@ -14,7 +14,7 @@ object fs2StreamSpec extends ZIOSpecDefault { val exception: Throwable = new Exception("Failed") def fs2StreamFromChunk[A](chunk: Chunk[A]) = - fs2.Stream.chunk[Task, A](fs2.Chunk.indexedSeq(chunk)) + fs2.Stream.chunk[Task, A](fs2.Chunk.from(chunk)) def assertEqual[A](actual: fs2.Stream[Task, A], expected: fs2.Stream[Task, A]) = for { diff --git a/zio-interop-cats/shared/src/main/scala/zio/stream/interop/FS2StreamSyntax.scala b/zio-interop-cats/shared/src/main/scala/zio/stream/interop/FS2StreamSyntax.scala index 0da1aa0d..64ded47a 100644 --- a/zio-interop-cats/shared/src/main/scala/zio/stream/interop/FS2StreamSyntax.scala +++ b/zio-interop-cats/shared/src/main/scala/zio/stream/interop/FS2StreamSyntax.scala @@ -25,7 +25,7 @@ class ZStreamSyntax[R, E, A](private val stream: ZStream[R, E, A]) extends AnyVa fs2.Stream.resource(Resource.scopedZIO[R, E, ZIO[R, Option[E], Chunk[A]]](stream.toPull)).flatMap { pull => fs2.Stream.repeatEval(pull.unsome).unNoneTerminate.flatMap { chunk => - fs2.Stream.chunk(fs2.Chunk.indexedSeq(chunk)) + fs2.Stream.chunk(fs2.Chunk.from(chunk)) } } } From c856f1d02b5bb9c489d94ebb9ca78da03935dff1 Mon Sep 17 00:00:00 2001 From: calvinlfer Date: Fri, 12 Apr 2024 10:59:46 -0400 Subject: [PATCH 2/4] Update to ZIO 2.0.22 and latest Scala LTS + maintenance versions and fix all Xsource errors --- build.sbt | 6 +++--- .../src/test/scala/zio/interop/test/CoreSummonSpec.scala | 2 +- project/BuildHelper.scala | 8 ++++---- project/build.properties | 2 +- .../zio/internal/stacktracer/InteropTracerSpec.scala | 4 ++-- .../jvm/src/test/scala/zio/interop/CatsInteropSpec.scala | 2 +- .../test/scala/zio/interop/CatsZManagedSyntaxSpec.scala | 2 +- .../jvm/src/test/scala/zio/interop/Fs2ZioSpec.scala | 2 +- .../jvm/src/test/scala/zio/interop/catzQueueSpec.scala | 2 +- .../jvm/src/test/scala/zio/interop/fs2StreamSpec.scala | 2 +- .../test/scala/zio/test/interop/CatsRunnableSpec.scala | 6 +++--- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build.sbt b/build.sbt index 383e520a..4904cbb0 100644 --- a/build.sbt +++ b/build.sbt @@ -51,12 +51,12 @@ lazy val root = project unusedCompileDependenciesFilter -= moduleFilter("org.scala-js", "scalajs-library") ) -val zioVersion = "2.0.21" +val zioVersion = "2.0.22" val catsVersion = "2.9.0" -val catsEffectVersion = "3.5.3" +val catsEffectVersion = "3.5.4" val catsMtlVersion = "1.3.0" val disciplineScalaTestVersion = "2.2.0" -val fs2Version = "3.9.4" +val fs2Version = "3.10.2" val scalaJavaTimeVersion = "2.5.0" lazy val zioInteropTracer = crossProject(JSPlatform, JVMPlatform) diff --git a/core-only-test/shared/src/test/scala/zio/interop/test/CoreSummonSpec.scala b/core-only-test/shared/src/test/scala/zio/interop/test/CoreSummonSpec.scala index 77492baa..564d5211 100644 --- a/core-only-test/shared/src/test/scala/zio/interop/test/CoreSummonSpec.scala +++ b/core-only-test/shared/src/test/scala/zio/interop/test/CoreSummonSpec.scala @@ -10,7 +10,7 @@ import zio.stream.{ Stream, ZStream } import zio.test.* object CoreSummonSpec extends ZIOSpecDefault { - override def spec = + override def spec: Spec[Any, Throwable] = suite("summons from catz.core work with only a cats-core dependency")( test("ZIO instances") { val monad = implicitly[Monad[UIO]] diff --git a/project/BuildHelper.scala b/project/BuildHelper.scala index a50916a0..e30569c9 100644 --- a/project/BuildHelper.scala +++ b/project/BuildHelper.scala @@ -9,9 +9,9 @@ import BuildInfoKeys._ object BuildHelper { val testDeps = Seq("org.scalacheck" %% "scalacheck" % "1.17.0" % Test) - val Scala212 = "2.12.17" - val Scala213 = "2.13.10" - val Scala3 = "3.3.0" + val Scala212 = "2.12.19" + val Scala213 = "2.13.13" + val Scala3 = "3.3.3" private val stdOptions = Seq( "-deprecation", @@ -92,7 +92,7 @@ object BuildHelper { scalacOptions ++= stdOptions ++ extraOptions(scalaVersion.value, optimize = !isSnapshot.value), libraryDependencies ++= testDeps ++ { if (isDotty(scalaVersion.value)) Seq.empty - else Seq(compilerPlugin("org.typelevel" % "kind-projector" % "0.13.2") cross CrossVersion.full) + else Seq(compilerPlugin("org.typelevel" % "kind-projector" % "0.13.3") cross CrossVersion.full) }, Test / parallelExecution := true, incOptions ~= (_.withLogRecompileOnMacro(false)), diff --git a/project/build.properties b/project/build.properties index 46e43a97..04267b14 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.2 +sbt.version=1.9.9 diff --git a/zio-interop-cats-tests/jvm/src/test/scala/zio/internal/stacktracer/InteropTracerSpec.scala b/zio-interop-cats-tests/jvm/src/test/scala/zio/internal/stacktracer/InteropTracerSpec.scala index 4809cc77..c5e5b7a9 100644 --- a/zio-interop-cats-tests/jvm/src/test/scala/zio/internal/stacktracer/InteropTracerSpec.scala +++ b/zio-interop-cats-tests/jvm/src/test/scala/zio/internal/stacktracer/InteropTracerSpec.scala @@ -5,8 +5,8 @@ import zio.Trace object InteropTracerSpec extends ZIOSpecDefault { - private val myLambda: () => Any = () => () - override def spec = + private val myLambda: () => Any = () => () + override def spec: Spec[Any, Throwable] = suite("InteropTracerSpec")( test("lambda tracing") { diff --git a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/CatsInteropSpec.scala b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/CatsInteropSpec.scala index cf27333b..f83c3c00 100644 --- a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/CatsInteropSpec.scala +++ b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/CatsInteropSpec.scala @@ -7,7 +7,7 @@ import zio.test.* import zio.* object CatsInteropSpec extends CatsRunnableSpec { - def spec = suite("Cats interop")( + def spec: Spec[Any, Throwable] = suite("Cats interop")( test("cats fiber wrapped in Resource can be canceled") { for { promise <- Promise.make[Nothing, Int] diff --git a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/CatsZManagedSyntaxSpec.scala b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/CatsZManagedSyntaxSpec.scala index ad70d8a0..74033e68 100644 --- a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/CatsZManagedSyntaxSpec.scala +++ b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/CatsZManagedSyntaxSpec.scala @@ -12,7 +12,7 @@ import scala.collection.mutable object CatsZManagedSyntaxSpec extends CatsRunnableSpec { - def spec = + def spec: Spec[Any, Throwable] = suite("CatsZManagedSyntaxSpec")( suite("toManaged")( test("calls finalizers correctly when use is externally interrupted") { diff --git a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/Fs2ZioSpec.scala b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/Fs2ZioSpec.scala index 498ac49c..c428737d 100644 --- a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/Fs2ZioSpec.scala +++ b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/Fs2ZioSpec.scala @@ -10,7 +10,7 @@ import zio.test.* import zio.test.interop.catz.test.* object Fs2ZioSpec extends CatsRunnableSpec { - def spec = + def spec: Spec[Any, Throwable] = suite("ZIO with Fs2")( suite("fs2 parJoin")( testF("works if F is cats.effect.IO") { diff --git a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/catzQueueSpec.scala b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/catzQueueSpec.scala index dfe7acdf..7aa14fdb 100644 --- a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/catzQueueSpec.scala +++ b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/catzQueueSpec.scala @@ -40,7 +40,7 @@ object catzQueueSpec extends CatsRunnableSpec { actual <- q.takeAll } yield assert(actual)(equalTo(expected.toList)) - def spec = suite("catzQueueSpec")( + def spec: Spec[Any, Throwable] = suite("catzQueueSpec")( testF("can use a bounded queue from Cats Effect IO")(boundedQueueTest[CIO]), testF("can use a dropping queue from Cats Effect IO")(droppingQueueTest[CIO]), testF("can use a sliding queue from Cats Effect IO")(slidingQueueTest[CIO]), diff --git a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/fs2StreamSpec.scala b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/fs2StreamSpec.scala index 99870c38..920c0d7d 100644 --- a/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/fs2StreamSpec.scala +++ b/zio-interop-cats-tests/jvm/src/test/scala/zio/interop/fs2StreamSpec.scala @@ -28,7 +28,7 @@ object fs2StreamSpec extends ZIOSpecDefault { y <- expected.runCollect } yield assert(x)(equalTo(y)) - def spec = suite("zio.stream.ZStream <-> fs2.Stream")( + def spec: Spec[Any, Throwable] = suite("zio.stream.ZStream <-> fs2.Stream")( suite("test toFs2Stream conversion")( test("simple stream")(check(Gen.chunkOf(Gen.int)) { (chunk: Chunk[Int]) => assertEqual(ZStream.fromChunk(chunk).toFs2Stream, fs2StreamFromChunk(chunk)) diff --git a/zio-test-interop-cats/shared/src/test/scala/zio/test/interop/CatsRunnableSpec.scala b/zio-test-interop-cats/shared/src/test/scala/zio/test/interop/CatsRunnableSpec.scala index 29a525a6..475f4dd9 100644 --- a/zio-test-interop-cats/shared/src/test/scala/zio/test/interop/CatsRunnableSpec.scala +++ b/zio-test-interop-cats/shared/src/test/scala/zio/test/interop/CatsRunnableSpec.scala @@ -32,15 +32,15 @@ abstract class CatsRunnableSpec extends ZIOSpecDefault { Unsafe.unsafe { implicit u => runtime.unsafe.runToFuture { ZIO.fromFuture { implicit ec => - Dispatcher.parallel[CIO].allocated.unsafeToFuture().andThen { case Success((dispatcher, close)) => - openDispatcher = dispatcher + Dispatcher.parallel[CIO].allocated.unsafeToFuture().andThen { case Success((disp, close)) => + openDispatcher = disp closeDispatcher = close } }.orDie } } - override val aspects = Chunk( + override val aspects: Chunk[TestAspect[Nothing, Any, Nothing, Any]] = Chunk( TestAspect.timeout(1.minute), TestAspect.afterAll(ZIO.fromFuture(_ => closeDispatcher.unsafeToFuture()).orDie) ) From 9e91100b7e5517fd31fc383211d064d6635ad698 Mon Sep 17 00:00:00 2001 From: calvinlfer Date: Fri, 12 Apr 2024 11:06:52 -0400 Subject: [PATCH 3/4] Update GitHub Action Scala builds --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22985df4..d2b54942 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: fail-fast: false matrix: java: ['adopt@1.8', 'adopt@1.11'] - scala: ['2.12.17', '2.13.10', '3.3.0'] + scala: ['2.12.19', '2.13.13', '3.3.3'] platform: ['JVM', 'JS'] steps: - name: Checkout current branch @@ -45,10 +45,10 @@ jobs: - name: Cache scala dependencies uses: coursier/cache-action@v5 - name: Run tests - if: matrix.scala != '3.3.0' + if: matrix.scala != '3.3.3' run: sbt ++${{ matrix.scala }}! test${{ matrix.platform }} - name: Run dotty tests - if: matrix.scala == '3.3.0' && matrix.platform == 'JVM' + if: matrix.scala == '3.3.3' && matrix.platform == 'JVM' run: sbt ++${{ matrix.scala }}! testJVM ci: From 66812481943bf15cdb838ba73b17e5c8c3972742 Mon Sep 17 00:00:00 2001 From: calvinlfer Date: Thu, 9 May 2024 09:10:01 -0400 Subject: [PATCH 4/4] Update to ZIO 2.1.0 --- .gitignore | 1 + build.sbt | 6 +++--- project/BuildHelper.scala | 2 +- project/build.properties | 2 +- project/plugins.sbt | 1 + .../shared/src/test/scala/zio/interop/CatsSpecBase.scala | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5e031a7a..33f5a347 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ test-output/ .idea/ .bsp .vscode +.history/ \ No newline at end of file diff --git a/build.sbt b/build.sbt index 4904cbb0..3272d588 100644 --- a/build.sbt +++ b/build.sbt @@ -51,10 +51,10 @@ lazy val root = project unusedCompileDependenciesFilter -= moduleFilter("org.scala-js", "scalajs-library") ) -val zioVersion = "2.0.22" -val catsVersion = "2.9.0" +val zioVersion = "2.1.0" +val catsVersion = "2.10.0" val catsEffectVersion = "3.5.4" -val catsMtlVersion = "1.3.0" +val catsMtlVersion = "1.4.0" val disciplineScalaTestVersion = "2.2.0" val fs2Version = "3.10.2" val scalaJavaTimeVersion = "2.5.0" diff --git a/project/BuildHelper.scala b/project/BuildHelper.scala index e30569c9..4539d42b 100644 --- a/project/BuildHelper.scala +++ b/project/BuildHelper.scala @@ -7,7 +7,7 @@ import sbtbuildinfo._ import BuildInfoKeys._ object BuildHelper { - val testDeps = Seq("org.scalacheck" %% "scalacheck" % "1.17.0" % Test) + val testDeps = Seq("org.scalacheck" %% "scalacheck" % "1.18.0" % Test) val Scala212 = "2.12.19" val Scala213 = "2.13.13" diff --git a/project/build.properties b/project/build.properties index 04267b14..081fdbbc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.9 +sbt.version=1.10.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index 5338d18f..b79c4fd5 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,3 +9,4 @@ addSbtPlugin("de.heikoseeberger" % "sbt-header" % addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6") addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.8") +addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3") diff --git a/zio-interop-cats-tests/shared/src/test/scala/zio/interop/CatsSpecBase.scala b/zio-interop-cats-tests/shared/src/test/scala/zio/interop/CatsSpecBase.scala index 20116ec9..f308f672 100644 --- a/zio-interop-cats-tests/shared/src/test/scala/zio/interop/CatsSpecBase.scala +++ b/zio-interop-cats-tests/shared/src/test/scala/zio/interop/CatsSpecBase.scala @@ -98,7 +98,7 @@ private[zio] trait CatsSpecBase implicit def runtime(implicit ticker: Ticker): Runtime[Any] = { val tickerExecutor = Executor.fromExecutionContext(ticker.ctx) - val fiberId = FiberId.make(Trace.empty)(Unsafe.unsafe) + val fiberId = FiberId.generate(FiberRefs.empty)(Trace.empty)(Unsafe.unsafe) val fiberRefs = FiberRefs.empty .updatedAs(fiberId)(FiberRef.overrideExecutor, Some(tickerExecutor)) .updatedAs(fiberId)(FiberRef.currentBlockingExecutor, tickerExecutor)