Skip to content

Commit

Permalink
Update zio-nio to 1.0.0-RC12 (#286)
Browse files Browse the repository at this point in the history
* Update zio-nio to 1.0.0-RC12

* update scala 3 version to 3.1.0

Co-authored-by: Scala Steward <[email protected]>
  • Loading branch information
regis-leray and scala-steward authored Jan 8, 2022
1 parent fb4b7bd commit a8bb3b6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lazy val `zio-s3` = project
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-nio" % "1.0.0-RC11",
"dev.zio" %% "zio-nio" % "1.0.0-RC12",
"dev.zio" %% "zio-interop-reactivestreams" % "1.3.9",
"software.amazon.awssdk" % "s3" % awsVersion,
"software.amazon.awssdk" % "sts" % awsVersion,
Expand Down
6 changes: 3 additions & 3 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scalafix.sbt.ScalafixPlugin.autoImport._
object BuildHelper {
val Scala212 = "2.12.15"
val Scala213 = "2.13.5"
val ScalaDotty = "3.0.2"
val ScalaDotty = "3.1.0"

private val stdOptions = Seq(
"-deprecation",
Expand Down Expand Up @@ -117,9 +117,9 @@ object BuildHelper {
crossScalaVersions := Seq(Scala212, Scala213),
ThisBuild / scalaVersion := Scala213,
scalacOptions := stdOptions ++ extraOptions(scalaVersion.value, optimize = !isSnapshot.value),
semanticdbEnabled := !(scalaVersion.value == ScalaDotty), // enable SemanticDB
semanticdbEnabled := scalaVersion.value != ScalaDotty, // enable SemanticDB
semanticdbOptions += "-P:semanticdb:synthetics:on",
semanticdbVersion := scalafixSemanticdb.revision, // use Scalafix compatible version
semanticdbVersion := scalafixSemanticdb.revision, // use Scalafix compatible version
ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value),
ThisBuild / scalafixDependencies ++= List(
"com.github.liancheng" %% "organize-imports" % "0.4.3",
Expand Down
16 changes: 10 additions & 6 deletions src/main/scala/zio/s3/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ import java.nio.file.StandardOpenOption
import java.nio.file.attribute.BasicFileAttributes
import java.util.UUID
import java.util.concurrent.CompletableFuture

import software.amazon.awssdk.services.s3.S3AsyncClient
import software.amazon.awssdk.services.s3.model.S3Exception
import zio._
import zio.blocking.Blocking
import zio.nio.channels.FileChannel
import zio.nio.core.file.{ Path => ZPath }
import zio.nio.channels.{ AsynchronousFileChannel }
import zio.nio.file.{ Path => ZPath }
import zio.nio.file.Files
import zio.s3.S3Bucket._
import zio.stream.{ Stream, ZStream }

import java.io.FileNotFoundException

/**
Expand Down Expand Up @@ -174,10 +174,14 @@ object Test {
_ <- filePath.parent
.map(parentPath => Files.createDirectories(parentPath).provide(blocking))
.getOrElse(ZIO.unit)
_ <- FileChannel

_ <- AsynchronousFileChannel
.open(filePath, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW)
.provide(blocking)
.use(channel => content.foreachChunk(channel.writeChunk))
.use(channel =>
content
.mapChunks(Chunk.succeed)
.foldM(0L) { case (pos, c) => channel.writeChunk(c, pos).map(_ => pos + c.length) }
)
} yield ()).orDie

override def execute[T](f: S3AsyncClient => CompletableFuture[T]): IO[S3Exception, T] =
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/zio/s3/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import software.amazon.awssdk.regions.Region
import software.amazon.awssdk.services.s3.S3AsyncClient
import software.amazon.awssdk.services.s3.model.S3Exception
import zio.blocking.Blocking
import zio.nio.core.file.{ Path => ZPath }
import zio.nio.file.{ Path => ZPath }
import zio.s3.S3Bucket.S3BucketListing
import zio.s3.providers.const
import zio.stream.{ Stream, ZStream, ZTransducer }
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/zio/s3/S3Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.util.UUID
import software.amazon.awssdk.regions.Region
import software.amazon.awssdk.services.s3.model.{ ObjectCannedACL, S3Exception }
import zio.blocking.Blocking
import zio.nio.core.file.{ Path => ZPath }
import zio.nio.file.{ Path => ZPath }
import zio.nio.file.{ Files => ZFiles }
import zio.stream.{ ZStream, ZTransducer }
import zio.test.Assertion._
Expand Down

0 comments on commit a8bb3b6

Please sign in to comment.