Skip to content

Commit

Permalink
Versions for Scala 2.13.0 (#1755)
Browse files Browse the repository at this point in the history
* Versions for Scala 2.13.0
* SSE: Akka HTTP change, make actor system available to reach settings #1183
  • Loading branch information
ennru authored Jun 20, 2019
1 parent 0771809 commit f6ab5ba
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 30 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: "Build code style check (fixed with `sbt scalafmtSbt`)"
- env: CMD="++2.11.12 Test/compile"
name: "Compile all tests (with Scala 2.11)"
- env: CMD="++2.13.0-M5 Test/compile"
- env: CMD="++2.13.0 Test/compile"
name: "Compile all tests (with Scala 2.13)"
- env: CMD="unidoc"
name: "Create all API docs"
Expand Down Expand Up @@ -136,8 +136,8 @@ jobs:
name: "Publish artifacts for Scala 2.11.12"
- env: CMD="++2.12.7 publish"
name: "Publish artifacts for Scala 2.12.7"
- env: CMD="++2.13.0-M5 publish"
name: "Publish artifacts for Scala 2.13.0-M5"
- env: CMD="++2.13.0 publish"
name: "Publish artifacts for Scala 2.13.0"
- script: openssl aes-256-cbc -K $encrypted_bbf1dc4f2a07_key -iv $encrypted_bbf1dc4f2a07_iv -in .travis/travis_alpakka_rsa.enc -out .travis/id_rsa -d && eval "$(ssh-agent -s)" && chmod 600 .travis/id_rsa && ssh-add .travis/id_rsa && sbt -jvm-opts .jvmopts-travis docs/publishRsync
name: "Publish API and reference documentation"

Expand Down
37 changes: 25 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ lazy val ftp = alpakkaProject(
fork in Test := true,
// To avoid potential blocking in machines with low entropy (default is `/dev/random`)
javaOptions in Test += "-Djava.security.egd=file:/dev/./urandom",
crossScalaVersions -= Dependencies.Scala213
crossScalaVersions -= Dependencies.Scala213 // https://github.com/akka/alpakka/issues/1532
)

lazy val geode =
Expand All @@ -155,7 +155,8 @@ lazy val googleCloudPubSub = alpakkaProject(
fork in Test := true,
envVars in Test := Map("PUBSUB_EMULATOR_HOST" -> "localhost:8538"),
// For mockito https://github.com/akka/alpakka/issues/390
parallelExecution in Test := false
parallelExecution in Test := false,
crossScalaVersions -= Dependencies.Scala213 // requires upgrade of jwt-core to 3.0.1
)

lazy val googleCloudPubSubGrpc = alpakkaProject(
Expand All @@ -169,25 +170,33 @@ lazy val googleCloudPubSubGrpc = alpakkaProject(
// for the ExampleApp in the tests
connectInput in run := true,
Compile / compile / scalacOptions += "-P:silencer:pathFilters=src_managed",
crossScalaVersions --= Seq(Dependencies.Scala211, Dependencies.Scala213)
crossScalaVersions --= Seq(Dependencies.Scala211, Dependencies.Scala213) // https://github.com/akka/akka-grpc/pull/599
).enablePlugins(AkkaGrpcPlugin, JavaAgent)

lazy val googleFcm = alpakkaProject(
"google-fcm",
"google.firebase.fcm",
Dependencies.GoogleFcm,
fork in Test := true
fork in Test := true,
crossScalaVersions -= Dependencies.Scala213 // requires upgrade of jwt-core to 3.0.1
)

lazy val hbase = alpakkaProject("hbase", "hbase", Dependencies.HBase, fork in Test := true)

lazy val hdfs = alpakkaProject("hdfs", "hdfs", Dependencies.Hdfs, parallelExecution in Test := false)
lazy val hdfs = alpakkaProject("hdfs",
"hdfs",
Dependencies.Hdfs,
parallelExecution in Test := false,
crossScalaVersions -= Dependencies.Scala213 // Requires upgrade of cats-core
)

lazy val ironmq = alpakkaProject("ironmq",
"ironmq",
Dependencies.IronMq,
fork in Test := true,
crossScalaVersions -= Dependencies.Scala213)
lazy val ironmq = alpakkaProject(
"ironmq",
"ironmq",
Dependencies.IronMq,
fork in Test := true,
crossScalaVersions -= Dependencies.Scala213 // https://github.com/hseeberger/akka-http-json/issues/253
)

lazy val jms = alpakkaProject("jms", "jms", Dependencies.Jms, parallelExecution in Test := false)

Expand All @@ -202,7 +211,11 @@ lazy val kinesis = alpakkaProject("kinesis",
lazy val kudu = alpakkaProject("kudu", "kudu", Dependencies.Kudu, fork in Test := false)

lazy val mongodb =
alpakkaProject("mongodb", "mongodb", Dependencies.MongoDb, crossScalaVersions -= Dependencies.Scala213)
alpakkaProject("mongodb",
"mongodb",
Dependencies.MongoDb,
crossScalaVersions -= Dependencies.Scala213 // https://jira.mongodb.org/browse/SCALA-506
)

lazy val mqtt = alpakkaProject("mqtt", "mqtt", Dependencies.Mqtt)

Expand Down Expand Up @@ -233,7 +246,7 @@ lazy val springWeb = alpakkaProject("spring-web", "spring.web", Dependencies.Spr

lazy val simpleCodecs = alpakkaProject("simple-codecs", "simplecodecs")

lazy val slick = alpakkaProject("slick", "slick", Dependencies.Slick, crossScalaVersions -= Dependencies.Scala213)
lazy val slick = alpakkaProject("slick", "slick", Dependencies.Slick)

lazy val sns = alpakkaProject(
"sns",
Expand Down
8 changes: 5 additions & 3 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ object Common extends AutoPlugin {
"-feature",
"-unchecked",
"-deprecation",
//"-Xfatal-warnings",
"-Xlint",
"-Ywarn-dead-code",
"-Xfuture",
"-target:jvm-1.8"
),
scalacOptions ++= (scalaVersion.value match {
case Dependencies.Scala213 => Seq.empty[String]
case _ => Seq("-Yno-adapted-args")
case _ =>
Seq(
"-Xfuture",
"-Yno-adapted-args"
)
}),
Compile / doc / scalacOptions := scalacOptions.value ++ Seq(
"-doc-title",
Expand Down
20 changes: 10 additions & 10 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ object Dependencies {

val Scala211 = "2.11.12"
val Scala212 = "2.12.7"
val Scala213 = "2.13.0-M5"
val Scala213 = "2.13.0"
val ScalaVersions = Seq(Scala212, Scala211, Scala213)

val AkkaVersion = sys.env.get("AKKA_SERIES") match {
case Some("2.4") => sys.error("Akka 2.4 is not supported anymore")
case _ => "2.5.22"
case _ => "2.5.23"
}

val AwsSdkVersion = "1.11.476"
val AwsSdk2Version = "2.5.65"
val AwsSpiAkkaHttpVersion = "0.0.6"
val AkkaHttpVersion = "10.1.7"
val AwsSpiAkkaHttpVersion = "0.0.7"
val AkkaHttpVersion = "10.1.8"
val mockitoVersion = "2.28.2"

val CouchbaseVersion = "2.7.2"
Expand All @@ -26,7 +26,7 @@ object Dependencies {
// This is only compile time dependency, therefore it does not affect the generated bytecode
// https://github.com/ghik/silencer
val Silencer = {
val Version = "1.3.1"
val Version = "1.4.1"
Seq(
compilerPlugin("com.github.ghik" %% "silencer-plugin" % Version),
"com.github.ghik" %% "silencer-lib" % Version % Provided
Expand All @@ -40,7 +40,7 @@ object Dependencies {
"com.typesafe.akka" %% "akka-stream-testkit" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-slf4j" % AkkaVersion % Test,
"ch.qos.logback" % "logback-classic" % "1.2.3" % Test, // Eclipse Public License 1.0
"org.scalatest" %% "scalatest" % "3.0.7" % Test, // ApacheV2
"org.scalatest" %% "scalatest" % "3.0.8" % Test, // ApacheV2
"com.novocode" % "junit-interface" % "0.11" % Test, // BSD-style
"junit" % "junit" % "4.12" % Test // Eclipse Public License 1.0
)
Expand Down Expand Up @@ -77,7 +77,7 @@ object Dependencies {
libraryDependencies ++= Seq(
"com.couchbase.client" % "java-client" % CouchbaseVersion, // ApacheV2
"io.reactivex" % "rxjava-reactive-streams" % "1.2.1", //ApacheV2
"com.typesafe.play" %% "play-json" % "2.7.1" % Test, // MIT like: http://www.slf4j.org/license.html
"com.typesafe.play" %% "play-json" % "2.7.4" % Test, // MIT like: http://www.slf4j.org/license.html
"com.typesafe.akka" %% "akka-http" % AkkaHttpVersion % Test // Apache V2
)
)
Expand Down Expand Up @@ -144,7 +144,7 @@ object Dependencies {
"org.apache.parquet" % "parquet-avro" % "1.10.0", //Apache2
"org.apache.hadoop" % "hadoop-client" % "3.1.0" % Test exclude ("log4j", "log4j"), //Apache2
"org.apache.hadoop" % "hadoop-common" % "2.2.0" % Test exclude ("log4j", "log4j"), //Apache2
"org.specs2" %% "specs2-core" % "4.4.1" % Test, //MIT like: https://github.com/etorreborre/specs2/blob/master/LICENSE.txt
"org.specs2" %% "specs2-core" % "4.5.1" % Test, //MIT like: https://github.com/etorreborre/specs2/blob/master/LICENSE.txt
"org.slf4j" % "log4j-over-slf4j" % "1.7.25" % Test // MIT like: http://www.slf4j.org/license.html
)
)
Expand Down Expand Up @@ -243,7 +243,7 @@ object Dependencies {
"com.ibm.mq" % "com.ibm.mq.allclient" % "9.1.1.0" % Test, // IBM International Program License Agreement https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/maven/licenses/L-APIG-AZYF2E/LI_en.html
"org.apache.activemq" % "activemq-broker" % "5.15.4" % Test, // ApacheV2
"org.apache.activemq" % "activemq-client" % "5.15.4" % Test, // ApacheV2
"io.github.sullis" %% "jms-testkit" % "0.2.1" % Test, // ApacheV2
"io.github.sullis" %% "jms-testkit" % "0.2.6" % Test, // ApacheV2
"org.mockito" % "mockito-core" % mockitoVersion % Test // MIT
),
// Having JBoss as a first resolver is a workaround for https://github.com/coursier/coursier/issues/200
Expand Down Expand Up @@ -332,7 +332,7 @@ object Dependencies {
)
}

val SlickVersion = "3.3.0"
val SlickVersion = "3.3.2"
val Slick = Seq(
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick" % SlickVersion, // BSD 2-clause "Simplified" License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ package akka.stream.alpakka.sse
package scaladsl

import akka.NotUsed
import akka.actor.ActorSystem
import akka.http.scaladsl.client.RequestBuilding.Get
import akka.http.scaladsl.model.headers.Accept
import akka.http.scaladsl.model.{HttpRequest, HttpResponse, Uri}
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.stream.scaladsl.{Broadcast, Flow, GraphDSL, Merge, Source}
import akka.stream.{Materializer, SourceShape}
import akka.stream.{ActorMaterializer, Materializer, SourceShape}
import akka.http.scaladsl.model.sse.ServerSentEvent
import akka.http.scaladsl.model.sse.ServerSentEvent.heartbeat
import akka.http.scaladsl.model.MediaTypes.`text/event-stream`
import akka.http.scaladsl.model.headers.`Last-Event-ID`
import akka.http.scaladsl.unmarshalling.sse.EventStreamUnmarshalling

import scala.concurrent.Future
import scala.concurrent.duration.{Duration, FiniteDuration}

Expand Down Expand Up @@ -85,8 +87,9 @@ object EventSource {
retryDelay: FiniteDuration = Duration.Zero)(
implicit mat: Materializer
): EventSource = {
import EventStreamUnmarshalling._
import EventStreamUnmarshalling.fromEventsStream
import mat.executionContext
implicit val system: ActorSystem = actorMaterializer(mat).system

val continuousEvents = {
def getEventSource(lastEventId: Option[String]) = {
Expand Down Expand Up @@ -125,4 +128,10 @@ object EventSource {
SourceShape(events.out)
})
}

private def actorMaterializer(mat: Materializer): ActorMaterializer = mat match {
case am: ActorMaterializer => am
case _ => throw new Error("ActorMaterializer required")
}

}

0 comments on commit f6ab5ba

Please sign in to comment.