forked from outworkers/phantom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
388 lines (365 loc) · 14.7 KB
/
build.sbt
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
/*
* Copyright 2013-2015 Websudos, Limited.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Explicit written consent must be obtained from the copyright owner,
* Outworkers Limited before any redistribution is made.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
import sbt.Keys._
import sbt._
import com.twitter.sbt._
import net.virtualvoid.sbt.graph.Plugin.graphSettings
lazy val Versions = new {
val logback = "1.1.7"
val util = "0.16.0"
val json4s = "3.3.0"
val datastax = "3.0.1"
val scalatest = "2.2.4"
val shapeless = "2.2.5"
val thrift = "0.8.0"
val finagle = "6.35.0"
val twitterUtil = "6.33.0"
val scrooge = "4.7.0"
val scalatra = "2.3.0"
val play = "2.4.6"
val scalameter = "0.6"
val spark = "1.2.0-alpha3"
val diesel = "0.3.0"
val slf4j = "1.7.21"
val reactivestreams = "1.0.0"
val akka = "2.3.14"
val typesafeConfig = "1.2.1"
val jetty = "9.1.2.v20140210"
val dispatch = "0.11.0"
val cassandraUnit = "3.0.0.1"
}
val RunningUnderCi = Option(System.getenv("CI")).isDefined || Option(System.getenv("TRAVIS")).isDefined
val defaultConcurrency = 4
val liftVersion: String => String = {
case "2.10.5" => "3.0-M1"
case _ => "3.0-M6"
}
val PerformanceTest = config("perf").extend(Test)
lazy val performanceFilter: String => Boolean = _.endsWith("PerformanceTest")
lazy val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)
lazy val defaultCredentials: Seq[Credentials] = {
if (!RunningUnderCi) {
Seq(
Credentials(Path.userHome / ".bintray" / ".credentials"),
Credentials(Path.userHome / ".ivy2" / ".credentials")
)
} else {
Seq(
Credentials(
realm = "Bintray",
host = "dl.bintray.com",
userName = System.getenv("bintray_user"),
passwd = System.getenv("bintray_password")
),
Credentials(
realm = "Bintray API Realm",
host = "api.bintray.com",
userName = System.getenv("bintray_user"),
passwd = System.getenv("bintray_password")
)
)
}
}
val sharedSettings: Seq[Def.Setting[_]] = Defaults.coreDefaultSettings ++ Seq(
organization := "com.websudos",
scalaVersion := "2.11.7",
credentials ++= defaultCredentials,
crossScalaVersions := Seq("2.10.5", "2.11.7"),
resolvers ++= Seq(
"Typesafe repository snapshots" at "http://repo.typesafe.com/typesafe/snapshots/",
"Typesafe repository releases" at "http://repo.typesafe.com/typesafe/releases/",
"Sonatype repo" at "https://oss.sonatype.org/content/groups/scala-tools/",
"Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases",
"Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype staging" at "http://oss.sonatype.org/content/repositories/staging",
"Java.net Maven2 Repository" at "http://download.java.net/maven/2/",
"Twitter Repository" at "http://maven.twttr.com",
Resolver.bintrayRepo("websudos", "oss-releases")
),
scalacOptions ++= Seq(
"-language:postfixOps",
"-language:implicitConversions",
"-language:reflectiveCalls",
"-language:higherKinds",
"-language:existentials",
"-Yinline-warnings",
"-Xlint",
"-deprecation",
"-feature",
"-unchecked"
),
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % Versions.logback,
"org.slf4j" % "log4j-over-slf4j" % Versions.slf4j
),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0-M5" cross CrossVersion.full),
fork in Test := true,
javaOptions in ThisBuild ++= Seq(
"-Xmx2G",
"-Djava.net.preferIPv4Stack=true",
"-Dio.netty.resourceLeakDetection"
),
javaOptions in Test ++= Seq(
"-Xmx2G",
"-Djava.net.preferIPv4Stack=true",
"-Dio.netty.resourceLeakDetection"
),
testFrameworks in PerformanceTest := Seq(new TestFramework("org.scalameter.ScalaMeterFramework")),
testOptions in Test := Seq(Tests.Filter(x => !performanceFilter(x))),
testOptions in PerformanceTest := Seq(Tests.Filter(x => performanceFilter(x))),
fork in PerformanceTest := false,
parallelExecution in ThisBuild := false
) ++ graphSettings ++
VersionManagement.newSettings ++
GitProject.gitSettings ++
PublishTasks.effectivePublishingSettings
lazy val isJdk8: Boolean = sys.props("java.specification.version") == "1.8"
lazy val addOnCondition: (Boolean, ProjectReference) => Seq[ProjectReference] = (bool, ref) =>
if (bool) ref :: Nil else Nil
lazy val baseProjectList: Seq[ProjectReference] = Seq(
phantomDsl,
phantomExample,
phantomConnectors,
phantomFinagle,
phantomReactiveStreams,
phantomSbtPlugin,
phantomThrift,
phantomZookeeper
)
lazy val fullProjectList = baseProjectList ++ addOnCondition(isJdk8, phantomJdk8)
lazy val phantom = (project in file("."))
.configs(
PerformanceTest
).settings(
inConfig(PerformanceTest)(Defaults.testTasks): _*
).settings(
sharedSettings ++ noPublishSettings
).settings(
name := "phantom",
moduleName := "phantom"
).aggregate(
fullProjectList: _*
)
lazy val phantomDsl = (project in file("phantom-dsl")).configs(
PerformanceTest
).settings(
inConfig(PerformanceTest)(Defaults.testTasks): _*
).settings(
sharedSettings: _*
).settings(
name := "phantom-dsl",
moduleName := "phantom-dsl",
testOptions in Test += Tests.Argument("-oF"),
logBuffered in Test := false,
concurrentRestrictions in Test := Seq(
Tags.limit(Tags.ForkedTestGroup, defaultConcurrency)
),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.websudos" %% "diesel-engine" % Versions.diesel,
"com.chuusai" %% "shapeless" % Versions.shapeless,
"joda-time" % "joda-time" % "2.8.1",
"org.joda" % "joda-convert" % "1.8.1",
"com.datastax.cassandra" % "cassandra-driver-core" % Versions.datastax,
"com.datastax.cassandra" % "cassandra-driver-extras" % Versions.datastax,
"org.slf4j" % "log4j-over-slf4j" % Versions.slf4j,
"org.scalacheck" %% "scalacheck" % "1.11.5" % "test",
"com.websudos" %% "util-lift" % Versions.util % "test",
"com.websudos" %% "util-testing" % Versions.util % "test",
"net.liftweb" %% "lift-json" % liftVersion(scalaVersion.value) % "test",
"com.storm-enroute" %% "scalameter" % Versions.scalameter % "test",
"ch.qos.logback" % "logback-classic" % Versions.logback % "test"
)
).dependsOn(
phantomConnectors
)
lazy val phantomJdk8 = (project in file("phantom-jdk8"))
.settings(
name := "phantom-jdk8",
moduleName := "phantom-jdk8",
testOptions in Test += Tests.Argument("-oF"),
logBuffered in Test := false,
concurrentRestrictions in Test := Seq(
Tags.limit(Tags.ForkedTestGroup, defaultConcurrency)
)
).settings(
sharedSettings: _*
).dependsOn(
phantomDsl % "compile->compile;test->test"
)
lazy val phantomConnectors = (project in file("phantom-connectors"))
.configs(PerformanceTest)
.settings(
sharedSettings: _*
).settings(
name := "phantom-connectors",
libraryDependencies ++= Seq(
"com.datastax.cassandra" % "cassandra-driver-core" % Versions.datastax,
"com.websudos" %% "util-testing" % Versions.util % "test, provided"
)
)
lazy val phantomFinagle = (project in file("phantom-finagle"))
.configs(PerformanceTest).settings(
name := "phantom-finagle",
moduleName := "phantom-finagle",
libraryDependencies ++= Seq(
"com.twitter" %% "util-core" % Versions.twitterUtil,
"com.websudos" %% "util-testing" % Versions.util % "test, provided",
"com.storm-enroute" %% "scalameter" % Versions.scalameter % "test, provided"
)
).settings(
inConfig(PerformanceTest)(Defaults.testTasks) ++ sharedSettings: _*
).dependsOn(
phantomDsl % "compile->compile;test->test"
)
lazy val phantomThrift = (project in file("phantom-thrift"))
.settings(
name := "phantom-thrift",
moduleName := "phantom-thrift",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-log4j12" % Versions.slf4j % "test, provided",
"org.apache.thrift" % "libthrift" % Versions.thrift,
"com.twitter" %% "scrooge-core" % Versions.scrooge,
"com.twitter" %% "scrooge-serializer" % Versions.scrooge,
"com.websudos" %% "util-testing" % Versions.util % "test, provided"
)
).settings(
sharedSettings: _*
).dependsOn(
phantomDsl,
phantomFinagle
)
lazy val phantomSbtPlugin = (project in file("phantom-sbt"))
.settings(
sharedSettings: _*
).settings(
name := "phantom-sbt",
moduleName := "phantom-sbt",
scalaVersion := "2.10.5",
publish := {
CrossVersion.partialVersion(scalaVersion.value).map {
case (2, scalaMajor) if scalaMajor >= 11 => false
case _ => true
}
},
excludeFilter := {
CrossVersion.partialVersion(scalaVersion.value) match {
// if scala 2.11+ is used, quasiquotes are merged into scala-reflect
case Some((2, scalaMajor)) if scalaMajor >= 11 => NothingFilter
case _ => AllPassFilter
}
},
sbtPlugin := true,
libraryDependencies ++= Seq(
"org.cassandraunit" % "cassandra-unit" % Versions.cassandraUnit excludeAll (
ExclusionRule("org.slf4j", "slf4j-log4j12"),
ExclusionRule("org.slf4j", "slf4j-jdk14")
)
)
)
lazy val phantomZookeeper = (project in file("phantom-zookeeper"))
.settings(
name := "phantom-zookeeper",
moduleName := "phantom-zookeeper",
libraryDependencies ++= Seq(
"org.xerial.snappy" % "snappy-java" % "1.1.1.3",
"com.websudos" %% "util-testing" % Versions.util % "test, provided",
"com.websudos" %% "util-zookeeper" % Versions.util % "test, provided" excludeAll ExclusionRule("org.slf4j", "slf4j-jdk14")
)
).settings(
sharedSettings: _*
).dependsOn(
phantomConnectors
)
lazy val phantomReactiveStreams = (project in file("phantom-reactivestreams"))
.settings(
name := "phantom-reactivestreams",
moduleName := "phantom-reactivestreams",
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-iteratees" % Versions.play exclude ("com.typesafe", "config"),
"com.typesafe.play" %% "play-streams-experimental" % Versions.play exclude("com.typesafe", "config"),
"com.typesafe" % "config" % Versions.typesafeConfig,
"org.reactivestreams" % "reactive-streams" % Versions.reactivestreams,
"com.typesafe.akka" %% s"akka-actor" % Versions.akka,
"com.websudos" %% "util-testing" % Versions.util % "test, provided",
"org.reactivestreams" % "reactive-streams-tck" % Versions.reactivestreams % "test, provided",
"com.storm-enroute" %% "scalameter" % Versions.scalameter % "test, provided"
)
).settings(
sharedSettings: _*
).dependsOn(
phantomDsl % "compile->compile;test->test"
)
lazy val phantomExample = (project in file("phantom-example"))
.settings(
name := "phantom-example",
moduleName := "phantom-example",
libraryDependencies ++= Seq(
"com.websudos" %% "util-lift" % Versions.util % "test, provided",
"com.websudos" %% "util-testing" % Versions.util % "test, provided"
)
).settings(
sharedSettings: _*
).dependsOn(
phantomDsl,
phantomReactiveStreams,
phantomThrift,
phantomZookeeper
)
lazy val phantomContainerTests = (project in file("phantom-container-test"))
.settings(
name := "phantom-container-test",
moduleName := "phantom-container-test",
fork := true,
logBuffered in Test := true,
concurrentRestrictions in Test := Seq(
Tags.limit(Tags.ForkedTestGroup, defaultConcurrency)
),
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-native" % Versions.json4s,
"org.json4s" %% "json4s-ext" % Versions.json4s,
"net.liftweb" %% "lift-webkit" % liftVersion(scalaVersion.value),
"net.liftweb" %% "lift-json" % liftVersion(scalaVersion.value),
"net.databinder.dispatch" %% "dispatch-core" % Versions.dispatch % "test",
"javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided",
"com.websudos" %% "util-testing" % Versions.util % "provided"
)
).settings(
sharedSettings: _*
).dependsOn(
phantomDsl,
phantomThrift,
phantomZookeeper
)