-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
405 lines (390 loc) · 17.8 KB
/
build.sbt
File metadata and controls
405 lines (390 loc) · 17.8 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
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 QuineSettings._
import Dependencies._
addCommandAlias("scala212", "++" + scalaV212)
addCommandAlias("scala213", "++" + scalaV213)
addCommandAlias("fixall", "; scalafixAll; scalafmtAll; scalafmtSbt")
//ThisBuild / evictionErrorLevel := Level.Warn
// Core streaming graph interpreter
lazy val `quine-core`: Project = project
.settings(commonSettings)
.settings(`scala 2.12 to 2.13`)
.settings(
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % shapelessV,
"com.google.guava" % "guava" % guavaV,
"org.scala-lang.modules" %% "scala-java8-compat" % (if (scalaVersion.value == scalaV212) "0.9.1" else "1.0.2"),
"org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatV,
"com.typesafe.akka" %% "akka-actor" % akkaV,
"com.typesafe.akka" %% "akka-stream" % akkaV,
"com.typesafe.akka" %% "akka-slf4j" % akkaV,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingV,
"io.dropwizard.metrics" % "metrics-core" % dropwizardMetricsV,
"io.circe" %% "circe-parser" % circeV,
"org.msgpack" % "msgpack-core" % msgPackV,
"org.apache.commons" % "commons-text" % commonsTextV,
"commons-codec" % "commons-codec" % commonsCodecV,
"com.47deg" %% "memeid4s" % memeIdV,
// Testing
"org.scalatest" %% "scalatest" % scalaTestV % Test,
"org.scalacheck" %% "scalacheck" % scalaCheckV % Test,
"org.scalatestplus" %% "scalacheck-1-17" % scalaTestScalaCheckV % Test,
"com.softwaremill.diffx" %% "diffx-scalatest-should" % "0.9.0" % Test,
"ch.qos.logback" % "logback-classic" % logbackV % Test,
"commons-io" % "commons-io" % commonsIoV % Test,
"org.typelevel" %% "cats-core" % catsV,
"org.typelevel" %% "cats-effect" % catsEffectV
),
// Compile different files depending on scala version
Compile / unmanagedSourceDirectories += {
val sourceDir = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => sourceDir / "scala-2.13"
case _ => sourceDir / "scala-2.12"
}
}
)
.enablePlugins(BuildInfoPlugin, FlatcPlugin)
.settings(
buildInfoOptions := Seq(BuildInfoOption.BuildTime),
buildInfoKeys := Seq[BuildInfoKey](
version,
git.gitHeadCommit,
git.gitUncommittedChanges,
git.gitHeadCommitDate,
BuildInfoKey.action("javaVmName")(scala.util.Properties.javaVmName),
BuildInfoKey.action("javaVendor")(scala.util.Properties.javaVendor),
BuildInfoKey.action("javaVersion")(scala.util.Properties.javaVersion)
),
buildInfoPackage := "com.thatdot.quine"
)
// MapDB implementation of a Quine persistor
lazy val `quine-mapdb-persistor`: Project = project
.settings(commonSettings)
.settings(`scala 2.12 to 2.13`)
.dependsOn(`quine-core` % "compile->compile;test->test")
.settings(
/* `net.jpountz.lz4:lz4` was moved to `org.lz4:lz4-java`, but MapDB hasn't
* adapted to this change quickly. However, since other parts of the Java
* ecosystem _have_ (example: `akka-stream kafka`), we need to exclude the
* bad JAR and explicitly pull in the good one.
*/
libraryDependencies ++= Seq(
("org.mapdb" % "mapdb" % mapDbV).exclude("net.jpountz.lz4", "lz4"),
"org.lz4" % "lz4-java" % lz4JavaV
)
)
// RocksDB implementation of a Quine persistor
lazy val `quine-rocksdb-persistor`: Project = project
.settings(commonSettings)
.settings(`scala 2.12 to 2.13`)
.dependsOn(`quine-core` % "compile->compile;test->test")
.settings(
libraryDependencies ++= Seq(
"org.rocksdb" % "rocksdbjni" % rocksdbV
)
)
// Cassandra implementation of a Quine persistor
lazy val `quine-cassandra-persistor`: Project = project
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.settings(commonSettings)
.settings(`scala 2.12 to 2.13`)
.dependsOn(`quine-core` % "compile->compile;it->test")
.enablePlugins(spray.boilerplate.BoilerplatePlugin)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsV,
"com.datastax.oss" % "java-driver-query-builder" % cassandraClientV exclude ("com.github.stephenc.jcip", "jcip-annotations"),
"software.aws.mcs" % "aws-sigv4-auth-cassandra-java-driver-plugin" % "4.0.9" exclude ("com.github.stephenc.jcip", "jcip-annotations"),
"software.amazon.awssdk" % "sts" % awsSdkV,
"com.github.nosan" % "embedded-cassandra" % embeddedCassandraV % IntegrationTest
)
)
// Parser and interepreter for a subset of [Gremlin](https://tinkerpop.apache.org/gremlin.html)
lazy val `quine-gremlin`: Project = project
.settings(commonSettings)
.settings(`scala 2.12 to 2.13`)
.dependsOn(`quine-core`, `quine-mapdb-persistor` % "test->test")
.settings(
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-parser-combinators" % scalaParserCombinatorsV,
"org.apache.commons" % "commons-text" % commonsTextV,
"org.scalatest" %% "scalatest" % scalaTestV % Test
)
)
// Compiler for compiling [Cypher](https://neo4j.com/docs/cypher-manual/current/) into Quine queries
lazy val `quine-cypher`: Project = project
.settings(commonSettings)
.settings(`scala 2.12`)
.dependsOn(`quine-core` % "compile->compile;test->test")
.settings(
scalacOptions += "-language:reflectiveCalls",
libraryDependencies ++= Seq(
"org.opencypher" % "expressions-9.0" % openCypherV,
"org.opencypher" % "front-end-9.0" % openCypherV,
"org.opencypher" % "parser-9.0" % openCypherV,
"org.opencypher" % "util-9.0" % openCypherV,
"org.typelevel" %% "cats-core" % catsV,
"org.scalatest" %% "scalatest" % scalaTestV % Test,
"com.typesafe.akka" %% "akka-stream-testkit" % akkaV % Test
),
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % betterMonadicForV)
)
/*
* Version 7.5.1. It is expected that `Network` and `DataSet` are available under
* A globally available `vis` object, as with
*
* ```html
* <script
* type="text/javascript"
* src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
* ></script>
* ```
*
* Thanks to [`scala-js-ts-importer`][ts-importer] which made it possible to generate
* A first pass of the facade directly from the Typescipt bindings provided with
* `vis-network` (see `Network.d.ts`).
*
* [ts-importer]: https://github.com/sjrd/scala-js-ts-importer
* [visjs]: https://github.com/visjs/vis-network
*/
lazy val `visnetwork-facade`: Project = project
.settings(commonSettings)
.settings(`scala 2.12 to 2.13`)
.enablePlugins(ScalaJSPlugin)
.settings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % scalajsDomV
)
)
// REST API specifications for `quine`-based applications
lazy val `quine-endpoints` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("quine-endpoints"))
.settings(commonSettings)
.settings(`scala 2.12 to 2.13`)
.settings(
libraryDependencies ++= Seq(
"org.endpoints4s" %%% "json-schema-generic" % endpoints4sDefaultV,
"org.endpoints4s" %%% "json-schema-circe" % "2.3.0",
"io.circe" %% "circe-core" % circeV,
"org.endpoints4s" %%% "openapi" % endpoints4sOpenapiV,
"com.lihaoyi" %% "ujson-circe" % ujsonV, // For the OpenAPI rendering
"org.scalacheck" %%% "scalacheck" % scalaCheckV % Test
)
)
.jsSettings(
// Provides an implementatAllows us to use java.time.Instant in Scala.js
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeV
)
// Quine web application
lazy val `quine-browser`: Project = project
.settings(commonSettings, slinkySettings)
.settings(`scala 2.12 to 2.13`)
.dependsOn(`quine-endpoints`.js, `visnetwork-facade`)
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % scalajsDomV,
"org.scala-js" %%% "scala-js-macrotask-executor" % scalajsMacroTaskExecutorV,
"org.endpoints4s" %%% "xhr-client" % endpoints4sXhrClientV
),
Compile / npmDevDependencies ++= Seq(
"ts-loader" -> "8.0.0",
"typescript" -> "4.9.5",
"@types/react" -> "17.0.0",
"@types/react-dom" -> "17.0.0",
"@types/node" -> "16.7.13"
),
Compile / npmDependencies ++= Seq(
"react" -> reactV,
"react-dom" -> reactV,
"es6-shim" -> "0.35.7",
"react-plotly.js" -> reactPlotlyV,
"plotly.js" -> plotlyV,
"@stoplight/elements" -> stoplightElementsV,
"mkdirp" -> "1.0.0"
),
webpackNodeArgs := nodeLegacySslIfAvailable,
// Scalajs-bundler 0.21.1 updates to webpack 5 but doesn't inform webpack that the scalajs-based file it emits is
// an entrypoint -- therefore webpack emits an error saying effectively, "no entrypoint" that we must ignore.
// This aggressively ignores all warnings from webpack, which is more than necessary, but trivially works
webpackExtraArgs := Seq("--ignore-warnings-message", "/.*/"),
fastOptJS / webpackConfigFile := Some(baseDirectory.value / "dev.webpack.config.js"),
fastOptJS / webpackDevServerExtraArgs := Seq("--inline", "--hot"),
fullOptJS / webpackConfigFile := Some(baseDirectory.value / "prod.webpack.config.js"),
Test / webpackConfigFile := Some(baseDirectory.value / "common.webpack.config.js"),
test := {},
useYarn := true,
yarnExtraArgs := Seq("--frozen-lockfile")
)
// Streaming graph application built on top of the Quine library
lazy val `quine`: Project = project
.settings(commonSettings)
.settings(`scala 2.12`)
.dependsOn(
`quine-core` % "compile->compile;test->test",
`quine-cypher`,
`quine-endpoints`.jvm % "compile->compile;test->test",
`quine-gremlin`,
`quine-cassandra-persistor`,
`quine-mapdb-persistor`,
`quine-rocksdb-persistor`
)
.settings(
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % logbackV,
"com.github.pureconfig" %% "pureconfig" % pureconfigV,
"io.circe" %% "circe-config" % "0.10.0",
"io.circe" %% "circe-generic-extras" % "0.14.3",
"io.dropwizard.metrics" % "metrics-core" % dropwizardMetricsV,
"io.dropwizard.metrics" % "metrics-jmx" % dropwizardMetricsV,
"io.dropwizard.metrics" % "metrics-jvm" % dropwizardMetricsV,
"com.github.davidb" % "metrics-influxdb" % metricsInfluxdbV,
"com.typesafe.akka" %% "akka-stream-kafka" % alpakkaKafkaV,
"org.apache.kafka" % "kafka-clients" % kafkaClientsV,
"com.lightbend.akka" %% "akka-stream-alpakka-kinesis" % alpakkaKinesisV exclude ("org.rocksdb", "rocksdbjni"),
"commons-io" % "commons-io" % commonsIoV,
"com.lightbend.akka" %% "akka-stream-alpakka-sqs" % alpakkaSQSV,
"com.lightbend.akka" %% "akka-stream-alpakka-sse" % alpakkaSseV,
"com.lightbend.akka" %% "akka-stream-alpakka-sns" % alpakkaSnsV,
"com.lightbend.akka" %% "akka-stream-alpakka-csv" % alpakkaCsvV,
"com.lightbend.akka" %% "akka-stream-alpakka-text" % alpakkaTextV,
"com.lightbend.akka" %% "akka-stream-alpakka-s3" % alpakkaS3V,
"io.github.streetcontxt" %% "kcl-akka-stream" % kclAkkaV,
"org.apache.avro" % "avro" % avroV,
"org.apache.commons" % "commons-compress" % commonsCompressV,
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % jacksonCborV,
"org.xerial.snappy" % "snappy-java" % snappyV,
// akka-http-xml is not a direct dep, but pulled in transitively by Alpakka modules above.
// All akka-http module version numbers need to match exactly, or else it
// throws at startup: "java.lang.IllegalStateException: Detected possible incompatible versions on the classpath."
"com.typesafe.akka" %% "akka-http-xml" % akkaHttpV,
"de.heikoseeberger" %% "akka-http-circe" % "1.39.2",
"io.circe" %% "circe-yaml-v12" % "0.14.3-RC3",
"org.scalatest" %% "scalatest" % scalaTestV % Test,
"org.scalatestplus" %% "scalacheck-1-17" % scalaTestScalaCheckV % Test,
"org.endpoints4s" %% "akka-http-server" % endpoints4sHttpServerV,
// WebJars (javascript dependencies masquerading as JARs)
"org.webjars" % "webjars-locator" % webjarsLocatorV,
"org.webjars.npm" % "vis-network" % visNetworkV,
"org.webjars" % "ionicons" % ioniconsV,
"org.webjars" % "jquery" % jqueryV,
"org.webjars" % "bootstrap" % bootstrapV,
"org.webjars.npm" % "sugar-date" % sugarV,
"org.webjars.bowergithub.plotly" % "plotly.js" % plotlyV,
"com.google.guava" % "guava" % guavaV,
"com.google.protobuf" % "protobuf-java" % protobufV,
"com.google.api.grpc" % "proto-google-common-protos" % protobufCommonV,
"com.github.jnr" % "jnr-posix" % jnrPosixV,
"com.github.scopt" %% "scopt" % scoptV,
"org.snakeyaml" % "snakeyaml-engine" % snakeYamlV,
"com.typesafe.akka" %% "akka-stream-testkit" % akkaV % Test
)
)
.enablePlugins(WebScalaJSBundlerPlugin)
.settings(
scalaJSProjects := Seq(`quine-browser`),
Assets / pipelineStages := Seq(scalaJSPipeline)
)
.enablePlugins(BuildInfoPlugin, Packaging, Docker, Ecr)
.settings(
startupMessage := "",
buildInfoKeys := Seq[BuildInfoKey](version, startupMessage),
buildInfoPackage := "com.thatdot.quine.app"
)
// Files under quine-docs/src/main/paradox/lib have been manually added. When we moved from
// the sbt-paradox-material-theme (see plugins.sbt) to a fork, the
// forked library omitted this directory, so those files have been
// copied from the original plugin library, however, they should _not_ be
// included in the paradox theme.
lazy val `quine-docs`: Project = {
val docJson = Def.task((Compile / paradox / sourceManaged).value / "reference" / "openapi.json")
val cypherTable1 = Def.task((Compile / paradox / sourceManaged).value / "reference" / "cypher-builtin-functions.md")
val cypherTable2 =
Def.task((Compile / paradox / sourceManaged).value / "reference" / "cypher-user-defined-functions.md")
val cypherTable3 =
Def.task((Compile / paradox / sourceManaged).value / "reference" / "cypher-user-defined-procedures.md")
val recipesFolder =
Def.task((Compile / paradox / sourceManaged).value / "recipes")
Project("quine-docs", file("quine-docs"))
.dependsOn(`quine`)
.settings(commonSettings)
.settings(`scala 2.12`)
.enablePlugins(ParadoxThatdot, GhpagesPlugin)
.settings(
projectName := "Quine",
git.remoteRepo := "git@github.com:thatdot/quine.io.git",
ghpagesBranch := "main",
ghpagesCleanSite / excludeFilter := { (f: File) =>
(ghpagesRepository.value / "CNAME").getCanonicalPath == f.getCanonicalPath
},
// Same as `paradox` itself
libraryDependencies ++= Seq(
"org.pegdown" % "pegdown" % pegdownV,
"org.parboiled" % "parboiled-java" % parboiledV
),
Compile / paradoxProperties ++= Map(
"snip.github_link" -> "false",
"snip.quine.base_dir" -> (`quine` / baseDirectory).value.getAbsolutePath,
"material.repo" -> "https://github.com/thatdot/quine",
"material.repo.type" -> "github",
"material.social" -> "https://that.re/quine-slack",
"material.social.type" -> "slack",
"include.generated.base_dir" -> (Compile / paradox / sourceManaged).value.toString,
"project.name" -> projectName.value,
"logo.link.title" -> "Quine",
"quine.jar" -> s"quine-${version.value}.jar"
),
description := "Quine is a streaming graph interpreter meant to trigger actions in real-time based on complex patterns pulled from high-volume streaming data",
Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
(Compile / runMain)
.toTask(s" com.thatdot.quine.docs.GenerateOpenApi ${docJson.value.getAbsolutePath}")
.map(_ => Seq()) // return no files because files returned are supposed to be markdown
},
// Register the `openapi.json` file here
Compile / paradox / mappings ++= List(
docJson.value -> "reference/openapi.json"
),
// ---
// Uncomment to build the recipe template pages
// then add * @ref:[Recipes](recipes/index.md) into docs.md
// ---
//Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
// val inDir: File = (quine / baseDirectory).value / "recipes"
// val outDir: File = (Compile / paradox / sourceManaged).value / "recipes"
// (Compile / runMain)
// .toTask(s" com.thatdot.quine.docs.GenerateRecipeDirectory ${inDir.getAbsolutePath} ${outDir.getAbsolutePath}")
// .map(_ => (outDir * "*.md").get)
//},
Compile / paradoxNavigationDepth := 3,
Compile / paradoxNavigationExpandDepth := Some(3),
paradoxRoots := List("index.html", "docs.html", "about.html", "download.html"),
Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
(Compile / runMain)
.toTask(
List(
" com.thatdot.quine.docs.GenerateCypherTables",
cypherTable1.value.getAbsolutePath,
cypherTable2.value.getAbsolutePath,
cypherTable3.value.getAbsolutePath
).mkString(" ")
)
.map(_ => Nil) // files returned are included, not top-level
},
Compile / paradoxMaterialTheme ~= {
_.withCustomStylesheet("assets/quine.css")
.withLogo("assets/images/quine_logo.svg")
.withColor("white", "quine-blue")
.withFavicon("assets/images/favicon.svg")
},
Compile / overlayDirectory := (`paradox-overlay` / baseDirectory).value
)
}
lazy val `paradox-overlay`: Project = project
// Spurious warnings
Global / excludeLintKeys += `quine-docs` / Paradox / paradoxNavigationExpandDepth
Global / excludeLintKeys += `quine-docs` / Paradox / paradoxNavigationDepth
Global / excludeLintKeys += `quine-browser` / webpackNodeArgs
Global / excludeLintKeys += `quine-browser` / webpackExtraArgs