forked from lichess-org/lila
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
469 lines (386 loc) · 11 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
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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
import com.typesafe.sbt.packager.Keys.{ bashScriptExtraDefines, scriptClasspath }
import play.sbt.PlayCommands
import play.sbt.PlayInternalKeys.playDependencyClasspath
import play.sbt.routes.RoutesKeys
import BuildSettings.*
import Dependencies.*
lazy val root = Project("lila", file("."))
.enablePlugins(JavaServerAppPackaging, RoutesCompiler)
.dependsOn(api)
.aggregate(api)
.settings(buildSettings)
.settings(scalacOptions ++= Seq("-deprecation"))
organization := "org.lichess"
Compile / run / fork := true
javaOptions ++= Seq("-Xms64m", "-Xmx512m", "-Dlogger.file=conf/logger.dev.xml")
// shorter prod classpath
scriptClasspath := Seq("*")
Compile / resourceDirectory := baseDirectory.value / "conf"
// the following settings come from the PlayScala plugin, which I removed
shellPrompt := PlayCommands.playPrompt
// all dependencies from outside the project (all dependency jars)
playDependencyClasspath := (Runtime / externalDependencyClasspath).value
// playCommonClassloader := PlayCommands.playCommonClassloaderTask.value
// playCompileEverything := PlayCommands.playCompileEverythingTask.value.asInstanceOf[Seq[Analysis]]
ivyLoggingLevel := UpdateLogging.DownloadOnly
Compile / mainClass := Some("lila.app.Lila")
// Adds the Play application directory to the command line args passed to Play
bashScriptExtraDefines += "addJava \"-Duser.dir=$(realpath \"$(cd \"${app_home}/..\"; pwd -P)\" $(is_cygwin && echo \"fix\"))\"\n"
// by default, compile any routes files in the root named "routes" or "*.routes"
Compile / RoutesKeys.routes / sources ++= {
val dirs = (Compile / unmanagedResourceDirectories).value
(dirs * "routes").get ++ (dirs * "*.routes").get
}
target := baseDirectory.value / "target"
Compile / sourceDirectory := baseDirectory.value / "app"
Test / sourceDirectory := baseDirectory.value / "test"
Compile / scalaSource := baseDirectory.value / "app"
Test / scalaSource := baseDirectory.value / "test"
Universal / sourceDirectory := baseDirectory.value / "dist"
// cats-parse v1.0.0 is the same as v0.3.1, so this is safe
ThisBuild / libraryDependencySchemes ++= Seq(
"org.typelevel" %% "cats-parse" % VersionScheme.Always
)
// format: off
libraryDependencies ++= akka.bundle ++ playWs.bundle ++ macwire.bundle ++ Seq(
play.json, play.server, play.netty, play.logback,
chess, compression, scalalib, hasher,
reactivemongo.driver, /* reactivemongo.kamon, */ maxmind, prismic, scalatags,
kamon.core, kamon.influxdb, kamon.metrics, kamon.prometheus,
scaffeine, caffeine, lettuce, uaparser, nettyTransport, reactivemongo.shaded
) ++ tests.bundle
lazy val modules = Seq(
common, db, rating, user, security, hub, socket,
msg, notifyModule, i18n, game, bookmark, search,
gameSearch, timeline, forum, forumSearch, team, teamSearch,
analyse, mod, round, pool, lobby, setup,
importer, gathering, tournament, simul, relation, report, pref,
evaluation, chat, puzzle, tv, coordinate, blog,
history, video, shutup, push, appeal, mailer,
playban, insight, perfStat, irc, challenge,
study, studySearch, fishnet, explorer, learn, plan,
event, coach, practice, evalCache, irwin,
activity, relay, streamer, bot, clas, swiss, storm, racer,
ublog, tutor, opening
)
lazy val moduleRefs = modules map projectToRef
lazy val moduleCPDeps = moduleRefs map { sbt.ClasspathDependency(_, None) }
lazy val api = module("api",
moduleCPDeps,
Seq(play.api, play.json, hasher, kamon.core, kamon.influxdb, lettuce) ++ reactivemongo.bundle ++ tests.bundle
).settings(
Runtime / aggregate := false,
Test / aggregate := true // Test <: Runtime
) aggregate (moduleRefs: _*)
lazy val i18n = module("i18n",
Seq(db, hub),
tests.bundle ++ Seq(scalatags)
).settings(
Compile / sourceGenerators += Def.task {
MessageCompiler(
sourceDir = new File("translation/source"),
destDir = new File("translation/dest"),
dbs = "site arena emails learn activity coordinates study class contact patron coach broadcast streamer tfa settings preferences team perfStat search tourname faq lag swiss puzzle puzzleTheme challenge storm ublog insight keyboardMove timeago oauthScope dgt voiceCommands onboarding".split(' ').toList,
compileTo = (Compile / sourceManaged).value
)
}.taskValue
)
lazy val puzzle = module("puzzle",
Seq(history, pref),
reactivemongo.bundle ++ tests.bundle
)
lazy val storm = module("storm",
Seq(puzzle),
reactivemongo.bundle
)
lazy val racer = module("racer",
Seq(storm, room),
reactivemongo.bundle
)
lazy val video = module("video",
Seq(user),
reactivemongo.bundle ++ macwire.bundle
)
lazy val coach = module("coach",
Seq(notifyModule),
reactivemongo.bundle
)
lazy val streamer = module("streamer",
Seq(notifyModule),
reactivemongo.bundle
)
lazy val coordinate = module("coordinate",
Seq(user),
reactivemongo.bundle ++ macwire.bundle
)
lazy val blog = module("blog",
Seq(timeline),
Seq(prismic) ++ tests.bundle ++ reactivemongo.bundle
)
lazy val ublog = module("ublog",
Seq(timeline),
Seq(bloomFilter) ++ tests.bundle ++ reactivemongo.bundle
)
lazy val evaluation = module("evaluation",
Seq(analyse),
tests.bundle ++ reactivemongo.bundle
)
lazy val common = module("common",
Seq(),
Seq(
scalalib, galimatias, chess,
kamon.core, scalatags, scaffeine, apacheText
) ++ tests.bundle ++ reactivemongo.bundle ++ flexmark.bundle
)
lazy val rating = module("rating",
Seq(i18n, memo),
reactivemongo.bundle ++ tests.bundle ++ Seq(apacheMath)
).dependsOn(common % "test->test")
lazy val perfStat = module("perfStat",
Seq(game),
reactivemongo.bundle
)
lazy val history = module("history",
Seq(game),
Seq(scalatags) ++ reactivemongo.bundle
)
lazy val db = module("db",
Seq(common),
Seq(hasher) ++ macwire.bundle ++ reactivemongo.bundle
)
lazy val memo = module("memo",
Seq(db),
Seq(scaffeine) ++ reactivemongo.bundle ++ playWs.bundle
)
lazy val search = module("search",
Seq(hub),
playWs.bundle
)
lazy val chat = module("chat",
Seq(security),
Seq(scalatags) ++ reactivemongo.bundle
)
lazy val room = module("room",
Seq(chat),
Seq(lettuce) ++ reactivemongo.bundle
)
lazy val timeline = module("timeline",
Seq(team),
reactivemongo.bundle
)
lazy val event = module("event",
Seq(user),
Seq(scalatags) ++ reactivemongo.bundle
)
lazy val mod = module("mod",
Seq(evaluation, perfStat, tournament, swiss, report),
reactivemongo.bundle
)
lazy val user = module("user",
Seq(rating, socket),
Seq(hasher, galimatias) ++ tests.bundle ++ playWs.bundle ++ reactivemongo.bundle
)
lazy val game = module("game",
Seq(chat),
Seq(compression) ++ tests.bundle ++ reactivemongo.bundle
)
lazy val gameSearch = module("gameSearch",
Seq(game, search),
reactivemongo.bundle
)
lazy val tv = module("tv",
Seq(round),
Seq(hasher) ++ reactivemongo.bundle
)
lazy val bot = module("bot",
Seq(challenge),
reactivemongo.bundle
)
lazy val analyse = module("analyse",
Seq(notifyModule, evalCache),
tests.bundle ++ reactivemongo.bundle
)
lazy val round = module("round",
Seq(history, room, fishnet, playban),
Seq(scalatags, hasher, kamon.core, lettuce) ++ reactivemongo.bundle ++ tests.bundle
)
lazy val pool = module("pool",
Seq(playban),
reactivemongo.bundle
)
lazy val activity = module("activity",
Seq(pool, puzzle, simul, practice, ublog),
reactivemongo.bundle
)
lazy val lobby = module("lobby",
Seq(timeline, pool),
Seq(lettuce) ++ reactivemongo.bundle
)
lazy val setup = module("setup",
Seq(lobby),
reactivemongo.bundle
)
lazy val importer = module("importer",
Seq(round),
tests.bundle ++ reactivemongo.bundle
)
lazy val insight = module("insight",
Seq(round),
Seq(scalatags) ++ reactivemongo.bundle
)
lazy val tutor = module("tutor",
Seq(insight),
tests.bundle ++ reactivemongo.bundle
)
lazy val opening = module("opening",
Seq(game),
tests.bundle
)
lazy val gathering = module("gathering",
Seq(history),
tests.bundle
)
lazy val tournament = module("tournament",
Seq(gathering, round),
Seq(scalatags, lettuce) ++ tests.bundle ++ reactivemongo.bundle
)
lazy val swiss = module("swiss",
Seq(gathering, round),
Seq(scalatags, lettuce) ++ reactivemongo.bundle ++ tests.bundle
)
lazy val simul = module("simul",
Seq(gathering, round),
Seq(lettuce) ++ reactivemongo.bundle
)
lazy val fishnet = module("fishnet",
Seq(analyse),
Seq(lettuce) ++ tests.bundle ++ reactivemongo.bundle
)
lazy val irwin = module("irwin",
Seq(mod, insight),
reactivemongo.bundle
)
lazy val oauth = module("oauth",
Seq(user),
reactivemongo.bundle
)
lazy val security = module("security",
Seq(irc, oauth, mailer),
Seq(maxmind, hasher, uaparser) ++ tests.bundle ++ reactivemongo.bundle
)
lazy val shutup = module("shutup",
Seq(relation),
tests.bundle ++ reactivemongo.bundle
)
lazy val challenge = module("challenge",
Seq(setup),
Seq(scalatags, lettuce) ++ tests.bundle ++ reactivemongo.bundle
)
lazy val study = module("study",
Seq(explorer),
Seq(scalatags, lettuce) ++ tests.bundle ++ reactivemongo.bundle
).dependsOn(common % "test->test")
lazy val relay = module("relay",
Seq(study),
tests.bundle ++ Seq(galimatias) ++ reactivemongo.bundle
)
lazy val studySearch = module("studySearch",
Seq(study, search),
reactivemongo.bundle
)
lazy val learn = module("learn",
Seq(user),
reactivemongo.bundle
)
lazy val evalCache = module("evalCache",
Seq(security),
reactivemongo.bundle
)
lazy val practice = module("practice",
Seq(study),
reactivemongo.bundle
)
lazy val playban = module("playban",
Seq(msg),
reactivemongo.bundle
)
lazy val push = module("push",
Seq(challenge),
Seq(googleOAuth) ++ reactivemongo.bundle
)
lazy val irc = module("irc",
Seq(user),
reactivemongo.bundle
)
lazy val mailer = module("mailer",
Seq(user),
reactivemongo.bundle ++ Seq(scalatags, hasher, play.mailer)
)
lazy val plan = module("plan",
Seq(security),
tests.bundle ++ reactivemongo.bundle
)
lazy val relation = module("relation",
Seq(game, pref),
reactivemongo.bundle
)
lazy val pref = module("pref",
Seq(user),
reactivemongo.bundle
)
lazy val msg = module("msg",
Seq(shutup, notifyModule),
reactivemongo.bundle
)
lazy val forum = module("forum",
Seq(mod),
reactivemongo.bundle
)
lazy val forumSearch = module("forumSearch",
Seq(forum, search),
reactivemongo.bundle
)
lazy val team = module("team",
Seq(forum),
reactivemongo.bundle
)
lazy val teamSearch = module("teamSearch",
Seq(team, search),
reactivemongo.bundle
)
lazy val clas = module("clas",
Seq(msg, puzzle),
reactivemongo.bundle ++ Seq(bloomFilter)
)
lazy val bookmark = module("bookmark",
Seq(round),
reactivemongo.bundle
)
lazy val report = module("report",
Seq(playban),
reactivemongo.bundle
)
lazy val appeal = module("appeal",
Seq(user),
reactivemongo.bundle
)
lazy val explorer = module("explorer",
Seq(importer),
reactivemongo.bundle
)
lazy val notifyModule = module("notify",
Seq(relation),
reactivemongo.bundle
)
lazy val tree = module("tree",
Seq(common),
Seq()
)
lazy val socket = module("socket",
Seq(hub, memo, tree),
Seq(lettuce)
)
lazy val hub = module("hub",
Seq(common),
Seq(scaffeine)
)