pekko/project/Dependencies.scala

269 lines
11 KiB
Scala
Raw Normal View History

/*
* Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com>
*/
package akka
import sbt._
2015-05-21 21:07:37 +02:00
import Keys._
object Dependencies {
import DependencyHelpers._
2015-05-21 21:07:37 +02:00
lazy val scalaTestVersion = settingKey[String]("The version of ScalaTest to use.")
lazy val scalaCheckVersion = settingKey[String]("The version of ScalaCheck to use.")
2016-04-13 17:33:32 +02:00
lazy val java8CompatVersion = settingKey[String]("The version of scala-java8-compat to use.")
2019-05-24 08:11:50 +02:00
lazy val sslConfigVersion = settingKey[String]("The version of ssl-config to use.")
val junitVersion = "4.12"
val slf4jVersion = "1.7.25"
2017-02-23 14:17:13 +00:00
val scalaXmlVersion = "1.0.6"
2019-02-06 15:48:25 +00:00
val aeronVersion = "1.15.1"
2015-05-21 21:07:37 +02:00
val Versions = Seq(
2019-05-24 08:11:50 +02:00
crossScalaVersions := Seq("2.12.8", "2.13.0-RC2"),
scalaVersion := System.getProperty("akka.build.scalaVersion", crossScalaVersions.value.head),
scalaCheckVersion := sys.props.get("akka.build.scalaCheckVersion").getOrElse("1.14.0"),
2019-05-24 08:11:50 +02:00
scalaTestVersion := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => "3.0.8-RC4"
case _ => "3.0.7"
}
},
2016-04-13 17:33:32 +02:00
java8CompatVersion := {
CrossVersion.partialVersion(scalaVersion.value) match {
2019-05-24 08:11:50 +02:00
// java8-compat is only used in a couple of places for 2.13,
// it is probably possible to remove the dependency if needed.
case Some((2, n)) if n >= 13 => "0.9.0"
case _ => "0.8.0"
2016-04-13 17:33:32 +02:00
}
2019-05-24 08:11:50 +02:00
},
sslConfigVersion := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => "0.4.0"
case _ => "0.3.7"
}})
object Compile {
// Compile
val config = "com.typesafe" % "config" % "1.3.4" // ApacheV2
2017-10-06 10:30:28 +02:00
val netty = "io.netty" % "netty" % "3.10.6.Final" // ApacheV2
2017-10-06 10:30:28 +02:00
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % scalaXmlVersion // Scala License
val scalaReflect = ScalaVersionDependentModuleID.versioned("org.scala-lang" % "scala-reflect" % _) // Scala License
2017-10-06 10:30:28 +02:00
val slf4jApi = "org.slf4j" % "slf4j-api" % slf4jVersion // MIT
// mirrored in OSGi sample https://github.com/akka/akka-samples/tree/master/akka-sample-osgi-dining-hakkers
2017-10-06 10:30:28 +02:00
val osgiCore = "org.osgi" % "org.osgi.core" % "4.3.1" // ApacheV2
val osgiCompendium = "org.osgi" % "org.osgi.compendium" % "4.3.1" // ApacheV2
2017-10-06 10:30:28 +02:00
val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2
val jctools = "org.jctools" % "jctools-core" % "2.1.2" // ApacheV2
// reactive streams
2017-12-19 10:30:00 +01:00
val reactiveStreams = "org.reactivestreams" % "reactive-streams" % "1.0.2" // CC0
// ssl-config
2019-05-24 08:11:50 +02:00
val sslConfigCore = Def.setting { "com.typesafe" %% "ssl-config-core" % sslConfigVersion.value } // ApacheV2
2017-02-23 14:17:13 +00:00
val lmdb = "org.lmdbjava" % "lmdbjava" % "0.6.1" // ApacheV2, OpenLDAP Public License
2017-02-23 14:17:13 +00:00
2017-10-06 10:30:28 +02:00
val junit = "junit" % "junit" % junitVersion // Common Public License 1.0
// For Java 8 Conversions
2017-10-06 10:30:28 +02:00
val java8Compat = Def.setting { "org.scala-lang.modules" %% "scala-java8-compat" % java8CompatVersion.value } // Scala License
2017-02-23 14:17:13 +00:00
2017-10-06 10:30:28 +02:00
val aeronDriver = "io.aeron" % "aeron-driver" % aeronVersion // ApacheV2
val aeronClient = "io.aeron" % "aeron-client" % aeronVersion // ApacheV2
object Docs {
2019-05-24 08:11:50 +02:00
val sprayJson = "io.spray" %% "spray-json" % "1.3.5" % "test"
val gson = "com.google.code.gson" % "gson" % "2.8.5" % "test"
}
object Test {
2017-10-06 10:30:28 +02:00
val commonsMath = "org.apache.commons" % "commons-math" % "2.2" % "test" // ApacheV2
val commonsIo = "commons-io" % "commons-io" % "2.6" % "test" // ApacheV2
val commonsCodec = "commons-codec" % "commons-codec" % "1.11" % "test" // ApacheV2
2017-10-06 10:30:28 +02:00
val junit = "junit" % "junit" % junitVersion % "test" // Common Public License 1.0
val logback = "ch.qos.logback" % "logback-classic" % "1.2.3" % "test" // EPL 1.0 / LGPL 2.1
val mockito = "org.mockito" % "mockito-core" % "2.19.1" % "test" // MIT
// changing the scalatest dependency must be reflected in akka-docs/rst/dev/multi-jvm-testing.rst
2017-10-06 10:30:28 +02:00
val scalatest = Def.setting { "org.scalatest" %% "scalatest" % scalaTestVersion.value % "test" } // ApacheV2
val scalacheck = Def.setting { "org.scalacheck" %% "scalacheck" % scalaCheckVersion.value % "test" } // New BSD
val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.2.1" % "test" // ApacheV2
val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "1.0.0" % "test" // ApacheV2
val log4j = "log4j" % "log4j" % "1.2.17" % "test" // ApacheV2
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % scalaXmlVersion % "test"
=act,tes Initial draft of internal MetricsKit Note: This is NOT aimed to provide an micro-benchmarking solution. The goal is to provide data for broad trend analysis. For techniques that fight the inliner and other specialised techniques, refer to JMH. + custom console and graphite reporters - had to be custom because it's not possible to add custom metric types to the existing reporters + initial hdr.Histogram histogram() provider, see http://latencyutils.github.io/LatencyUtils/ + Not using timers provided by Metrics, instead use the above histogram + Added average Actor size measurement + Measuring the "blocking time" when an actor is created, before we fire of the async part of this process; Measures in loop and will fluctuate a lot. Times are in `us` -- System.nanoTime should provide good enough resolution. + Measuring total actor creation time by using `KnownOpsInTimespanTimer`, which given a known number of ops, in a large amount of time, roughtly estimates time per one operation. // Yes, we are aware of the possibility of GC pauses and other horrors + All classes are `private[akka]`, we should not encourage people to use this yet + Counters use Java 8's `LongAdder`, which is metric's private; The new trend in Java land will be copy paste-ing this class ;) + Metrics are logged to Graphite, so we can long-term analyse these + Reporters are configurable using typesafe-config ! I'm not very happy about how I work around Metrics not being too open for adding additional custom metrics. Seems like a hack at places. I will consider removing the Metrics dependency all together. numbers Example output: ``` -- KnownOpsInTimespanTimer------------------------------------------- actor-creation.total.creating-100000-actors.Props|new-EmptyArgsActor|…||-same ops = 100000 time = 1.969 s ops/s = 50782.22 avg = 19.69 μs -- AveragingGauge--------------------------------------------------- actor-creation.Props|new-EmptyArgsActor|…||-same.avg-mem-per-actor avg = 439.67 ```
2014-04-29 10:50:36 +02:00
// in-memory filesystem for file related tests
2017-10-06 10:30:28 +02:00
val jimfs = "com.google.jimfs" % "jimfs" % "1.1" % "test" // ApacheV2
2018-10-16 15:35:55 +02:00
// docker utils
val dockerClient = "com.spotify" % "docker-client" % "8.13.1" % "test" // ApacheV2
=act,tes Initial draft of internal MetricsKit Note: This is NOT aimed to provide an micro-benchmarking solution. The goal is to provide data for broad trend analysis. For techniques that fight the inliner and other specialised techniques, refer to JMH. + custom console and graphite reporters - had to be custom because it's not possible to add custom metric types to the existing reporters + initial hdr.Histogram histogram() provider, see http://latencyutils.github.io/LatencyUtils/ + Not using timers provided by Metrics, instead use the above histogram + Added average Actor size measurement + Measuring the "blocking time" when an actor is created, before we fire of the async part of this process; Measures in loop and will fluctuate a lot. Times are in `us` -- System.nanoTime should provide good enough resolution. + Measuring total actor creation time by using `KnownOpsInTimespanTimer`, which given a known number of ops, in a large amount of time, roughtly estimates time per one operation. // Yes, we are aware of the possibility of GC pauses and other horrors + All classes are `private[akka]`, we should not encourage people to use this yet + Counters use Java 8's `LongAdder`, which is metric's private; The new trend in Java land will be copy paste-ing this class ;) + Metrics are logged to Graphite, so we can long-term analyse these + Reporters are configurable using typesafe-config ! I'm not very happy about how I work around Metrics not being too open for adding additional custom metrics. Seems like a hack at places. I will consider removing the Metrics dependency all together. numbers Example output: ``` -- KnownOpsInTimespanTimer------------------------------------------- actor-creation.total.creating-100000-actors.Props|new-EmptyArgsActor|…||-same ops = 100000 time = 1.969 s ops/s = 50782.22 avg = 19.69 μs -- AveragingGauge--------------------------------------------------- actor-creation.Props|new-EmptyArgsActor|…||-same.avg-mem-per-actor avg = 439.67 ```
2014-04-29 10:50:36 +02:00
// metrics, measurements, perf testing
val metrics = "io.dropwizard.metrics" % "metrics-core" % "3.2.5" % "test" // ApacheV2
val metricsJvm = "io.dropwizard.metrics" % "metrics-jvm" % "3.2.5" % "test" // ApacheV2
2017-10-06 10:30:28 +02:00
val latencyUtils = "org.latencyutils" % "LatencyUtils" % "1.0.5" % "test" // Free BSD
val hdrHistogram = "org.hdrhistogram" % "HdrHistogram" % "2.1.10" % "test" // CC0
2017-10-06 10:30:28 +02:00
val metricsAll = Seq(metrics, metricsJvm, latencyUtils, hdrHistogram)
// sigar logging
2017-10-06 10:30:28 +02:00
val slf4jJul = "org.slf4j" % "jul-to-slf4j" % slf4jVersion % "test" // MIT
val slf4jLog4j = "org.slf4j" % "log4j-over-slf4j" % slf4jVersion % "test" // MIT
// reactive streams tck
2017-12-19 10:30:00 +01:00
val reactiveStreamsTck = "org.reactivestreams" % "reactive-streams-tck" % "1.0.2" % "test" // CC0
}
object Provided {
// TODO remove from "test" config
// If changed, update akka-docs/build.sbt as well
2017-10-06 10:30:28 +02:00
val sigarLoader = "io.kamon" % "sigar-loader" % "1.6.6-rev002" % "optional;provided;test" // ApacheV2
val activation = "com.sun.activation" % "javax.activation" % "1.2.0" % "provided;test"
val levelDB = "org.iq80.leveldb" % "leveldb" % "0.10" % "optional;provided" // ApacheV2
val levelDBmultiJVM = "org.iq80.leveldb" % "leveldb" % "0.10" % "optional;provided;multi-jvm" // ApacheV2
2017-10-06 10:30:28 +02:00
val levelDBNative = "org.fusesource.leveldbjni" % "leveldbjni-all" % "1.8" % "optional;provided" // New BSD
val junit = Compile.junit % "optional;provided;test"
val scalatest = Def.setting { "org.scalatest" %% "scalatest" % scalaTestVersion.value % "optional;provided;test" } // ApacheV2
}
}
import Compile._
// TODO check if `l ++=` everywhere expensive?
2015-05-21 21:07:37 +02:00
val l = libraryDependencies
Various scala-2.13.0-M5 fixes fix akka-actor-tests compile errors some tests still fail though Fix test failures in akka-actor-test Manually work arround missing implicit Factory[Nothing, Seq[Nothing]] see https://github.com/scala/scala-collection-compat/issues/137 akka-remote scalafix changes Fix shutdownAll compile error test:akka-remote scalafix changes akka-multi-node-testkit scalafix Fix akka-remote-tests multi-jvm compile errors akka-stream-tests/test:scalafix Fix test:akka-stream-tests Crude implementation of ByteString.map scalafix akka-actor-typed, akka-actor-typed-tests akka-actor-typed-tests compile and succeed scalafix akka-camel scalafix akka-cluster akka-cluster compile & test scalafix akka-cluster-metrics Fix akka-cluster-metrics scalafix akka-cluster-tools akka-cluster-tools compile and test scalafix akka-distributed-data akka-distributed-data fixes scalafix akka-persistence scalafix akka-cluster-sharding fix akka-cluster-sharding scalafix akka-contrib Fix akka-cluster-sharding-typed test scalafix akka-docs Use scala-stm 0.9 (released for M5) akka-docs Remove dependency on collections-compat Cherry-pick the relevant constructs to our own private utils Shorten 'scala.collections.immutable' by importing it Duplicate 'immutable' imports Use 'foreach' on futures Replace MapLike with regular Map Internal API markers Simplify ccompat by moving PackageShared into object Since we don't currently need to differentiate between 2.11 and Avoid relying on 'union' (and ++) being left-biased Fix akka-actor/doc by removing -Ywarn-unused Make more things more private Copyright headers Use 'unsorted' to go from SortedSet to Set Duplicate import Use onComplete rather than failed.foreach Clarify why we partly duplicate scala-collection-compat
2018-11-22 16:18:10 +01:00
val actor = l ++= Seq(config, java8Compat.value)
val discovery = l ++= Seq(Test.junit, Test.scalatest.value)
val coordination = l ++= Seq(Test.junit, Test.scalatest.value)
2015-05-21 21:07:37 +02:00
val testkit = l ++= Seq(Test.junit, Test.scalatest.value) ++ Test.metricsAll
2018-10-16 15:35:55 +02:00
val actorTests = l ++= Seq(
Test.junit,
Test.scalatest.value,
Test.commonsCodec,
Test.commonsMath,
Test.mockito,
Test.scalacheck.value,
Test.jimfs,
Test.dockerClient,
Provided.activation // dockerClient needs javax.activation.DataSource in JDK 11+
)
val actorTestkitTyped = l ++= Seq(Provided.junit, Provided.scalatest.value)
val remote = l ++= Seq(netty, aeronDriver, aeronClient, Test.junit, Test.scalatest.value, Test.jimfs)
2015-05-21 21:07:37 +02:00
val remoteTests = l ++= Seq(Test.junit, Test.scalatest.value, Test.scalaXml)
2015-05-21 21:07:37 +02:00
val cluster = l ++= Seq(Test.junit, Test.scalatest.value)
2015-05-21 21:07:37 +02:00
val clusterTools = l ++= Seq(Test.junit, Test.scalatest.value)
val clusterSharding = l ++= Seq(
Provided.levelDBmultiJVM,
Provided.levelDBNative,
Test.junit,
Test.scalatest.value,
Test.commonsIo)
2015-05-21 21:07:37 +02:00
val clusterMetrics = l ++= Seq(Provided.sigarLoader, Test.slf4jJul, Test.slf4jLog4j, Test.logback, Test.mockito)
val distributedData = l ++= Seq(lmdb, Test.junit, Test.scalatest.value)
2015-05-21 21:07:37 +02:00
val slf4j = l ++= Seq(slf4jApi, Test.logback)
val persistence = l ++= Seq(
Provided.levelDB,
Provided.levelDBNative,
Test.scalatest.value,
Test.junit,
Test.commonsIo,
Test.commonsCodec,
Test.scalaXml)
val persistenceQuery = l ++= Seq(
Test.scalatest.value,
Test.junit,
Test.commonsIo,
Provided.levelDB,
Provided.levelDBNative)
val persistenceTck = l ++= Seq(
Test.scalatest.value.withConfigurations(Some("compile")),
Test.junit.withConfigurations(Some("compile")),
Provided.levelDB,
Provided.levelDBNative)
val persistenceShared = l ++= Seq(Provided.levelDB, Provided.levelDBNative)
val osgi = l ++= Seq(
osgiCore,
osgiCompendium,
Test.logback,
Test.commonsIo,
Test.pojosr,
Test.tinybundles,
Test.scalatest.value,
Test.junit)
val docs = l ++= Seq(Test.scalatest.value, Test.junit, Docs.sprayJson, Docs.gson, Provided.levelDB)
val benchJmh = l ++= Seq(Provided.levelDB, Provided.levelDBNative, Compile.jctools)
// akka stream
2019-05-24 08:11:50 +02:00
lazy val stream = l ++= Seq[sbt.ModuleID](reactiveStreams, sslConfigCore.value, Test.scalatest.value)
lazy val streamTestkit = l ++= Seq(Test.scalatest.value, Test.scalacheck.value, Test.junit)
lazy val streamTests = l ++= Seq(Test.scalatest.value, Test.scalacheck.value, Test.junit, Test.commonsIo, Test.jimfs)
lazy val streamTestsTck = l ++= Seq(Test.scalatest.value, Test.scalacheck.value, Test.junit, Test.reactiveStreamsTck)
}
object DependencyHelpers {
case class ScalaVersionDependentModuleID(modules: String => Seq[ModuleID]) {
def %(config: String): ScalaVersionDependentModuleID =
ScalaVersionDependentModuleID(version => modules(version).map(_ % config))
}
object ScalaVersionDependentModuleID {
implicit def liftConstantModule(mod: ModuleID): ScalaVersionDependentModuleID = versioned(_ => mod)
def versioned(f: String => ModuleID): ScalaVersionDependentModuleID = ScalaVersionDependentModuleID(v => Seq(f(v)))
def fromPF(f: PartialFunction[String, ModuleID]): ScalaVersionDependentModuleID =
ScalaVersionDependentModuleID(version => if (f.isDefinedAt(version)) Seq(f(version)) else Nil)
}
/**
* Use this as a dependency setting if the dependencies contain both static and Scala-version
* dependent entries.
*/
def versionDependentDeps(modules: ScalaVersionDependentModuleID*): Def.Setting[Seq[ModuleID]] =
libraryDependencies ++= modules.flatMap(m => m.modules(scalaVersion.value))
val ScalaVersion = """\d\.\d+\.\d+(?:-(?:M|RC)\d+)?""".r
val nominalScalaVersion: String => String = {
// matches:
// 2.12.0-M1
// 2.12.0-RC1
// 2.12.0
case version @ ScalaVersion() => version
// transforms 2.12.0-custom-version to 2.12.0
case version => version.takeWhile(_ != '-')
}
}