-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
360 lines (300 loc) · 11.8 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
import sbt.Credentials
import sbt.Keys.{credentials, name, publishMavenStyle}
lazy val scala212 = "2.12.8"
lazy val supportedScalaVersions = List(scala212)
ThisBuild / organization := "org.codefeedr"
ThisBuild / organizationName := "CodeFeedr"
ThisBuild / organizationHomepage := Some(url("http://codefeedr.org"))
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/codefeedr/codefeedr"),
"scm:git@github.com:codefeedr/codefeedr.git"
)
)
ThisBuild / developers := List(
Developer(
id = "wzorgdrager",
name = "Wouter Zorgdrager",
email = "W.D.Zorgdrager@tudelft.nl",
url = url("http://www.github.com/wzorgdrager")
)
)
ThisBuild / description := "CodeFeedr provides an infrastructure on top of Apache Flink for more advanced stream architectures."
ThisBuild / licenses := List("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / homepage := Some(url("https://github.com/codefeedr/codefeedr"))
ThisBuild / version := "0.1.9"
ThisBuild / organization := "org.codefeedr"
ThisBuild / scalaVersion := scala212
parallelExecution in Test := false
/// PROJECTS
val projectPrefix = "codefeedr-"
val pluginPrefix = projectPrefix + "plugin-"
lazy val root = (project in file("."))
.settings(settings ++ noPublishSettings)
.aggregate(core,
pluginMongodb,
pluginElasticSearch,
pluginGitHub,
pluginRabbitMQ,
pluginGHTorrent,
pluginPypi,
pluginCargo,
pluginClearlyDefined,
pluginJSON,
pluginMaven,
pluginnpm
)
lazy val core = (project in file("codefeedr-core"))
.settings(
name := projectPrefix + "core",
settings,
assemblySettings,
unmanagedBase := baseDirectory.value / "../lib",
libraryDependencies ++= commonDependencies ++ Seq(
// JSONBuffer
dependencies.json4s,
dependencies.jackson,
dependencies.json4sExt,
// Http
dependencies.httpj,
// KafkaBuffer
dependencies.kafkaClient,
dependencies.flinkKafka,
// RedisKeyManager
dependencies.redis,
// Schema exposure
dependencies.zookeeper,
// BSON serialization
dependencies.mongo,
// Kryo serialization
dependencies.kryoChill,
// Avro schema exposure
dependencies.avro,
// Embedded redis to test key management
dependencies.embeddedRedis,
// Embedded kafka for integration tests
dependencies.embeddedKafka,
// ZK schema registration
dependencies.avro4s
)
)
lazy val pluginMongodb = (project in file("codefeedr-plugins/codefeedr-mongodb"))
.settings(
name := pluginPrefix + "mongodb",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.mongo,
dependencies.embeddedMongo
)
)
.dependsOn(core)
lazy val pluginElasticSearch = (project in file("codefeedr-plugins/codefeedr-elasticsearch"))
.settings(
name := pluginPrefix + "elasticsearch",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.flinkElasticSearch
)
)
.dependsOn(core)
lazy val pluginGitHub = (project in file("codefeedr-plugins/codefeedr-github"))
.settings(
name := pluginPrefix + "github",
description := "GitHub plugin",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.httpj,
dependencies.json4s,
dependencies.jackson,
dependencies.json4sExt
)
)
.dependsOn(core)
lazy val pluginRabbitMQ = (project in file("codefeedr-plugins/codefeedr-rabbitmq"))
.settings(
name := pluginPrefix + "rabbitmq",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.flinkRabbitMQ,
//dependencies.embeddedRabbitMQ
)
)
.dependsOn(core)
lazy val pluginGHTorrent = (project in file("codefeedr-plugins/codefeedr-ghtorrent"))
.settings(
name := pluginPrefix + "ghtorrent",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.flinkRabbitMQ,
//dependencies.embeddedRabbitMQ
)
).dependsOn(core)
lazy val pluginPypi = (project in file("codefeedr-plugins/codefeedr-pypi"))
.settings(
name := pluginPrefix + "pypi",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
)
).dependsOn(core)
lazy val pluginCargo = (project in file("codefeedr-plugins/codefeedr-cargo"))
.settings(
name := pluginPrefix + "cargo",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.flinkTablePlanner,
dependencies.spray
)
).dependsOn(core)
lazy val pluginClearlyDefined = (project in file("codefeedr-plugins/codefeedr-clearlydefined"))
.settings(
name := pluginPrefix + "clearlydefined",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.flinkTablePlanner
)
).dependsOn(core, pluginMaven)
lazy val pluginJSON = (project in file("codefeedr-plugins/codefeedr-json"))
.settings(
name := pluginPrefix + "json",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
)
).dependsOn(core)
lazy val pluginMaven = (project in file("codefeedr-plugins/codefeedr-maven"))
.settings(
name := pluginPrefix + "maven",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.flinkTablePlanner
)
).dependsOn(core)
lazy val pluginnpm = (project in file("codefeedr-plugins/codefeedr-npm"))
.settings(
name := pluginPrefix + "npm",
settings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.flinkTablePlanner
)
).dependsOn(core)
lazy val dependencies =
new {
val flinkVersion = "1.9.1"
val json4sVersion = "3.6.4"
val log4jVersion = "2.11.0"
val log4jScalaVersion = "11.0"
val loggingApi = "org.apache.logging.log4j" % "log4j-api" % log4jVersion
val loggingCore = "org.apache.logging.log4j" % "log4j-core" % log4jVersion % Runtime
val loggingScala = "org.apache.logging.log4j" %% "log4j-api-scala" % log4jScalaVersion
val flink = "org.apache.flink" %% "flink-scala" % flinkVersion % Provided
val flinkStreaming = "org.apache.flink" %% "flink-streaming-scala" % flinkVersion % Provided
val flinkKafka = "org.apache.flink" %% "flink-connector-kafka" % flinkVersion
val flinkRuntimeWeb = "org.apache.flink" %% "flink-runtime-web" % flinkVersion % Provided
val flinkElasticSearch = "org.apache.flink" %% "flink-connector-elasticsearch6" % flinkVersion
val flinkRabbitMQ = "org.apache.flink" %% "flink-connector-rabbitmq" % flinkVersion
val redis = "net.debasishg" %% "redisclient" % "3.6"
val kafkaClient = "org.apache.kafka" % "kafka-clients" % "2.4.0"
val zookeeper = "org.apache.zookeeper" % "zookeeper" % "3.4.9"
val json4s = "org.json4s" %% "json4s-scalap" % json4sVersion
val jackson = "org.json4s" %% "json4s-jackson" % json4sVersion
val json4sExt = "org.json4s" %% "json4s-ext" % json4sVersion
val mongo = "org.mongodb.scala" %% "mongo-scala-driver" % "2.3.0"
val httpj = "org.scalaj" %% "scalaj-http" % "2.4.0"
val kryoChill = "com.twitter" %% "chill" % "0.9.1"
val scalactic = "org.scalactic" %% "scalactic" % "3.0.1" % Test
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5" % Test
val scalamock = "org.scalamock" %% "scalamock" % "4.1.0" % Test
val mockito = "org.mockito" % "mockito-all" % "1.10.19" % Test
val embeddedRedis = "com.github.sebruck" %% "scalatest-embedded-redis" % "0.3.0" % Test
val embeddedKafka = "io.github.embeddedkafka" %% "embedded-kafka" % "2.4.0" % Test
val embeddedMongo = "com.github.simplyscala" %% "scalatest-embedmongo" % "0.2.4" % Test
//val embeddedRabbitMQ = "io.arivera.oss" %% "embedded-rabbitmq" % "1.3.0" % Test
val avro = "org.apache.avro" % "avro" % "1.8.2"
val avro4s = "com.sksamuel.avro4s" %% "avro4s-core" % "3.1.1"
val flinkTablePlanner = "org.apache.flink" %% "flink-table-planner" % flinkVersion
val spray = "io.spray" %% "spray-json" % "1.3.4"
}
lazy val commonDependencies = Seq(
dependencies.flink,
dependencies.flinkStreaming,
dependencies.loggingApi,
dependencies.loggingCore,
dependencies.loggingScala,
dependencies.scalactic,
dependencies.scalatest,
dependencies.scalamock,
dependencies.mockito
)
// SETTINGS
lazy val settings = commonSettings
lazy val commonSettings = Seq(
test in assembly := {},
scalacOptions ++= compilerOptions,
resolvers ++= Seq(
"confluent" at "https://packages.confluent.io/maven/",
"Apache Development Snapshot Repository" at "https://repository.apache.org/content/repositories/snapshots/",
"Artima Maven Repository" at "https://repo.artima.com/releases",
Resolver.mavenLocal,
Resolver.jcenterRepo
),
publishMavenStyle in ThisBuild := true,
publishTo in ThisBuild := Some(
if (version.value.trim.endsWith("SNAPSHOT"))
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
),
ThisBuild / pomIncludeRepository := { _ => false },
crossScalaVersions := supportedScalaVersions
)
lazy val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false,
// sbt-pgp's publishSigned task needs this defined even though it is not publishing.
publishTo := Some(Resolver.file("Unused transient repository", file("target/unusedrepo"))),
crossScalaVersions := Nil
)
lazy val compilerOptions = Seq(
// "-unchecked",
// "-feature",
// "-language:existentials",
// "-language:higherKinds",
// "-language:implicitConversions",
// "-language:postfixOps",
// "-deprecation",
"-encoding",
"utf8"
)
lazy val assemblySettings = Seq(
assemblyJarName in assembly := name.value + ".jar",
test in assembly := {},
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case "log4j.properties" => MergeStrategy.first
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
)
// MAKING FLINK WORK
// make run command include the provided dependencies
Compile / run := Defaults.runTask(Compile / fullClasspath,
Compile / run / mainClass,
Compile / run / runner
).evaluated
// stays inside the sbt console when we press "ctrl-c" while a Flink programme executes with "run" or "runMain"
Compile / run / fork := true
Global / cancelable := true
// exclude Scala library from assembly
assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeScala = false)