-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
405 lines (362 loc) · 10.9 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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
import sbtcrossproject.{crossProject, CrossType}
import com.typesafe.sbt.pgp.PgpKeys
import scala.xml.transform.{RewriteRule, RuleTransformer}
lazy val sandbox =
settingKey[String]("The name of the environment sandbox to use.")
inThisBuild(
Seq(
parallelExecution := false,
scalafmtVersion := Dependencies.version.scalafmt,
scalafmtOnCompile := true
)
)
lazy val commonSettings = Seq(
homepage := Some(url("https://www.quckoo.io")),
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
organization := "io.quckoo",
organizationName := "A. Alonso Dominguez",
startYear := Some(2015),
scmInfo := Some(
ScmInfo(
url("https://www.github.com/alonsodomin/quckoo"),
"scm:git:[email protected]:alonsodomin/quckoo.git"
)
),
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-language:postfixOps",
"-language:higherKinds",
"-feature",
"-unchecked",
"-deprecation",
"-Xlint:-unused,_",
"-Xfuture",
"-Xfatal-warnings",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ypartial-unification"
),
scalaModuleInfo := scalaModuleInfo.value.map(_.withOverrideScalaVersion(true)),
resolvers ++= Seq(
Opts.resolver.mavenLocalFile,
Resolver.bintrayRepo("krasserm", "maven"),
Resolver.bintrayRepo("hseeberger", "maven"),
Resolver.bintrayRepo("dnvriend", "maven"),
Resolver.bintrayRepo("tecsisa", "maven-bintray-repo")
)
)
lazy val commonJvmSettings = Seq(
fork in Test := false
)
lazy val commonJsSettings = Seq(
coverageEnabled := false,
scalaJSStage in Test := FastOptStage,
jsEnv in Test := PhantomJSEnv().value,
// batch mode decreases the amount of memory needed to compile scala.js code
scalaJSOptimizerOptions := scalaJSOptimizerOptions.value.withBatchMode(isTravisBuild.value)
)
lazy val scoverageSettings = Seq(
coverageHighlighting := true,
coverageExcludedPackages := "io\\.quckoo\\.console\\.html\\..*"
)
lazy val publishSettings = Seq(
publishMavenStyle := true,
publishArtifact in Test := false,
publishTo := Some(
if (isSnapshot.value) Opts.resolver.sonatypeSnapshots
else Opts.resolver.sonatypeStaging
),
// don't include scoverage as a dependency in the pom
// see issue #980
// this code was copied from https://github.com/mongodb/mongo-spark
pomPostProcess := { (node: xml.Node) =>
new RuleTransformer(new RewriteRule {
override def transform(node: xml.Node): Seq[xml.Node] = node match {
case e: xml.Elem
if e.label == "dependency" && e.child
.exists(child => child.label == "groupId" && child.text == "org.scoverage") =>
Nil
case _ => Seq(node)
}
}).transform(node).head
},
pomExtra :=
<developers>
<developer>
<id>alonsodomin</id>
<name>Antonio Alonso Dominguez</name>
<url>https://github.com/alonsodomin</url>
</developer>
</developers>
)
lazy val noPublishSettings = publishSettings ++ Seq(
skip in publish := true,
publishArtifact := false
)
lazy val releaseSettings = {
import ReleaseTransformations._
val dockerRelease = ReleaseStep(action = st => {
val extracted = Project.extract(st)
val projectRef: ProjectRef = extracted.get(thisProjectRef)
extracted.runAggregated(publish in Docker in projectRef, st)
st
})
Seq(
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
releaseStepCommand("sonatypeReleaseAll"),
dockerRelease,
setNextVersion,
commitNextVersion,
pushChanges
)
)
}
lazy val quckoo = (project in file("."))
.enablePlugins(AutomateHeaderPlugin, DockerComposePlugin)
.settings(commonSettings)
.settings(
name := "quckoo",
moduleName := "quckoo-root",
sandbox := "standalone",
dockerImageCreationTask := (publishLocal in Docker).value,
composeFile := s"./sandbox/${sandbox.value}/docker-compose.yml"
)
.settings(noPublishSettings)
.settings(releaseSettings)
.aggregate(
coreJS,
coreJVM,
apiJS,
apiJVM,
clientJS,
clientJVM,
console,
shared,
master,
worker,
examples,
utilJS,
utilJVM,
testSupportJS,
testSupportJVM
)
// Core ==================================================
lazy val core =
(crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Pure) in file("core"))
.enablePlugins(BuildInfoPlugin, AutomateHeaderPlugin)
.settings(
name := "core",
moduleName := "quckoo-core",
buildInfoPackage := "io.quckoo",
buildInfoKeys := Seq[BuildInfoKey](version, scalaVersion),
buildInfoObject := "Info"
)
.settings(commonSettings)
.settings(scoverageSettings)
.settings(publishSettings)
.settings(Dependencies.core)
.jsSettings(commonJsSettings)
.jsSettings(Dependencies.coreJS)
.jvmSettings(commonJvmSettings)
.jvmSettings(Dependencies.coreJVM)
.dependsOn(util, testSupport % Test)
lazy val coreJS = core.js
lazy val coreJVM = core.jvm
// API ==================================================
lazy val api =
(crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Pure) in file("api"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.settings(scoverageSettings)
.settings(publishSettings)
.settings(Dependencies.api)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.settings(
name := "api",
moduleName := "quckoo-api"
)
.dependsOn(core, testSupport % Test)
lazy val apiJS = api.js
lazy val apiJVM = api.jvm
// Client ==================================================
lazy val client = (crossProject(JSPlatform, JVMPlatform) in file("client"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.settings(scoverageSettings)
.settings(publishSettings)
.settings(Dependencies.client)
.jsSettings(commonJsSettings)
.jsSettings(Dependencies.clientJS)
.jvmSettings(commonJvmSettings)
.jvmSettings(Dependencies.clientJVM)
.settings(
name := "client",
moduleName := "quckoo-client"
)
.dependsOn(api, testSupport % Test)
lazy val clientJS = client.js
lazy val clientJVM = client.jvm
// Console ==================================================
lazy val console = (project in file("console"))
.enablePlugins(AutomateHeaderPlugin, ScalaJSPlugin, ScalaJSWeb)
.settings(commonSettings)
.settings(commonJsSettings)
.settings(publishSettings)
.settings(Dependencies.console)
.settings(
name := "console",
moduleName := "quckoo-console",
scalaJSUseMainModuleInitializer in Compile := true
)
.dependsOn(clientJS, testSupportJS % Test)
// Server ==================================================
lazy val shared = (project in file("shared"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.settings(commonJvmSettings)
.settings(scoverageSettings)
.settings(publishSettings)
.settings(Dependencies.clusterShared)
.settings(
moduleName := "quckoo-shared"
)
.dependsOn(apiJVM, testSupportJVM % Test)
lazy val master = (project in file("master"))
.enablePlugins(
AutomateHeaderPlugin,
QuckooWebServer,
QuckooServerPackager,
QuckooMultiJvmTesting
)
.settings(commonSettings)
.settings(commonJvmSettings)
.settings(scoverageSettings)
.settings(publishSettings)
.settings(automateHeaderSettings(MultiJvm))
.settings(Dependencies.clusterMaster)
.settings(
moduleName := "quckoo-master",
scalaJSProjects := Seq(console),
dockerExposedPorts := Seq(2551, 8095, 9095),
parallelExecution in Test := false,
parallelExecution in MultiJvm := false
)
.dependsOn(shared % "compile->compile;test->test", testSupportJVM % Test)
lazy val worker = (project in file("worker"))
.enablePlugins(AutomateHeaderPlugin, QuckooApp, QuckooServerPackager)
.settings(commonSettings)
.settings(commonJvmSettings)
.settings(scoverageSettings)
.settings(publishSettings)
.settings(Dependencies.clusterWorker)
.settings(
moduleName := "quckoo-worker",
dockerExposedPorts := Seq(5001, 9010, 9095),
parallelExecution in Test := false
)
.dependsOn(shared % "compile->compile;test->test", testSupportJVM % Test)
// Misc Utilities ===========================================
lazy val util = (crossProject(JSPlatform, JVMPlatform) in file("util"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.jsSettings(commonJsSettings)
.jsSettings(Dependencies.utilJS)
.jvmSettings(commonJvmSettings)
.settings(moduleName := "quckoo-util")
.dependsOn(testSupport % Test)
lazy val utilJS = util.js
lazy val utilJVM = util.jvm
// Test Support Utilities ===================================
lazy val testSupport =
(crossProject(JSPlatform, JVMPlatform) in file("test-support"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.settings(noPublishSettings)
.settings(Dependencies.testSupport)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.jvmSettings(Dependencies.testSupportJVM)
.settings(
name := "test-support",
moduleName := "quckoo-test-support"
)
lazy val testSupportJS = testSupport.js
lazy val testSupportJVM = testSupport.jvm
// Examples ==================================================
lazy val examples = (project in file("examples"))
.settings(moduleName := "quckoo-examples")
.aggregate(exampleJobs, exampleProducers)
.settings(noPublishSettings)
lazy val exampleJobs = (project in file("examples/jobs"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.settings(commonJvmSettings)
.settings(publishSettings)
.settings(Dependencies.exampleJobs)
.settings(
name := "example-jobs",
moduleName := "quckoo-example-jobs"
)
.dependsOn(coreJVM)
lazy val exampleProducers = (project in file("examples/producers"))
.enablePlugins(AutomateHeaderPlugin, QuckooAppPackager)
.settings(commonSettings)
.settings(commonJvmSettings)
.settings(publishSettings)
.settings(Revolver.settings)
.settings(Dependencies.exampleProducers)
.settings(
name := "example-producers",
moduleName := "quckoo-example-producers"
)
.dependsOn(clientJVM, exampleJobs)
// Command aliases ==================================================
addCommandAlias(
"testJS",
Seq(
"coreJS/test",
"apiJS/test",
"clientJS/test",
"console/test"
).mkString(";", ";", "")
)
addCommandAlias(
"validate",
Seq(
"test",
"master/multi-jvm:test"
).mkString(";", ";", "")
)
addCommandAlias(
"recompile",
Seq(
"clean",
"test:compile",
"master/multi-jvm:compile"
).mkString(";", ";", "")
)
addCommandAlias(
"rebuild",
Seq(
"clean",
"validate"
).mkString(";", ";", "")
)
addCommandAlias(
"launchLocal",
Seq(
"docker:publishLocal",
"dockerComposeUp"
).mkString(";", ";", "")
)