-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDependencies.scala
250 lines (183 loc) · 12 KB
/
Dependencies.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/**
* Copyright (C) 2016 Lightbend Inc. <http://www.lightbend.com>
*/
package akka
import sbt._
import Keys._
object Dependencies {
import DependencyHelpers._
lazy val scalaTestVersion = settingKey[String]("The version of ScalaTest to use.")
lazy val scalaStmVersion = settingKey[String]("The version of ScalaSTM to use.")
lazy val scalaCheckVersion = settingKey[String]("The version of ScalaCheck to use.")
lazy val java8CompatVersion = settingKey[String]("The version of scala-java8-compat to use.")
val junitVersion = "4.12"
val Versions = Seq(
crossScalaVersions := Seq("2.11.7"), // "2.12.0-M4"
scalaVersion := crossScalaVersions.value.head,
scalaStmVersion := sys.props.get("akka.build.scalaStmVersion").getOrElse("0.7"),
scalaCheckVersion := sys.props.get("akka.build.scalaCheckVersion").getOrElse("1.11.6"),
scalaTestVersion := {
scalaVersion.value match {
case "2.12.0-M1" => "2.2.5-M1"
case "2.12.0-M2" => "2.2.5-M2"
case "2.12.0-M3" => "2.2.5-M3"
case "2.12.0-M4" => "2.2.6"
case _ => "2.2.4"
}
},
java8CompatVersion := {
scalaVersion.value match {
case "2.12.0-M4" => "0.8.0-RC1"
case _ => "0.7.0"
}
}
)
object Compile {
// Compile
val camelCore = "org.apache.camel" % "camel-core" % "2.13.4" exclude("org.slf4j", "slf4j-api") // ApacheV2
// when updating config version, update links ActorSystem ScalaDoc to link to the updated version
val config = "com.typesafe" % "config" % "1.3.0" // ApacheV2
val netty = "io.netty" % "netty" % "3.10.3.Final" // ApacheV2
val scalaStm = Def.setting { "org.scala-stm" %% "scala-stm" % scalaStmVersion.value } // Modified BSD (Scala)
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.5" // Scala License
val scalaReflect = ScalaVersionDependentModuleID.versioned("org.scala-lang" % "scala-reflect" % _) // Scala License
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.16" // MIT
// mirrored in OSGi sample
val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" exclude("jfree", "jcommon") exclude("jfree", "jfreechart") // ApacheV2
val osgiCore = "org.osgi" % "org.osgi.core" % "4.3.1" // ApacheV2
val osgiCompendium= "org.osgi" % "org.osgi.compendium" % "4.3.1" // ApacheV2
// TODO remove with metrics from akka-cluster
val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2
// reactive streams
val reactiveStreams = "org.reactivestreams" % "reactive-streams" % "1.0.0" // CC0
// ssl-config
val sslConfigAkka = "com.typesafe" %% "ssl-config-akka" % "0.2.1" // ApacheV2
// For akka-http spray-json support
val sprayJson = "io.spray" %% "spray-json" % "1.3.2" // ApacheV2
// For akka-http-jackson support
val jackson = "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.2" // ApacheV2
// For akka-http-testkit-java
val junit = "junit" % "junit" % junitVersion // Common Public License 1.0
// For Java 8 Conversions
val java8Compat = Def.setting {"org.scala-lang.modules" %% "scala-java8-compat" % java8CompatVersion.value} // Scala License
object Docs {
val sprayJson = "io.spray" %% "spray-json" % "1.3.2" % "test"
val gson = "com.google.code.gson" % "gson" % "2.3.1" % "test"
}
object Test {
val commonsMath = "org.apache.commons" % "commons-math" % "2.2" % "test" // ApacheV2
val commonsIo = "commons-io" % "commons-io" % "2.4" % "test" // ApacheV2
val commonsCodec = "commons-codec" % "commons-codec" % "1.10" % "test" // ApacheV2
val junit = "junit" % "junit" % junitVersion % "test" // Common Public License 1.0
val logback = "ch.qos.logback" % "logback-classic" % "1.1.3" % "test" // EPL 1.0 / LGPL 2.1
val mockito = "org.mockito" % "mockito-all" % "1.10.19" % "test" // MIT
// changing the scalatest dependency must be reflected in akka-docs/rst/dev/multi-jvm-testing.rst
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.14" % "test" // ApacheV2
val junitIntf = "com.novocode" % "junit-interface" % "0.11" % "test" // MIT
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.4" % "test"
// metrics, measurements, perf testing
val metrics = "com.codahale.metrics" % "metrics-core" % "3.0.2" % "test" // ApacheV2
val metricsJvm = "com.codahale.metrics" % "metrics-jvm" % "3.0.2" % "test" // ApacheV2
val latencyUtils = "org.latencyutils" % "LatencyUtils" % "1.0.3" % "test" // Free BSD
val hdrHistogram = "org.hdrhistogram" % "HdrHistogram" % "1.1.4" % "test" // CC0
val metricsAll = Seq(metrics, metricsJvm, latencyUtils, hdrHistogram)
// sigar logging
val slf4jJul = "org.slf4j" % "jul-to-slf4j" % "1.7.16" % "test" // MIT
val slf4jLog4j = "org.slf4j" % "log4j-over-slf4j" % "1.7.16" % "test" // MIT
lazy val sprayJson = Compile.sprayJson % "test"
// reactive streams tck
val reactiveStreamsTck = "org.reactivestreams" % "reactive-streams-tck" % "1.0.0" % "test" // CC0
}
object Provided {
// TODO remove from "test" config
val sigarLoader = "io.kamon" % "sigar-loader" % "1.6.6-rev002" % "optional;provided;test" // ApacheV2
val levelDB = "org.iq80.leveldb" % "leveldb" % "0.7" % "optional;provided" // ApacheV2
val levelDBNative = "org.fusesource.leveldbjni" % "leveldbjni-all" % "1.8" % "optional;provided" // New BSD
}
}
import Compile._
// TODO check if `l ++=` everywhere expensive?
val l = libraryDependencies
val actor = l ++= Seq(config, java8Compat.value)
val testkit = l ++= Seq(Test.junit, Test.scalatest.value) ++ Test.metricsAll
val actorTests = l ++= Seq(Test.junit, Test.scalatest.value, Test.commonsCodec, Test.commonsMath, Test.mockito, Test.scalacheck.value, Test.junitIntf)
val remote = l ++= Seq(netty, uncommonsMath, Test.junit, Test.scalatest.value)
val remoteTests = l ++= Seq(Test.junit, Test.scalatest.value, Test.scalaXml)
val cluster = l ++= Seq(Test.junit, Test.scalatest.value)
val clusterTools = l ++= Seq(Test.junit, Test.scalatest.value)
val clusterSharding = l ++= Seq(Provided.levelDB, Provided.levelDBNative, Test.junit, Test.scalatest.value, Test.commonsIo)
val clusterMetrics = l ++= Seq(Provided.sigarLoader, Test.slf4jJul, Test.slf4jLog4j, Test.logback, Test.mockito)
val distributedData = l ++= Seq(Test.junit, Test.scalatest.value)
val slf4j = l ++= Seq(slf4jApi, Test.logback)
val agent = l ++= Seq(scalaStm.value, Test.scalatest.value, Test.junit)
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)
val persistenceTck = l ++= Seq(Test.scalatest.value.copy(configurations = Some("compile")), Test.junit.copy(configurations = Some("compile")))
val persistenceShared = l ++= Seq(Provided.levelDB, Provided.levelDBNative)
val kernel = l ++= Seq(Test.scalatest.value, Test.junit)
val camel = l ++= Seq(camelCore, Test.scalatest.value, Test.junit, Test.mockito, Test.logback, Test.commonsIo, Test.junitIntf)
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, Test.junitIntf, Docs.sprayJson, Docs.gson)
val contrib = l ++= Seq(Test.junitIntf, Test.commonsIo)
val benchJmh = l ++= Seq(Provided.levelDB, Provided.levelDBNative)
// akka stream & http
lazy val httpCore = l ++= Seq(
Test.sprayJson, // for WS Autobahn test metadata
Test.junitIntf, Test.junit, Test.scalatest.value)
lazy val http = l ++= Nil
// special, since it also includes a compiler plugin
lazy val parsing = Seq(
DependencyHelpers.versionDependentDeps(
Dependencies.Compile.scalaReflect % "provided"
),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.fullMapped(nominalScalaVersion))
)
lazy val httpTestkit = l ++= Seq(
Test.junit, Test.junitIntf, Compile.junit % "provided", Test.scalatest.value.copy(configurations = Some("provided; test")))
// TODO collapse those
lazy val httpTests = l ++= Seq(Test.junit, Test.scalatest.value, Test.junitIntf)
lazy val httpTestsJava8 = l ++= Seq(Test.junit, Test.junitIntf)
lazy val httpXml = versionDependentDeps(scalaXml)
lazy val httpSprayJson = versionDependentDeps(sprayJson)
lazy val httpJackson = l ++= Seq(jackson)
lazy val stream = l ++= Seq[sbt.ModuleID](
sslConfigAkka,
reactiveStreams,
Test.junitIntf,
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)
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 <++= scalaVersion(version => modules.flatMap(m => m.modules(version)))
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(_ != '-')
}
}