forked from JDvorak/slamengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
318 lines (275 loc) · 10.3 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
import github.GithubPlugin._
import quasar.project._
import quasar.project.build._
import java.lang.Integer
import scala.{Boolean, List, Predef, None, Some, sys, Unit}, Predef.{any2ArrowAssoc, assert, augmentString}
import scala.collection.Seq
import scala.collection.immutable.Map
import de.heikoseeberger.sbtheader.HeaderPlugin
import de.heikoseeberger.sbtheader.license.Apache2_0
import sbt._, Aggregation.KeyValue, Keys._
import sbt.std.Transform.DummyTaskMap
import sbt.TestFrameworks.Specs2
import sbtrelease._, ReleaseStateTransformations._, Utilities._
import scoverage._
val BothScopes = "test->test;compile->compile"
// Exclusive execution settings
lazy val ExclusiveTests = config("exclusive") extend Test
val ExclusiveTest = Tags.Tag("exclusive-test")
def exclusiveTasks(tasks: Scoped*) =
tasks.flatMap(inTask(_)(tags := Seq((ExclusiveTest, 1))))
lazy val checkHeaders =
taskKey[Unit]("Fail the build if createHeaders is not up-to-date")
lazy val buildSettings = Seq(
organization := "org.quasar-analytics",
headers := Map(
("scala", Apache2_0("2014–2016", "SlamData Inc.")),
("java", Apache2_0("2014–2016", "SlamData Inc."))),
scalaVersion := "2.11.8",
outputStrategy := Some(StdoutOutput),
initialize := {
val version = sys.props("java.specification.version")
assert(
Integer.parseInt(version.split("\\.")(1)) >= 8,
"Java 8 or above required, found " + version)
},
autoCompilerPlugins := true,
autoAPIMappings := true,
exportJars := true,
resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots"),
"JBoss repository" at "https://repository.jboss.org/nexus/content/repositories/",
"Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases",
"bintray/non" at "http://dl.bintray.com/non/maven"),
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.8.0"),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
addCompilerPlugin("com.milessabin" % "si2712fix-plugin" % "1.2.0" cross CrossVersion.full),
ScoverageKeys.coverageHighlighting := true,
// NB: These options need scalac 2.11.7 ∴ sbt > 0.13 for meta-project
scalacOptions ++= BuildInfo.scalacOptions ++ Seq(
"-target:jvm-1.8",
"-Ybackend:GenBCode",
"-Ydelambdafy:method",
"-Ywarn-unused-import"),
scalacOptions in (Test, console) --= Seq(
"-Yno-imports",
"-Ywarn-unused-import"),
wartremoverWarnings in (Compile, compile) ++= Warts.allBut(
Wart.Any,
Wart.AsInstanceOf,
Wart.Equals,
Wart.ExplicitImplicitTypes, // - see puffnfresh/wartremover#226
Wart.ImplicitConversion, // - see puffnfresh/wartremover#242
Wart.IsInstanceOf,
Wart.NoNeedForMonad, // - see puffnfresh/wartremover#159
Wart.Nothing,
Wart.Overloading,
Wart.Product, // _ these two are highly correlated
Wart.Serializable, // /
Wart.ToString),
// Normal tests exclude those tagged in Specs2 with 'exclusive'.
testOptions in Test := Seq(Tests.Argument(Specs2, "exclude", "exclusive")),
// Exclusive tests include only those tagged with 'exclusive'.
testOptions in ExclusiveTests := Seq(Tests.Argument(Specs2, "include", "exclusive")),
// Tasks tagged with `ExclusiveTest` should be run exclusively.
concurrentRestrictions in Global := Seq(Tags.exclusive(ExclusiveTest)),
console <<= console in Test, // console alias test:console
licenses += (("Apache 2", url("http://www.apache.org/licenses/LICENSE-2.0"))),
checkHeaders := {
if ((createHeaders in Compile).value.nonEmpty)
sys.error("headers not all present")
})
lazy val publishSettings = Seq(
organizationName := "SlamData Inc.",
organizationHomepage := Some(url("http://quasar-analytics.org")),
homepage := Some(url("https://github.com/quasar-analytics/quasar")),
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseCrossBuild := true,
autoAPIMappings := true,
scmInfo := Some(
ScmInfo(
url("https://github.com/quasar-analytics/quasar"),
"scm:[email protected]:quasar-analytics/quasar.git"
)
),
developers := List(
Developer(
id = "slamdata",
name = "SlamData Inc.",
email = "[email protected]",
url = new URL("http://slamdata.com")
)
)
)
lazy val assemblySettings = Seq(
test in assembly := {},
assemblyMergeStrategy in assembly := {
case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.last
case PathList("org", "apache", "hadoop", "yarn", xs @ _*) => MergeStrategy.last
case PathList("com", "google", "common", "base", xs @ _*) => MergeStrategy.last
case other => (assemblyMergeStrategy in assembly).value apply other
}
)
// Build and publish a project, excluding its tests.
lazy val commonSettings = buildSettings ++ publishSettings ++ assemblySettings
// Include to also publish a project's tests
lazy val publishTestsSettings = Seq(
publishArtifact in (Test, packageBin) := true
)
// Include to prevent publishing any artifacts for a project
lazy val noPublishSettings = Seq(
publishTo := Some(Resolver.file("nopublish repository", file("target/nopublishrepo"))),
publish := {},
publishLocal := {},
publishArtifact := false
)
lazy val githubReleaseSettings =
githubSettings ++ Seq(
GithubKeys.assets := Seq(assembly.value),
GithubKeys.repoSlug := "quasar-analytics/quasar",
releaseVersionFile := file("version.sbt"),
releaseUseGlobalVersion := true,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runTest,
setReleaseVersion,
commitReleaseVersion,
pushChanges)
)
lazy val isCIBuild = settingKey[Boolean]("True when building in any automated environment (e.g. Travis)")
lazy val root = project.in(file("."))
.settings(commonSettings)
.settings(noPublishSettings)
.settings(aggregate in assembly := false)
.aggregate(
foundation,
// / / | | \ \
//
ejson, effect, js,
// |
core,
// / / | \ \
mongodb, skeleton, postgresql, sparkcore,
// \ \ | / /
main,
// / \
repl, web,
// \ /
it)
.enablePlugins(AutomateHeaderPlugin)
// common components
lazy val foundation = project
.settings(name := "quasar-foundation-internal")
.settings(commonSettings)
.settings(publishTestsSettings)
.settings(libraryDependencies ++= Dependencies.foundation,
isCIBuild := sys.env contains "TRAVIS",
buildInfoKeys := Seq[BuildInfoKey](version, ScoverageKeys.coverageEnabled, isCIBuild),
buildInfoPackage := "quasar.build")
.enablePlugins(AutomateHeaderPlugin, BuildInfoPlugin)
lazy val ejson = project
.settings(name := "quasar-ejson-internal")
.dependsOn(foundation % BothScopes)
.settings(commonSettings)
.enablePlugins(AutomateHeaderPlugin)
lazy val effect = project
.settings(name := "quasar-effect-internal")
.dependsOn(foundation % BothScopes)
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.effect)
.enablePlugins(AutomateHeaderPlugin)
lazy val js = project
.settings(name := "quasar-js-internal")
.dependsOn(foundation % BothScopes)
.settings(commonSettings)
.enablePlugins(AutomateHeaderPlugin)
lazy val core = project
.settings(name := "quasar-core-internal")
.dependsOn(ejson % BothScopes, effect % BothScopes, js % BothScopes)
.settings(commonSettings)
.settings(publishTestsSettings)
.settings(
libraryDependencies ++= Dependencies.core,
ScoverageKeys.coverageMinimum := 79,
ScoverageKeys.coverageFailOnMinimum := true)
.enablePlugins(AutomateHeaderPlugin)
lazy val main = project
.settings(name := "quasar-main-internal")
.dependsOn(
mongodb % BothScopes,
skeleton % BothScopes,
postgresql % BothScopes)
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.main)
.enablePlugins(AutomateHeaderPlugin)
// filesystems (backends)
lazy val mongodb = project
.settings(name := "quasar-mongodb-internal")
.dependsOn(core % BothScopes)
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.mongodb)
.enablePlugins(AutomateHeaderPlugin)
lazy val skeleton = project
.settings(name := "quasar-skeleton-internal")
.dependsOn(core % BothScopes)
.settings(commonSettings)
.enablePlugins(AutomateHeaderPlugin)
lazy val postgresql = project
.settings(name := "quasar-postgresql-internal")
.dependsOn(core % BothScopes)
.settings(commonSettings)
.enablePlugins(AutomateHeaderPlugin)
lazy val sparkcore = project
.settings(name := "quasar-sparkcore-internal")
.dependsOn(core % BothScopes)
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.sparkcore)
.enablePlugins(AutomateHeaderPlugin)
// frontends
// TODO: Get SQL here
// interfaces
lazy val repl = project
.settings(name := "quasar-repl")
.dependsOn(main % BothScopes)
.settings(commonSettings)
.settings(noPublishSettings)
.settings(githubReleaseSettings)
.settings(
fork in run := true,
connectInput in run := true,
outputStrategy := Some(StdoutOutput))
.enablePlugins(AutomateHeaderPlugin)
lazy val web = project
.settings(name := "quasar-web")
.dependsOn(main % BothScopes)
.settings(commonSettings)
.settings(publishTestsSettings)
.settings(githubReleaseSettings)
.settings(
mainClass in Compile := Some("quasar.server.Server"),
libraryDependencies ++= Dependencies.web)
.enablePlugins(AutomateHeaderPlugin)
// integration tests
lazy val it = project
.configs(ExclusiveTests)
.dependsOn(web % BothScopes)
.settings(commonSettings)
.settings(noPublishSettings)
// Configure various test tasks to run exclusively in the `ExclusiveTests` config.
.settings(inConfig(ExclusiveTests)(Defaults.testTasks): _*)
.settings(inConfig(ExclusiveTests)(exclusiveTasks(test, testOnly, testQuick)): _*)
.settings(parallelExecution in Test := false)
.enablePlugins(AutomateHeaderPlugin)