From bc35cfff9fc94e16f964625a3a8ab8dbbfc6f150 Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Mon, 28 Oct 2019 09:54:19 +0100 Subject: [PATCH 1/4] prepare release --- build.sbt | 8 +++++--- project/coverage.sbt | 2 -- project/plugins.sbt | 10 ++++++++++ version.sbt | 1 + 4 files changed, 16 insertions(+), 5 deletions(-) delete mode 100644 project/coverage.sbt create mode 100644 project/plugins.sbt create mode 100644 version.sbt diff --git a/build.sbt b/build.sbt index b57d3d9..1c5c39f 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ 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")) @@ -18,6 +18,8 @@ libraryDependencies ++= Seq( // Publishing +releaseCrossBuild := true +releasePublishArtifactsAction := PgpKeys.publishSigned.value publishMavenStyle := true publishArtifact in Test := false pomIncludeRepository := (_ ⇒ false) @@ -31,8 +33,8 @@ 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! 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/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" From 45d35eeed602a6162139c82ee931df366d593c31 Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Mon, 28 Oct 2019 09:55:30 +0100 Subject: [PATCH 2/4] update scala versions --- .travis.yml | 4 ++-- build.sbt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07fb84b..585a1d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: scala scala: - - 2.12.6 - - 2.11.11 + - 2.12.10 + - 2.11.12 jdk: - openjdk8 diff --git a/build.sbt b/build.sbt index 1c5c39f..580d5ec 100644 --- a/build.sbt +++ b/build.sbt @@ -6,8 +6,8 @@ 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.12.10" +crossScalaVersions := Seq("2.11.12", "2.12.10") scalacOptions ++= Seq("-deprecation", "-feature") From a2358c5f1000bc1d40ae58b4c4cd3eef6ec8f4c9 Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Mon, 28 Oct 2019 09:57:25 +0100 Subject: [PATCH 3/4] add scala 2.13 --- .travis.yml | 1 + build.sbt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 585a1d3..0de1c71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: scala scala: - 2.12.10 - 2.11.12 + - 2.13.0 jdk: - openjdk8 diff --git a/build.sbt b/build.sbt index 580d5ec..7edbbb7 100644 --- a/build.sbt +++ b/build.sbt @@ -6,8 +6,8 @@ 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.10" -crossScalaVersions := Seq("2.11.12", "2.12.10") +scalaVersion := "2.13.0" +crossScalaVersions := Seq("2.11.12", "2.12.10", scalaVersion.value) scalacOptions ++= Seq("-deprecation", "-feature") From b2f8f72176616514712cbfa07cd1e86425b819c8 Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Mon, 28 Oct 2019 10:00:20 +0100 Subject: [PATCH 4/4] =?UTF-8?q?s/=E2=87=92/=3D>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sbt | 6 +++--- .../scala/sangria/streaming/akkaStreams.scala | 18 +++++++++--------- .../streaming/AkkStreamsIntegrationSpec.scala | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build.sbt b/build.sbt index 7edbbb7..28a26ce 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,7 @@ 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" @@ -39,6 +39,6 @@ scmInfo := Some(ScmInfo( // 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/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)