-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.sbt
206 lines (186 loc) · 6.79 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
import dependencies._
lazy val NexusReleases = "Sonatype Releases" at "https://s01.oss.sonatype.org/content/repositories/releases"
lazy val NexusSnapshots = "Sonatype Snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots"
lazy val commonSettings = List(
scalacOptions ++= commonScalacOptions,
scalaVersion := "2.12.15",
organization := "org.ergoplatform",
version := "1.3.0",
resolvers ++= Seq(
Resolver.sonatypeRepo("public"),
Resolver.sonatypeRepo("snapshots"),
NexusReleases,
NexusSnapshots
),
assembly / test := {},
assembly / assemblyMergeStrategy := {
case "logback.xml" => MergeStrategy.first
case "module-info.class" => MergeStrategy.discard
case "META-INF/intellij-compat.json" => MergeStrategy.last
case other if other.contains("io.netty.versions") => MergeStrategy.first
case other if other.contains("scala") => MergeStrategy.first
case other if other.contains("derevo") => MergeStrategy.last
case other => (assembly / assemblyMergeStrategy).value(other)
},
libraryDependencies ++= dependencies.Testing ++ dependencies.CompilerPlugins,
ThisBuild / evictionErrorLevel := Level.Info
)
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", "/var/log/dex-backend")
)
lazy val commonScalacOptions = List(
"-deprecation",
"-encoding",
"UTF-8",
"-language:higherKinds",
"-language:postfixOps",
"-language:implicitConversions",
"-feature",
"-unchecked",
"-Xfuture",
"-Yno-adapted-args",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Ypartial-unification"
)
lazy val allConfigDependency = "compile->compile;test->test"
lazy val dexBackend = project
.in(file("."))
.withId("ergo-dex-backend")
.settings(commonSettings)
.settings(moduleName := "ergo-dex-backend", name := "ErgoDexBackend")
.aggregate(
core,
cache,
httpCache,
db,
http,
utxoTracker,
matcher,
ordersExecutor,
ammExecutor,
poolResolver,
marketsIndex,
marketsApi,
dexTools,
graphite
)
lazy val core = utils
.mkModule("dex-core", "DexCore")
.settings(commonSettings)
.settings(
libraryDependencies ++=
Ergo ++
Cats ++
Tofu ++
Derevo ++
Magnolia ++
Fs2 ++
JawnFs2 ++
Circe ++
Typing ++
Config ++
Kafka ++
TapirCore ++
SttpCore ++
SttpClientFs2 ++
ScodecCore ++
Monocle ++
Enums
)
lazy val cache = utils
.mkModule("cache", "Cache")
.settings(commonSettings, libraryDependencies ++= Redis ++ Scodec)
.dependsOn(core % allConfigDependency)
lazy val httpCache = utils
.mkModule("http-cache", "HttpCache")
.settings(commonSettings, libraryDependencies ++= TapirHttp4s)
.dependsOn(Seq(cache, marketsIndex).map(_ % allConfigDependency): _*)
lazy val db = utils
.mkModule("db", "Db")
.settings(commonSettings, libraryDependencies ++= Db)
.dependsOn(core % allConfigDependency)
lazy val http = utils
.mkModule("http", "Http")
.settings(commonSettings, libraryDependencies ++= Tapir ++ TapirHttp4s)
.dependsOn(core % allConfigDependency)
lazy val utxoTracker = utils
.mkModule("utxo-tracker", "UtxoTracker")
.settings(commonSettings)
.settings(dockerBaseImage := "openjdk:11-jre-slim")
.settings(assembly / mainClass := Some("org.ergoplatform.dex.tracker.App"))
.settings(nativePackagerSettings("utxo-tracker"))
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
.dependsOn(Seq(core, cache).map(_ % allConfigDependency): _*)
lazy val matcher = utils
.mkModule("dex-matcher", "DexMatcher")
.settings(commonSettings)
.settings(assembly / mainClass := Some("org.ergoplatform.dex.matcher.App"))
.settings(nativePackagerSettings("dex-matcher"))
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
.dependsOn(Seq(core, db).map(_ % allConfigDependency): _*)
lazy val ordersExecutor = utils
.mkModule("orders-executor", "OrdersExecutor")
.settings(commonSettings)
.settings(
assembly / mainClass := Some("org.ergoplatform.dex.executor.orders.App"),
libraryDependencies ++= SttpClientCE
)
.settings(nativePackagerSettings("orders-executor"))
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
.dependsOn(Seq(core, http).map(_ % allConfigDependency): _*)
lazy val ammExecutor = utils
.mkModule("amm-executor", "AmmExecutor")
.settings(commonSettings)
.settings(dockerBaseImage := "openjdk:11-jre-slim")
.settings(
assembly / mainClass := Some("org.ergoplatform.dex.executor.amm.App"),
libraryDependencies ++= SttpClientCE
)
.settings(nativePackagerSettings("amm-executor"))
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
.dependsOn(Seq(core, http).map(_ % allConfigDependency): _*)
lazy val poolResolver = utils
.mkModule("pool-resolver", "PoolResolver")
.settings(commonSettings)
.settings(dockerBaseImage := "openjdk:11-jre-slim")
.settings(
assembly / mainClass := Some("org.ergoplatform.dex.resolver.App"),
libraryDependencies ++= RocksDB
)
.settings(nativePackagerSettings("pool-resolver"))
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
.dependsOn(Seq(core, http).map(_ % allConfigDependency): _*)
lazy val marketsIndex = utils
.mkModule("markets-index", "MarketsIndex")
.settings(commonSettings)
.settings(assembly / mainClass := Some("org.ergoplatform.dex.index.App"))
.settings(nativePackagerSettings("markets-index"))
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
.dependsOn(Seq(core, db, utxoTracker, graphite).map(_ % allConfigDependency): _*)
lazy val marketsApi = utils
.mkModule("markets-api", "MarketsApi")
.settings(commonSettings)
.settings(
assembly / mainClass := Some("org.ergoplatform.dex.markets.App"),
libraryDependencies ++= TapirDocs ++ Http4sServer ++ SttpClientCE
)
.settings(nativePackagerSettings("markets-api"))
.enablePlugins(JavaAppPackaging, UniversalPlugin, DockerPlugin)
.dependsOn(Seq(core, db, http, httpCache, graphite).map(_ % allConfigDependency): _*)
lazy val dexTools = utils
.mkModule("dex-tools", "DexTools")
.settings(commonSettings)
.settings(libraryDependencies ++= OkHttp)
.dependsOn(Seq(core, utxoTracker, ammExecutor).map(_ % allConfigDependency): _*)
lazy val graphite = utils
.mkModule("graphite", "Graphite")
.settings(commonSettings)
.settings(libraryDependencies ++= Tofu ++ Cats ++ Derevo ++ TapirHttp4s)