Skip to content

Commit

Permalink
Upgrade plugins and common dependencies (#2000)
Browse files Browse the repository at this point in the history
* Plugin upgrades
* Update common dependencies and test dependencies
* Reformatted Java code
* Tests run on JDK 11
* Jackson: depend directly on jackson-core
  • Loading branch information
ennru authored Nov 8, 2019
1 parent 12824f4 commit 33e1b6d
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 89 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
if: type != cron
- env: CMD="++2.12.10 Test/compile"
name: "Compile all code with Scala 2.12 and fatal warnings enabled. Run locally with: env CI=true sbt ++2.12.10 Test/compile"
- env: CMD="++2.13.0 Test/compile"
- env: CMD="++2.13.1 Test/compile"
name: "Compile all code with Scala 2.13"
- env: CMD="unidoc"
name: "Create all API docs"
Expand Down Expand Up @@ -146,8 +146,8 @@ jobs:
name: "Publish artifacts for Scala 2.11.12"
- env: CMD="++2.12.10 publish"
name: "Publish artifacts for Scala 2.12.10"
- env: CMD="++2.13.0 publish"
name: "Publish artifacts for Scala 2.13.0"
- env: CMD="++2.13.1 publish"
name: "Publish artifacts for Scala 2.13.1"
- 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
61 changes: 27 additions & 34 deletions file/src/test/java/docs/javadsl/FileTailSourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,35 +128,30 @@ public void willCompleteStreamIfFileIsDeleted() throws Exception {

final Duration checkInterval = Duration.ofSeconds(1);
final Source<String, NotUsed> fileCheckSource =
akka.stream.alpakka.file.javadsl.DirectoryChangesSource.create(
path.getParent(),
checkInterval,
8192
)
.mapConcat(pair -> {
if (pair.first().equals(path) && pair.second() == DirectoryChange.Deletion) {
throw new FileNotFoundException();
}
return Collections.<String>emptyList();
})
.recoverWith(new PFBuilder<Throwable, Source<String, NotUsed>>()
akka.stream.alpakka.file.javadsl.DirectoryChangesSource.create(
path.getParent(), checkInterval, 8192)
.mapConcat(
pair -> {
if (pair.first().equals(path) && pair.second() == DirectoryChange.Deletion) {
throw new FileNotFoundException();
}
return Collections.<String>emptyList();
})
.recoverWith(
new PFBuilder<Throwable, Source<String, NotUsed>>()
.match(FileNotFoundException.class, t -> Source.empty())
.build()
);
.build());

final Source<String, NotUsed> source =
akka.stream.alpakka.file.javadsl.FileTailSource
.createLines(
path,
8192, // chunk size
Duration.ofMillis(250))
.merge(fileCheckSource, true);
akka.stream.alpakka.file.javadsl.FileTailSource.createLines(
path,
8192, // chunk size
Duration.ofMillis(250))
.merge(fileCheckSource, true);

// #shutdown-on-delete

source
.to(Sink.fromSubscriber(subscriber))
.run(materializer);
source.to(Sink.fromSubscriber(subscriber)).run(materializer);

String result1 = subscriber.requestNext();
assertEquals("a", result1);
Expand All @@ -176,22 +171,20 @@ public void willCompleteStreamIfFileIsIdle() throws Exception {

// #shutdown-on-idle-timeout

Source<String, NotUsed> stream = akka.stream.alpakka.file.javadsl.FileTailSource
.createLines(
path,
8192, // chunk size
Duration.ofMillis(250))
Source<String, NotUsed> stream =
akka.stream.alpakka.file.javadsl.FileTailSource.createLines(
path,
8192, // chunk size
Duration.ofMillis(250))
.idleTimeout(Duration.ofSeconds(5))
.recoverWith(new PFBuilder<Throwable, Source<String, NotUsed>>()
.recoverWith(
new PFBuilder<Throwable, Source<String, NotUsed>>()
.match(TimeoutException.class, t -> Source.empty())
.build()
);
.build());

// #shutdown-on-idle-timeout

stream
.to(Sink.fromSubscriber(subscriber))
.run(materializer);
stream.to(Sink.fromSubscriber(subscriber)).run(materializer);

String result1 = subscriber.requestNext();
assertEquals("a", result1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (C) 2016-2019 Lightbend Inc. <http://www.lightbend.com>
*/

package docs.scaladsl

import java.io.FileNotFoundException
Expand Down
79 changes: 35 additions & 44 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object Dependencies {

val Scala211 = "2.11.12"
val Scala212 = "2.12.10"
val Scala213 = "2.13.0"
val Scala213 = "2.13.1"
val ScalaVersions = Seq(Scala212, Scala211, Scala213).filterNot(_ == Scala211 && Nightly)

val AkkaVersion = if (Nightly) "2.6.0-RC1" else "2.5.26"
Expand All @@ -20,25 +20,21 @@ object Dependencies {
val AwsSpiAkkaHttpVersion = "0.0.7"
val AkkaHttpVersion = "10.1.10"
val AkkaHttpBinaryVersion = "10.1"
val mockitoVersion = "3.0.0"
val mockitoVersion = "3.1.0"

val CouchbaseVersion = "2.7.2"
val CouchbaseVersionForDocs = "2.7"

val JwtCoreVersion = "3.0.1"

// Releases https://github.com/FasterXML/jackson-databind/releases
// CVE issues https://github.com/FasterXML/jackson-databind/issues?utf8=%E2%9C%93&q=+label%3ACVE
val JacksonDatabindVersion = "2.9.9.3"

val log4jOverSlf4jVersion = "1.7.27"
val jclOverSlf4jVersion = "1.7.27"
val log4jOverSlf4jVersion = "1.7.29"
val jclOverSlf4jVersion = "1.7.29"

// Allows to silence scalac compilation warnings selectively by code block or file path
// This is only compile time dependency, therefore it does not affect the generated bytecode
// https://github.com/ghik/silencer
val Silencer = {
val Version = "1.4.3"
val Version = "1.4.4"
Seq(
compilerPlugin("com.github.ghik" % "silencer-plugin" % Version cross CrossVersion.full),
"com.github.ghik" % "silencer-lib" % Version % Provided cross CrossVersion.full
Expand All @@ -58,6 +54,16 @@ object Dependencies {
)
)

// Releases https://github.com/FasterXML/jackson-databind/releases
// CVE issues https://github.com/FasterXML/jackson-databind/issues?utf8=%E2%9C%93&q=+label%3ACVE
// This should align with the version used in Akka 2.6.x
// https://github.com/akka/akka/blob/master/project/Dependencies.scala#L24
val JacksonDatabindVersion = "2.10.0"
val JacksonDatabindDependencies = Seq(
"com.fasterxml.jackson.core" % "jackson-core" % JacksonDatabindVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion
)

val Amqp = Seq(
libraryDependencies ++= Seq(
"com.rabbitmq" % "amqp-client" % "5.3.0" // APLv2
Expand All @@ -67,10 +73,8 @@ object Dependencies {
val AwsLambda = Seq(
libraryDependencies ++= Seq(
"software.amazon.awssdk" % "lambda" % AwsSdk2Version, // ApacheV2
// overriding AWS SDK version to avoid security issues
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion,
"org.mockito" % "mockito-core" % mockitoVersion % Test // MIT
)
) ++ JacksonDatabindDependencies
)

val AzureStorageQueue = Seq(
Expand Down Expand Up @@ -109,13 +113,13 @@ object Dependencies {
// https://github.com/akka/alpakka-kafka/releases
"com.typesafe.akka" %% "akka-stream-kafka" % "1.0.5",
"io.netty" % "netty-all" % "4.1.29.Final", // ApacheV2
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % "2.9.9",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.9",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % JacksonDatabindVersion,
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % JacksonDatabindVersion,
"org.apache.logging.log4j" % "log4j-to-slf4j" % "2.11.2", // ApacheV2
"org.slf4j" % "log4j-over-slf4j" % log4jOverSlf4jVersion,
"org.slf4j" % "jcl-over-slf4j" % jclOverSlf4jVersion,
"ch.qos.logback" % "logback-classic" % "1.2.3" // Eclipse Public License 1.0
)
) ++ JacksonDatabindDependencies
)

val DynamoDB = Seq(
Expand All @@ -129,20 +133,17 @@ object Dependencies {
ExclusionRule("software.amazon.awssdk", "apache-client"),
ExclusionRule("software.amazon.awssdk", "netty-nio-client")
),
// overriding AWS SDK version to avoid security issues
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion,
"com.typesafe.akka" %% "akka-http" % AkkaHttpVersion // ApacheV2
)
) ++ JacksonDatabindDependencies
)

val Elasticsearch = Seq(
libraryDependencies ++= Seq(
"org.elasticsearch.client" % "elasticsearch-rest-client" % "6.3.1", // ApacheV2
"io.spray" %% "spray-json" % "1.3.5", // ApacheV2
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion, // ApacheV2
"org.codelibs" % "elasticsearch-cluster-runner" % "6.3.2.1" % Test, // ApacheV2
"org.slf4j" % "jcl-over-slf4j" % jclOverSlf4jVersion % Test
)
) ++ JacksonDatabindDependencies
)

val File = Seq(
Expand All @@ -154,9 +155,9 @@ object Dependencies {
val AvroParquet = Seq(
libraryDependencies ++= Seq(
"org.apache.parquet" % "parquet-avro" % "1.10.0", //Apache2
"org.apache.hadoop" % "hadoop-client" % "3.2.0" % Test exclude ("log4j", "log4j"), //Apache2
"org.apache.hadoop" % "hadoop-common" % "3.2.0" % Test exclude ("log4j", "log4j"), //Apache2
"org.specs2" %% "specs2-core" % "4.5.1" % Test, //MIT like: https://github.com/etorreborre/specs2/blob/master/LICENSE.txt
"org.apache.hadoop" % "hadoop-client" % "3.2.1" % Test exclude ("log4j", "log4j"), //Apache2
"org.apache.hadoop" % "hadoop-common" % "3.2.1" % Test exclude ("log4j", "log4j"), //Apache2
"org.specs2" %% "specs2-core" % "4.8.0" % Test, //MIT like: https://github.com/etorreborre/specs2/blob/master/LICENSE.txt
"org.slf4j" % "log4j-over-slf4j" % log4jOverSlf4jVersion % Test // MIT like: http://www.slf4j.org/license.html
)
)
Expand All @@ -177,10 +178,8 @@ object Dependencies {
.map("org.apache.geode" % _ % GeodeVersion) ++
Seq(
"com.chuusai" %% "shapeless" % "2.3.3",
// overriding version from geode to avoid some security vulnerabilities
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion,
"org.apache.logging.log4j" % "log4j-to-slf4j" % "2.12.1" % Test
)
) ++ JacksonDatabindDependencies
)

val GooglePubSub = Seq(
Expand All @@ -189,7 +188,7 @@ object Dependencies {
"com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion,
"com.pauldijou" %% "jwt-core" % JwtCoreVersion, // ApacheV2
"org.mockito" % "mockito-core" % mockitoVersion % Test, // MIT
"com.github.tomakehurst" % "wiremock" % "2.24.0" % Test // ApacheV2
"com.github.tomakehurst" % "wiremock" % "2.25.1" % Test // ApacheV2
)
)

Expand Down Expand Up @@ -220,7 +219,7 @@ object Dependencies {
"com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion,
"com.pauldijou" %% "jwt-core" % JwtCoreVersion, //ApacheV2
"org.mockito" % "mockito-core" % mockitoVersion % Test, // MIT
"com.github.tomakehurst" % "wiremock" % "2.18.0" % Test // ApacheV2
"com.github.tomakehurst" % "wiremock" % "2.25.1" % Test // ApacheV2
)
)

Expand All @@ -233,7 +232,7 @@ object Dependencies {
"org.apache.hbase" % "hbase-common" % hbaseVersion exclude ("log4j", "log4j") exclude ("org.slf4j", "slf4j-log4j12"), // ApacheV2,
"org.apache.hadoop" % "hadoop-common" % hadoopVersion exclude ("log4j", "log4j") exclude ("org.slf4j", "slf4j-log4j12"), // ApacheV2,
"org.apache.hadoop" % "hadoop-mapreduce-client-core" % hadoopVersion exclude ("log4j", "log4j") exclude ("org.slf4j", "slf4j-log4j12"), // ApacheV2,
"org.slf4j" % "log4j-over-slf4j" % "1.7.25" % Test // MIT like: http://www.slf4j.org/license.html
"org.slf4j" % "log4j-over-slf4j" % log4jOverSlf4jVersion % Test // MIT like: http://www.slf4j.org/license.html
)
)
}
Expand Down Expand Up @@ -269,7 +268,7 @@ object Dependencies {
"com.ibm.mq" % "com.ibm.mq.allclient" % "9.1.3.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.9" % Test, // ApacheV2
"org.apache.activemq" % "activemq-client" % "5.15.9" % Test, // ApacheV2
"io.github.sullis" %% "jms-testkit" % "0.2.7" % Test, // ApacheV2
"io.github.sullis" %% "jms-testkit" % "0.2.8" % 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 All @@ -279,10 +278,8 @@ object Dependencies {
val JsonStreaming = Seq(
libraryDependencies ++= Seq(
"com.github.jsurfer" % "jsurfer" % "1.4.3", // MIT,
"com.github.jsurfer" % "jsurfer-jackson" % "1.4.3", // MIT
// overriding version from jsurfer-jackson to avoid some security vulnerabilities
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion
)
"com.github.jsurfer" % "jsurfer-jackson" % "1.4.3" // MIT
) ++ JacksonDatabindDependencies
)

val Kinesis = Seq(
Expand Down Expand Up @@ -339,12 +336,10 @@ object Dependencies {
"com.typesafe.akka" %% "akka-http" % AkkaHttpVersion,
"com.typesafe.akka" %% "akka-http-xml" % AkkaHttpVersion,
"software.amazon.awssdk" % "auth" % AwsSdk2Version,
// overriding AWS SDK version to avoid security issues
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion,
// in-memory filesystem for file related tests
"com.google.jimfs" % "jimfs" % "1.1" % Test, // ApacheV2
"com.github.tomakehurst" % "wiremock" % "2.25.1" % Test // ApacheV2
)
) ++ JacksonDatabindDependencies
)

val SpringWeb = {
Expand All @@ -367,7 +362,7 @@ object Dependencies {
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick" % SlickVersion, // BSD 2-clause "Simplified" License
"com.typesafe.slick" %% "slick-hikaricp" % SlickVersion, // BSD 2-clause "Simplified" License
"com.h2database" % "h2" % "1.4.197" % Test // Eclipse Public License 1.0
"com.h2database" % "h2" % "1.4.200" % Test // Eclipse Public License 1.0
)
)

Expand All @@ -382,11 +377,9 @@ object Dependencies {
ExclusionRule("software.amazon.awssdk", "apache-client"),
ExclusionRule("software.amazon.awssdk", "netty-nio-client")
),
// overriding AWS SDK version to avoid security issues
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion,
"com.typesafe.akka" %% "akka-http" % AkkaHttpVersion, // ApacheV2
"org.mockito" % "mockito-core" % mockitoVersion % Test // MIT
)
) ++ JacksonDatabindDependencies
)

val SolrjVersion = "7.7.2"
Expand All @@ -412,12 +405,10 @@ object Dependencies {
ExclusionRule("software.amazon.awssdk", "apache-client"),
ExclusionRule("software.amazon.awssdk", "netty-nio-client")
),
// overriding AWS SDK version to avoid security issues
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonDatabindVersion,
"com.typesafe.akka" %% "akka-http" % AkkaHttpVersion, // ApacheV2
"org.mockito" % "mockito-core" % mockitoVersion % Test, // MIT
"org.mockito" % "mockito-inline" % mockitoVersion % Test // MIT
)
) ++ JacksonDatabindDependencies
)

val Sse = Seq(
Expand Down
14 changes: 7 additions & 7 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.2.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.4")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-dependencies" % "0.1")
addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.25")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-dependencies" % "0.2")
addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.26")
addSbtPlugin("com.lightbend.sbt" % "sbt-publish-rsync" % "0.1")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "2.1.0")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.5")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.18")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")
addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.4.4")
addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "0.7.1")
addSbtPlugin("com.lightbend.sbt" % "sbt-javaagent" % "0.1.4")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4")
addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "0.7.2")
addSbtPlugin("com.lightbend.sbt" % "sbt-javaagent" % "0.1.5")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.7")
// depend directly on the patched version see https://github.com/akka/alpakka/issues/1388
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2+10-148ba0ff")
// patched version of sbt-dependency-graph and sbt-site
Expand Down
2 changes: 1 addition & 1 deletion project/project-info.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project-info {
labels: "https://github.com/akka/alpakka/labels/p%3A"
scaladoc: "https://doc.akka.io/api/alpakka/"${project-info.version}"/akka/stream/alpakka/"
shared-info {
jdk-versions: ["OpenJDK 8"]
jdk-versions: ["Adopt OpenJDK 8", "Adopt OpenJDK 11"]
snapshots: {
url: "other-docs/snapshots.html"
text: "Snapshots are available"
Expand Down

0 comments on commit 33e1b6d

Please sign in to comment.