-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
132 lines (116 loc) · 4.94 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
import utils._
import Dependencies._
ThisBuild / version := "0.1.0"
ThisBuild / scalaVersion := "2.13.10"
lazy val commonScalacOption = List(
"-deprecation",
"-encoding",
"UTF-8",
"-language:implicitConversions",
"-language:higherKinds",
"-language:postfixOps",
"-feature",
"-unchecked",
"-Xfatal-warnings",
"-Ymacro-annotations",
"-Ywarn-value-discard"
)
def compilerDependencies = List(CompilerPlugins.betterMonadicFor, CompilerPlugins.kindProjector)
lazy val commonSettings = Seq(
assembly / test := {},
assembly / assemblyMergeStrategy := {
case "logback.xml" => MergeStrategy.first
case "module-info.class" => MergeStrategy.discard
case other if other.contains("scala/annotation/nowarn.class") => MergeStrategy.first
case other if other.contains("scala/annotation/nowarn$.class") => MergeStrategy.first
case other if other.contains("io.netty.versions") => MergeStrategy.first
case other => (assemblyMergeStrategy in assembly).value(other)
}
)
lazy val root = (project in file("."))
.settings(name := "ergo-analytics")
.aggregate(core, streaming, indexer, graphite, cache, api, mempool, common)
lazy val core = mkModule("core", "core")
.settings(scalacOptions ++= commonScalacOption)
.settings(commonSettings)
.settings(dependencyOverrides += "org.typelevel" %% "cats-effect-kernel" % Version.ce3)
.settings(
libraryDependencies ++= compilerDependencies ++ List(
ce3,
sigma,
newtype,
refined,
refinedCats,
mouse,
kafka,
pureConfigCE,
redis,
rocksDB,
retry,
redis
) ++ tofu ++ derevo ++ enums ++ circe ++ tests ++ enums ++ doobie ++ sttp ++ scodec ++ tapir
)
lazy val streaming = mkModule("streaming", "streaming")
.settings(scalacOptions ++= commonScalacOption)
.settings(libraryDependencies ++= compilerDependencies)
.settings(commonSettings)
.dependsOn(core)
lazy val parsers = mkModule("parsers", "parsers")
.settings(libraryDependencies ++= tests)
.settings(scalacOptions ++= commonScalacOption)
.settings(libraryDependencies ++= compilerDependencies)
.settings(commonSettings)
.dependsOn(core)
lazy val api = mkModule("api", "api")
.settings(scalacOptions ++= commonScalacOption)
.settings(dockerBaseImage := "openjdk:11-jre-slim")
.settings(bashScriptExtraDefines += """addJava "-Xms2G"""")
.settings(bashScriptExtraDefines += """addJava "-Xmx4G"""")
.settings(commonSettings)
.settings(libraryDependencies ++= compilerDependencies ++ scodec ++ http4s ++ tapir ++ tests ++ List(zioInterop))
.dependsOn(common, graphite, cache)
.settings(assembly / mainClass := Some("fi.spectrum.api.Main"))
.settings(nativePackagerSettings("api"))
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
lazy val indexer = mkModule("indexer", "indexer")
.settings(scalacOptions ++= commonScalacOption)
.settings(dockerBaseImage := "openjdk:11-jre-slim")
.settings(libraryDependencies ++= compilerDependencies ++ tests ++ tofu ++ List(rocksDB))
.dependsOn(common, streaming, graphite, cache)
.settings(assembly / mainClass := Some("fi.spectrum.indexer.Main"))
.settings(nativePackagerSettings("indexer"))
.settings(commonSettings)
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
lazy val graphite = mkModule("graphite", "graphite")
.settings(scalacOptions ++= commonScalacOption)
.settings(commonSettings)
.settings(libraryDependencies ++= compilerDependencies ++ derevo ++ List(fs2IO) ++ http4s ++ tofu)
lazy val cache = mkModule("cache", "cache")
.settings(scalacOptions ++= commonScalacOption)
.settings(libraryDependencies ++= compilerDependencies ++ derevo ++ List(fs2IO) ++ tofu)
.settings(commonSettings)
.dependsOn(core, streaming)
lazy val mempool = mkModule("mempool", "mempool")
.settings(scalacOptions ++= commonScalacOption)
.settings(dockerBaseImage := "openjdk:11-jre-slim")
.settings(libraryDependencies ++= compilerDependencies ++ tests ++ tofu)
.dependsOn(core, common, streaming, graphite, cache)
.settings(assembly / mainClass := Some("fi.spectrum.mempool.Main"))
.settings(nativePackagerSettings("mempool"))
.settings(commonSettings)
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
lazy val common = mkModule("common", "common")
.settings(scalacOptions ++= commonScalacOption)
.settings(commonSettings)
.settings(libraryDependencies ++= compilerDependencies)
.dependsOn(parsers)
def nativePackagerSettings(moduleSig: String) = List(
Universal / name := name.value,
UniversalDocs / name := (Universal / name).value,
UniversalSrc / name := (Universal / name).value,
Universal / packageName := packageName.value,
Universal / mappings += ((Compile / packageBin) map { p =>
p -> s"lib/$moduleSig.jar"
}).value,
dockerExposedVolumes := Seq(s"/var/lib/$moduleSig", "/opt/docker/logs/")
)