diff --git a/.travis.yml b/.travis.yml index 07fb84b..0de1c71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: scala scala: - - 2.12.6 - - 2.11.11 + - 2.12.10 + - 2.11.12 + - 2.13.0 jdk: - openjdk8 diff --git a/build.sbt b/build.sbt index b57d3d9..28a26ce 100644 --- a/build.sbt +++ b/build.sbt @@ -1,13 +1,13 @@ name := "sangria-akka-streams" organization := "org.sangria-graphql" -version := "1.0.2-SNAPSHOT" +mimaPreviousArtifacts := Set("org.sangria-graphql" %% "sangria-akka-streams" % "1.0.1") description := "Sangria akka-streams integration" homepage := Some(url("http://sangria-graphql.org")) licenses := Seq("Apache License, ASL Version 2.0" → url("http://www.apache.org/licenses/LICENSE-2.0")) -scalaVersion := "2.12.6" -crossScalaVersions := Seq("2.11.11", "2.12.6") +scalaVersion := "2.13.0" +crossScalaVersions := Seq("2.11.12", "2.12.10", scalaVersion.value) scalacOptions ++= Seq("-deprecation", "-feature") @@ -18,9 +18,11 @@ libraryDependencies ++= Seq( // Publishing +releaseCrossBuild := true +releasePublishArtifactsAction := PgpKeys.publishSigned.value publishMavenStyle := true publishArtifact in Test := false -pomIncludeRepository := (_ ⇒ false) +pomIncludeRepository := (_ => false) publishTo := Some( if (version.value.trim.endsWith("SNAPSHOT")) "snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" @@ -31,12 +33,12 @@ startYear := Some(2016) organizationHomepage := Some(url("https://github.com/sangria-graphql")) developers := Developer("OlegIlyenko", "Oleg Ilyenko", "", url("https://github.com/OlegIlyenko")) :: Nil scmInfo := Some(ScmInfo( - browseUrl = url("https://github.com/sangria-graphql/sangria-akka-streams.git"), - connection = "scm:git:git@github.com:sangria-graphql/sangria-akka-streams.git" + browseUrl = url("https://github.com/sangria-graphql-org/sangria-akka-streams.git"), + connection = "scm:git:git@github.com:sangria-graphql-org/sangria-akka-streams.git" )) // nice *magenta* prompt! -shellPrompt in ThisBuild := { state ⇒ +shellPrompt in ThisBuild := { state => scala.Console.MAGENTA + Project.extract(state).currentRef.project + "> " + scala.Console.RESET -} \ No newline at end of file +} diff --git a/project/coverage.sbt b/project/coverage.sbt deleted file mode 100644 index 45558ee..0000000 --- a/project/coverage.sbt +++ /dev/null @@ -1,2 +0,0 @@ -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") -addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..98cc519 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,10 @@ +resolvers += Resolver.url( + "typesafe sbt-plugins", + url("https://dl.bintray.com/typesafe/sbt-plugins") +)(Resolver.ivyStylePatterns) + +addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") +addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") diff --git a/src/main/scala/sangria/streaming/akkaStreams.scala b/src/main/scala/sangria/streaming/akkaStreams.scala index 2765402..148f173 100644 --- a/src/main/scala/sangria/streaming/akkaStreams.scala +++ b/src/main/scala/sangria/streaming/akkaStreams.scala @@ -22,26 +22,26 @@ object akkaStreams { class AkkaStreamsSubscriptionStream(implicit materializer: Materializer) extends SubscriptionStream[AkkaSource] { def supported[T[_]](other: SubscriptionStream[T]) = other.isInstanceOf[AkkaStreamsSubscriptionStream] - def map[A, B](source: AkkaSource[A])(fn: A ⇒ B) = source.map(fn) + def map[A, B](source: AkkaSource[A])(fn: A => B) = source.map(fn) def singleFuture[T](value: Future[T]) = Source.fromFuture(value) def single[T](value: T) = Source.single(value) - def mapFuture[A, B](source: AkkaSource[A])(fn: A ⇒ Future[B]) = + def mapFuture[A, B](source: AkkaSource[A])(fn: A => Future[B]) = source.mapAsync(1)(fn) def first[T](s: AkkaSource[T]) = s.runWith(Sink.head) def failed[T](e: Throwable) = Source.failed(e).asInstanceOf[AkkaSource[T]] - def onComplete[Ctx, Res](result: AkkaSource[Res])(op: ⇒ Unit) = + def onComplete[Ctx, Res](result: AkkaSource[Res])(op: => Unit) = result - .via(OnComplete(() ⇒ op)) - .recover {case e ⇒ op; throw e} + .via(OnComplete(() => op)) + .recover {case e => op; throw e} .asInstanceOf[AkkaSource[Res]] - def flatMapFuture[Ctx, Res, T](future: Future[T])(resultFn: T ⇒ AkkaSource[Res]) = + def flatMapFuture[Ctx, Res, T](future: Future[T])(resultFn: T => AkkaSource[Res]) = Source.fromFuture(future).flatMapMerge(1, resultFn) def merge[T](streams: Vector[AkkaSource[T]]) = { @@ -53,8 +53,8 @@ object akkaStreams { throw new IllegalStateException("No streams produced!") } - def recover[T](stream: AkkaSource[T])(fn: Throwable ⇒ T) = - stream recover {case e ⇒ fn(e)} + def recover[T](stream: AkkaSource[T])(fn: Throwable => T) = + stream recover {case e => fn(e)} } implicit def akkaSubscriptionStream(implicit materializer: Materializer): SubscriptionStream[AkkaSource] = new AkkaStreamsSubscriptionStream @@ -65,7 +65,7 @@ object akkaStreams { val subscriptionStream = new AkkaStreamsSubscriptionStream } - private final case class OnComplete[T](op: () ⇒ Unit) extends SimpleLinearGraphStage[T] { + private final case class OnComplete[T](op: () => Unit) extends SimpleLinearGraphStage[T] { override def toString: String = "OnComplete" override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = diff --git a/src/test/scala/sangria/streaming/AkkStreamsIntegrationSpec.scala b/src/test/scala/sangria/streaming/AkkStreamsIntegrationSpec.scala index 3f8f028..c6173f1 100644 --- a/src/test/scala/sangria/streaming/AkkStreamsIntegrationSpec.scala +++ b/src/test/scala/sangria/streaming/AkkStreamsIntegrationSpec.scala @@ -36,7 +36,7 @@ class AkkStreamsIntegrationSpec extends WordSpec with Matchers { } "mapFuture" in { - res(impl.mapFuture(source(1, 2, 10))(x ⇒ Future.successful(x + 1))) should be (List(2, 3, 11)) + res(impl.mapFuture(source(1, 2, 10))(x => Future.successful(x + 1))) should be (List(2, 3, 11)) } "first" in { @@ -63,7 +63,7 @@ class AkkStreamsIntegrationSpec extends WordSpec with Matchers { } "onComplete handles failure" in { - val s = source(1, 2, 3) map { i ⇒ + val s = source(1, 2, 3) map { i => if (i == 2) throw new IllegalStateException("foo") else i } @@ -79,16 +79,16 @@ class AkkStreamsIntegrationSpec extends WordSpec with Matchers { } "flatMapFuture" in { - res(impl.flatMapFuture(Future.successful(1))(i ⇒ source(i.toString, (i + 1).toString))) should be (List("1", "2")) + res(impl.flatMapFuture(Future.successful(1))(i => source(i.toString, (i + 1).toString))) should be (List("1", "2")) } "recover" in { - val obs = source(1, 2, 3, 4) map { i ⇒ + val obs = source(1, 2, 3, 4) map { i => if (i == 3) throw new IllegalStateException("foo") else i } - res(impl.recover(obs)(_ ⇒ 100)) should be (List(1, 2, 100)) + res(impl.recover(obs)(_ => 100)) should be (List(1, 2, 100)) } "merge" in { @@ -139,10 +139,10 @@ class AkkStreamsIntegrationSpec extends WordSpec with Matchers { } def source[T](elems: T*): Source[T, NotUsed] = - Source.fromIterator(() ⇒ Iterator(elems: _*)) + Source.fromIterator(() => Iterator(elems: _*)) def res[T](s: Source[T, NotUsed]) = - Await.result(s.runFold(List.empty[T]){case (acc, e) ⇒ acc :+ e}, 2 seconds) + Await.result(s.runFold(List.empty[T]){case (acc, e) => acc :+ e}, 2 seconds) def res[T](f: Future[T]) = Await.result(f, 2 seconds) diff --git a/version.sbt b/version.sbt new file mode 100644 index 0000000..6931dd9 --- /dev/null +++ b/version.sbt @@ -0,0 +1 @@ +version in ThisBuild := "1.0.2-SNAPSHOT"