-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
284 lines (243 loc) · 10.5 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
name := "fb_bot_project"
ThisBuild / organization := "yakushev"
ThisBuild / version := "0.7.0"
ThisBuild / scalaVersion := "2.12.15"
/**
* projects:
* fbparser - parser of fonbet data, save into db using db, transitive depends on common through db
* tbot - telegram bot that send recomendations to users, transitive depends on common through db
* db - library for work with postgres db, depends on common
* common - common case classes and code
*/
lazy val global = project
.in(file("."))
.settings(commonSettings)
//.disablePlugins(AssemblyPlugin)
.aggregate(
common,
db,
fbparser,
tbot
)
lazy val common = (project in file("common"))
.settings(
name := "common",
commonSettings,
libraryDependencies ++= dependenciesCommon.tsConfig
)
lazy val db = (project in file("db"))
.settings(
name := "db",
commonSettings,
libraryDependencies ++= dependenciesPg.deps
)
.dependsOn(common)
lazy val tbot = (project in file("tbot"))
.settings(
assembly / assemblyJarName := "tbot.jar",
mainClass / run := Some("app.Bot"),
name := "tbot",
commonSettings,
libraryDependencies ++= dependenciesTbot.deps
)
.dependsOn(db)
lazy val fbparser = (project in file("fbparser"))
.settings(
assembly / assemblyJarName := "fbparser.jar",
mainClass / run := Some("app.Parser"),
name := "fbparser",
commonSettings,
libraryDependencies ++= dependenciesFbParser.deps
)
.dependsOn(db)
//********************************************************************************
// Dependencies for project common.
lazy val dependenciesCommon =
new {
val tsConfig = List("com.typesafe" % "config" % "1.4.2")
}
//********************************************************************************
// Dependencies for project db.
val VersPg = new {
val zio = "2.0.16"//"2.0.0-RC6"
val pg = "42.6.0"//"42.4.0"
}
lazy val dependenciesPg =
new {
val zio = "dev.zio" %% "zio" % VersPg.zio
val zio_logging = "dev.zio" %% "zio-logging" % "2.1.14"
val zioDep = List(zio, zio_logging)
val pg_driver = Seq("org.postgresql" % "postgresql" % VersPg.pg)
val deps = pg_driver ++ zioDep
}
//********************************************************************************
// Dependencies for project fbparser.
val VersFbp = new {
val zio = "2.0.2"
val zioLog = "2.1.1"
val zioLogSlf4j = "2.1.1"
val zioSttp = "3.8.0"
val Circe = "0.14.2"
val circeOptics = "0.14.1"
val logbackvers = "1.4.1"
}
lazy val dependenciesFbParser =
new {
val logback = "ch.qos.logback" % "logback-classic" % VersFbp.logbackvers
val zio = "dev.zio" %% "zio" % VersFbp.zio
val zio_logging = "dev.zio" %% "zio-logging" % VersFbp.zioLog
val zio_logg_slf4j = "dev.zio" %% "zio-logging-slf4j" % VersFbp.zioLogSlf4j
val zio_sttp = "com.softwaremill.sttp.client3" %% "zio" % VersFbp.zioSttp
val zio_sttp_async = "com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % VersFbp.zioSttp
val zio_sttp_circe = "com.softwaremill.sttp.client3" %% "circe" % VersFbp.zioSttp
val zioDep = List(zio, zio_logging, zio_logg_slf4j, zio_sttp, zio_sttp_async, zio_sttp_circe)
val circe_libs = Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-generic",
"io.circe" %% "circe-parser",
"io.circe" %% "circe-literal"
).map(_ % VersFbp.Circe) ++ Seq("io.circe" %% "circe-optics" % VersFbp.circeOptics)
val deps =
List(logback) ++
zioDep ++
circe_libs
}
//********************************************************************************
// Dependencies for project tbot.
val VersTbot = new {
val zio = "2.0.2"
val zioTsConf = "3.0.2"
val zhttp = "2.0.0-RC11"
val zioInteropCats = "22.0.0.0"
val sttp = "3.8.0"
val bot4s = "5.6.1"
}
lazy val dependenciesTbot =
new {
val zio = "dev.zio" %% "zio" % VersTbot.zio
val zhttp = "io.d11" %% "zhttp" % VersTbot.zhttp
//val zhttp = "dev.zio" %% "zio-http" % VersTbot.ziohttp
val ZioIoCats = "dev.zio" %% "zio-interop-cats" % VersTbot.zioInteropCats
val zio_config_typesafe = "dev.zio" %% "zio-config-typesafe" % VersTbot.zioTsConf
val zioDep = List(zio, zhttp, ZioIoCats, zio_config_typesafe)
val zio_sttp = "com.softwaremill.sttp.client3" %% "zio" % VersTbot.sttp
val sttp_client_backend_zio = "com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % VersTbot.sttp
val sttpDep = List(zio_sttp, sttp_client_backend_zio)
val bot4s_core = "com.bot4s" %% "telegram-core" % VersTbot.bot4s
val bot4s_akka = "com.bot4s" %% "telegram-akka" % VersTbot.bot4s
val bot4slibs = List(bot4s_core,bot4s_akka)
val deps = zioDep ++
bot4slibs ++
sttpDep
}
//********************************************************************************
lazy val compilerOptions = Seq(
"-deprecation",
"-encoding", "utf-8",
"-explaintypes",
"-feature",
"-unchecked",
"-language:postfixOps",
"-language:higherKinds",
"-language:implicitConversions",
"-Xcheckinit",
"-Xfatal-warnings",
"-Ywarn-unused:params,-implicits"
)
lazy val commonSettings = Seq(
scalacOptions ++= compilerOptions,
resolvers ++= Seq(
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("public"),
Resolver.sonatypeRepo("releases"),
Resolver.DefaultMavenRepository,
Resolver.mavenLocal,
Resolver.bintrayRepo("websudos", "oss-releases")
)
)
addCompilerPlugin("org.scalamacros" %% "paradise" % "2.1.1" cross CrossVersion.full)
common / assembly / assemblyMergeStrategy := {
case "module-info.class"|"resources/control.conf"|"resources/mts.p12"|"resources/mts.pem" => MergeStrategy.discard
case "plugin.properties" => MergeStrategy.last
case "log4j.properties" => MergeStrategy.last
case "logback.xml" => MergeStrategy.last
case "resources/logback.xml" => MergeStrategy.last
case "resources/application.conf" => MergeStrategy.last
case "resources/reference.conf" => MergeStrategy.last
case "application.conf" => MergeStrategy.last
case PathList("application.conf") => MergeStrategy.concat
case PathList("reference.conf") => MergeStrategy.concat
//case "resources/control.conf" => MergeStrategy.discard
case "reference.conf" => MergeStrategy.concat
case "control.conf" => MergeStrategy.discard
case x if x.contains("io.netty.versions.properties") => MergeStrategy.discard
case PathList("META-INF", "services", xs @ _*) => MergeStrategy.first
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case PathList(ps @ _*) if ps.last == "module-info.class" => MergeStrategy.discard
//case "module-info.class" => MergeStrategy.discard
case x => MergeStrategy.first
}
db / assembly / assemblyMergeStrategy := {
case "module-info.class"|"resources/control.conf"|"resources/mts.p12"|"resources/mts.pem" => MergeStrategy.discard
case "plugin.properties" => MergeStrategy.last
case "log4j.properties" => MergeStrategy.last
case "logback.xml" => MergeStrategy.last
case "resources/logback.xml" => MergeStrategy.last
case "resources/application.conf" => MergeStrategy.last
case "resources/reference.conf" => MergeStrategy.last
case "application.conf" => MergeStrategy.last
case PathList("application.conf") => MergeStrategy.concat
case PathList("reference.conf") => MergeStrategy.concat
//case "resources/control.conf" => MergeStrategy.discard
case "reference.conf" => MergeStrategy.concat
case "control.conf" => MergeStrategy.discard
case x if x.contains("io.netty.versions.properties") => MergeStrategy.discard
case PathList("META-INF", "services", xs @ _*) => MergeStrategy.first
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case PathList(ps @ _*) if ps.last == "module-info.class" => MergeStrategy.discard
//case "module-info.class" => MergeStrategy.discard
case x => MergeStrategy.first
}
tbot / assembly / assemblyMergeStrategy := {
case "module-info.class"|"resources/control.conf"|"resources/mts.p12"|"resources/mts.pem" => MergeStrategy.discard
case "plugin.properties" => MergeStrategy.last
case "log4j.properties" => MergeStrategy.last
case "logback.xml" => MergeStrategy.last
case "resources/logback.xml" => MergeStrategy.last
case "resources/application.conf" => MergeStrategy.last
case "resources/reference.conf" => MergeStrategy.last
case "application.conf" => MergeStrategy.last
case PathList("application.conf") => MergeStrategy.concat
case PathList("reference.conf") => MergeStrategy.concat
//case "resources/control.conf" => MergeStrategy.discard
case "reference.conf" => MergeStrategy.concat
case "control.conf" => MergeStrategy.discard
case x if x.contains("io.netty.versions.properties") => MergeStrategy.discard
case PathList("META-INF", "services", xs @ _*) => MergeStrategy.first
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case PathList(ps @ _*) if ps.last == "module-info.class" => MergeStrategy.discard
//case "module-info.class" => MergeStrategy.discard
case x => MergeStrategy.first
}
fbparser / assembly / assemblyMergeStrategy := {
case "module-info.class"|"resources/control.conf"|"resources/mts.p12"|"resources/mts.pem" => MergeStrategy.discard
case "plugin.properties" => MergeStrategy.last
case "log4j.properties" => MergeStrategy.last
case "logback.xml" => MergeStrategy.last
case "resources/logback.xml" => MergeStrategy.last
case "resources/application.conf" => MergeStrategy.last
case "resources/reference.conf" => MergeStrategy.last
case "application.conf" => MergeStrategy.last
case PathList("application.conf") => MergeStrategy.concat
case PathList("reference.conf") => MergeStrategy.concat
//case "resources/control.conf" => MergeStrategy.discard
case "reference.conf" => MergeStrategy.concat
case "control.conf" => MergeStrategy.discard
case x if x.contains("io.netty.versions.properties") => MergeStrategy.discard
case PathList("META-INF", "services", xs @ _*) => MergeStrategy.first
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case PathList(ps @ _*) if ps.last == "module-info.class" => MergeStrategy.discard
//case "module-info.class" => MergeStrategy.discard
case x => MergeStrategy.first
}