-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbuild.sbt
More file actions
310 lines (286 loc) · 13.6 KB
/
build.sbt
File metadata and controls
310 lines (286 loc) · 13.6 KB
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
import BNFC._
import com.typesafe.sbt.packager.docker.{Cmd, ExecCmd}
lazy val ourScalaVersion = "2.11.8"
lazy val acme4jVersion = "0.7"
lazy val amqpClientVersion = "2.6.1"
lazy val base64coderVersion = "2010-09-21"
lazy val baseXVersion = "7.6"
lazy val commonsPoolVersion = "1.6"
lazy val configVersion = "1.3.1"
lazy val casbahVersion = "3.1.1"
lazy val persistenceVersion = "1.0"
lazy val jettisonVersion = "1.3.8"
lazy val jettyVersion = "8.0.4.v20111024"
lazy val json4sVersion = "3.4.1"
lazy val log4jVersion = "1.2.17"
lazy val prolog4jVersion = "0.2.1"
lazy val scalatestVersion = "2.2.6"
lazy val scalesXmlVersion = "0.6.0-M3"
lazy val slf4jVersion = "1.7.21"
lazy val sprayVersion = "1.3.3"
lazy val tuprologVersion = "2.1.1"
lazy val xstreamVersion = "1.4.9"
lazy val commonOptions = Seq(
// =========================================
// TODO Enable as many of these as possible:
// =========================================
// "-Xfatal-warnings",
// "-Xfuture",
// "-Xlint",
// "-Yno-adapted-args",
// "-Ywarn-dead-code",
// "-Ywarn-numeric-widen",
// "-Ywarn-value-discard",
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-language:higherKinds",
"-language:implicitConversions",
"-language:postfixOps",
"-language:reflectiveCalls",
"-unchecked",
"-Xmax-classfile-name", "244",
"-P:continuations:enable")
lazy val commonDeps = Seq(
"log4j" % "log4j" % log4jVersion,
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.slf4j" % "slf4j-log4j12" % slf4jVersion)
lazy val commonSettings = Seq(
scalaVersion := ourScalaVersion,
scalacOptions := commonOptions,
autoCompilerPlugins := true,
git.baseVersion := "0.8",
git.formattedShaVersion := git.gitHeadCommit.value.map { sha =>
s"${git.baseVersion.value}-${sha.substring(0, 7)}"
},
resolvers ++= Seq(
Resolver.bintrayRepo("synereo", "maven"),
Resolver.bintrayRepo("omni", "maven"),
Resolver.bintrayRepo("msgilligan", "maven"),
Resolver.sonatypeRepo("snapshots"),
"BaseX" at "http://files.basex.org/maven/",
"xqj" at "http://xqj.net/maven/"),
libraryDependencies ++=
Seq(compilerPlugin("org.scala-lang.plugins" % s"scala-continuations-plugin_$ourScalaVersion" % "1.0.2")) ++
Seq("org.scala-lang" % "scala-actors" % scalaVersion.value,
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.plugins" %% "scala-continuations-library" % "1.0.2",
// https://github.com/json4s/json4s/issues/108
"org.scala-lang" % "scalap" % scalaVersion.value) ++
commonDeps)
lazy val specialkDeps = Seq(
"biz.source_code" % "base64coder" % base64coderVersion,
"com.rabbitmq" % "amqp-client" % amqpClientVersion,
"com.thoughtworks.xstream" % "xstream" % xstreamVersion,
"com.typesafe" % "config" % configVersion,
"commons-pool" % "commons-pool" % commonsPoolVersion,
"it.unibo.alice.tuprolog" % "tuprolog" % tuprologVersion,
"javax.persistence" % "persistence-api" % persistenceVersion,
"org.basex" % "basex-api" % baseXVersion exclude("org.slf4j", "slf4j-nop"),
"org.coconut.forkjoin" % "jsr166y" % "070108",
"org.codehaus.jettison" % "jettison" % jettisonVersion,
"org.json4s" %% "json4s-jackson" % json4sVersion,
"org.mongodb" %% "casbah" % casbahVersion exclude("org.slf4j", "slf4j-api"),
"org.prolog4j" % "prolog4j-api" % prolog4jVersion,
"org.prolog4j" % "prolog4j-tuprolog" % prolog4jVersion,
"org.scalacheck" %% "scalacheck" % "1.12.5" % "test",
"org.scalatest" %% "scalatest" % scalatestVersion % "test",
"org.scalesxml" %% "scales-xml" % scalesXmlVersion)
lazy val specialkSettings = Seq(
name := "specialk",
organization := "com.biosimilarity.lift",
libraryDependencies ++= specialkDeps,
fork in Test := true)
lazy val specialk = (project in file("specialk"))
.settings(specialkSettings: _*)
.settings(commonSettings: _*)
.settings(bnfcSettings: _*)
.enablePlugins(GitVersioning)
lazy val agentServiceDeps = Seq(
"biz.source_code" % "base64coder" % base64coderVersion,
"com.rabbitmq" % "amqp-client" % amqpClientVersion,
"com.thoughtworks.xstream" % "xstream" % xstreamVersion,
"com.typesafe" % "config" % configVersion,
"commons-pool" % "commons-pool" % commonsPoolVersion,
"it.unibo.alice.tuprolog" % "tuprolog" % tuprologVersion,
"javax.persistence" % "persistence-api" % persistenceVersion,
"net.spy" % "spymemcached" % "2.9.0",
"org.basex" % "basex-api" % baseXVersion exclude("org.slf4j", "slf4j-nop"),
"org.codehaus.jettison" % "jettison" % jettisonVersion,
"org.json4s" %% "json4s-jackson" % json4sVersion,
"org.json4s" %% "json4s-native" % json4sVersion,
"org.mongodb" %% "casbah" % casbahVersion exclude("org.slf4j", "slf4j-api"),
"org.prolog4j" % "prolog4j-api" % prolog4jVersion,
"org.prolog4j" % "prolog4j-tuprolog" % prolog4jVersion,
"org.scalesxml" %% "scales-xml" % scalesXmlVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % "test")
lazy val agentServiceSettings = Seq(
name := "agentservices-store-ia",
organization := "com.protegra-ati",
libraryDependencies ++= agentServiceDeps,
fork in Test := true)
lazy val agentService = (project in file("agent-service/AgentServices-Store"))
.settings(agentServiceSettings: _*)
.settings(commonSettings: _*)
.settings(bnfcSettings: _*)
.dependsOn(specialk, wallet)
lazy val glosevalDeps = Seq(
"biz.source_code" % "base64coder" % base64coderVersion,
"io.spray" %% "spray-can" % sprayVersion,
"io.spray" %% "spray-client" % sprayVersion,
"io.spray" %% "spray-httpx" % sprayVersion,
"io.spray" %% "spray-routing-shapeless2" % sprayVersion,
"io.spray" %% "spray-testkit" % sprayVersion,
"io.spray" %% "spray-json" % "1.3.2",
"com.github.scopt" %% "scopt" % "3.5.0",
"com.rabbitmq" % "amqp-client" % amqpClientVersion,
"com.typesafe.akka" %% "akka-actor" % "2.4.9",
"it.unibo.alice.tuprolog" % "tuprolog" % tuprologVersion,
"org.apache.commons" % "commons-email" % "1.3.1",
"org.json4s" %% "json4s-jackson" % json4sVersion,
"org.json4s" %% "json4s-native" % json4sVersion,
"org.mongodb" %% "casbah" % casbahVersion exclude("org.slf4j", "slf4j-api"),
"org.prolog4j" % "prolog4j-api" % prolog4jVersion,
"org.prolog4j" % "prolog4j-tuprolog" % prolog4jVersion,
"org.scalaj" %% "scalaj-http" % "2.0.0",
"org.shredzone.acme4j" % "acme4j-client" % acme4jVersion,
"org.shredzone.acme4j" % "acme4j-utils" % acme4jVersion,
"org.bouncycastle" % "bcprov-jdk15on" % "1.54",
"org.scalatest" %% "scalatest" % scalatestVersion % "test")
val buildBaseImage = taskKey[Unit]("Builds the 'synereo/base' Docker Image")
val copyClientResources = taskKey[Unit]("Copy the 'client' directory to the Docker staging directory")
lazy val glosevalDockerSettings = Seq(
mappings in Universal := {
val deduped: Seq[(File, String)] =
(mappings in Universal).value
.map((x: (File, String)) => x.swap)
.toMap
.toSeq
.map((x: (String, File)) => x.swap)
deduped
.:+(baseDirectory.value / "src" / "main" / "docker" / "node" / "eval.conf" -> "eval.conf")
.:+(baseDirectory.value / "src" / "main" / "docker" / "node" / "log.conf" -> "log.conf")
.:+(baseDirectory.value / "src" / "main" / "docker" / "node" / "supervisord.conf" -> "supervisord.conf")
},
buildBaseImage in Docker := {
val s: TaskStreams = streams.value
val cmd = s"docker build -t synereo/base:latest ${baseDirectory.value}/src/main/docker/base"
Process(cmd).!(s.log) match {
case 0 => ()
case _ => error("'docker build' failed")
}
},
copyClientResources in Docker := {
val sourceDir = baseDirectory.value / "client"
val destDir = stagingDirectory.in(Docker).value / "opt" / "docker" / "client"
IO.createDirectory(destDir)
IO.copyDirectory(sourceDir, destDir)
},
stage in Docker := {
buildBaseImage.in(Docker).value
copyClientResources.in(Docker).value
stage.in(Docker).value
},
packageName := "synereo-node",
dockerCommands := {
val ip = "127.0.0.1"
val port = "5672"
Seq(
Cmd("FROM", "synereo/base"),
Cmd("ENV",
"EMAIL_SMTP_SERVER=smtp.googlemail.com",
"EMAIL_AUTH_PASSWORD=Synereo52.38.13.42",
"EMAIL_AUTH_USERNAME=s52.38.13.42",
"TWEET_LEVEL=warning",
"BLOG_LEVEL=warning",
"MODE=headed",
"DEPLOYMENT_MODE=colocated",
"SERVER_PORT=8567",
"SERVER_SSL_PORT=9876",
s"DSL_COMM_LINK_SERVER_HOST=$ip",
s"DSL_COMM_LINK_SERVER_PORT=$port",
s"DSL_COMM_LINK_CLIENT_HOSTS=$ip:$port",
s"DSL_EVALUATOR_HOST=$ip",
s"DSL_EVALUATOR_PORT=$port",
s"DSL_EVALUATOR_PREFERRED_SUPPLIER_HOST=$ip",
s"DSL_EVALUATOR_PREFERRED_SUPPLIER_PORT=$port",
s"BFACTORY_COMM_LINK_SERVER_HOST=$ip",
s"BFACTORY_COMM_LINK_SERVER_PORT=$port",
s"BFACTORY_COMM_LINK_CLIENT_HOST=$ip",
s"BFACTORY_COMM_LINK_CLIENT_PORT=$port",
s"BFACTORY_EVALUATOR_HOST=$ip",
s"BFACTORY_EVALUATOR_PORT=$port"),
Cmd("WORKDIR", "/opt/docker"),
Cmd("ADD", "opt", "/opt"),
Cmd("USER", "root"),
Cmd("RUN", "chown", "-R", "synereo:synereo", s"${defaultLinuxInstallLocation.in(Docker).value}"),
Cmd("RUN", "chmod", "a+x", s"${defaultLinuxInstallLocation.in(Docker).value}/bin/${executableScriptName.value}"),
Cmd("RUN", "mv", "supervisord.conf", "/etc/supervisor/conf.d/supervisord.conf"),
Cmd("USER", "synereo"),
Cmd("RUN", "bin/gloseval", "gencert", "--self-signed"),
Cmd("USER", "root"),
Cmd("EXPOSE", "5005", "8567", "9876"),
ExecCmd("CMD", "/usr/bin/supervisord"))
})
lazy val glosevalSettings = Seq(
name := "GLoSEval",
organization := "com.biosimilarity",
libraryDependencies ++= glosevalDeps,
dockerRepository := Some("synereo"),
dockerUpdateLatest := true,
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion),
buildInfoPackage := "com.biosimilarity.evaluator",
fork := true,
parallelExecution in Test := false)
lazy val gloseval = (project in file("gloseval"))
.settings(glosevalSettings: _*)
.settings(glosevalDockerSettings: _*)
.settings(commonSettings: _*)
.dependsOn(specialk, agentService)
.enablePlugins(JavaAppPackaging)
.enablePlugins(DockerPlugin)
.enablePlugins(BuildInfoPlugin)
lazy val worlockDeps = Seq(
"com.github.docker-java" % "docker-java" % "3.0.6",
"com.typesafe.akka" %% "akka-actor" % "2.4.9",
"com.typesafe" % "config" % configVersion,
"io.spray" %% "spray-can" % sprayVersion,
"io.spray" %% "spray-client" % sprayVersion,
"io.spray" %% "spray-httpx" % sprayVersion,
"org.json4s" %% "json4s-jackson" % json4sVersion,
"org.json4s" %% "json4s-native" % json4sVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % "test")
val dockerTest = taskKey[Unit]("Run tests against Docker containers")
lazy val worlockSettings = Seq(
name := "worlock",
organization := "com.synereo",
libraryDependencies ++= worlockDeps,
dockerTest in Test := {
publishLocal.in(Docker).in(gloseval).value
test.in(Test).value
})
lazy val worlock = (project in file("worlock"))
.settings(worlockSettings: _*)
.settings(commonSettings: _*)
.dependsOn(gloseval % "test->test;compile->compile")
lazy val walletDeps = Seq(
"com.typesafe" % "config" % configVersion,
"org.json4s" %% "json4s-jackson" % json4sVersion,
"org.json4s" %% "json4s-native" % json4sVersion,
"org.bitcoinj" % "bitcoinj-core" % "0.14.3" exclude("org.slf4j", "slf4j-api"),
"foundation.omni" % "omnij-core" % "0.4.0" exclude("org.slf4j", "slf4j-api") exclude("org.slf4j", "slf4j-jdk14"),
"foundation.omni" % "omnij-rpc" % "0.4.0" exclude("org.slf4j", "slf4j-api") exclude("org.slf4j", "slf4j-jdk14"),
"org.scalatest" %% "scalatest" % scalatestVersion % "test")
lazy val walletSettings = Seq(
name := "wallet",
organization := "com.synereo",
libraryDependencies ++= walletDeps)
lazy val wallet = (project in file("wallet"))
.settings(walletSettings: _*)
.settings(commonSettings: _*)
lazy val root = (project in file("."))
.aggregate(specialk, agentService, gloseval, worlock, wallet)
.dependsOn(specialk, agentService, gloseval, worlock, wallet)
.settings(commonSettings: _*)
.enablePlugins(GitVersioning)