refactor build

scapegoat
Thibault Duplessis 2019-12-07 21:23:31 -06:00
parent 02b017bb6b
commit 0006e6fc2d
2 changed files with 262 additions and 221 deletions

471
build.sbt
View File

@ -54,278 +54,309 @@ lazy val modules = Seq(
lazy val moduleRefs = modules map projectToRef
lazy val moduleCPDeps = moduleRefs map { new sbt.ClasspathDependency(_, None) }
lazy val api = module("api", moduleCPDeps)
.settings(
libraryDependencies ++= Seq(
lazy val api = module("api", moduleCPDeps, Seq(
play.api, play.json, hasher,
kamon.core, kamon.influxdb, lettuce
) ++ reactivemongo.bundle,
) ++ reactivemongo.bundle)
.settings(
aggregate in Runtime := false,
aggregate in Test := true // Test <: Runtime
) aggregate (moduleRefs: _*)
lazy val puzzle = module("puzzle", Seq(
common, memo, hub, history, db, user, rating, pref, tree, game
)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val puzzle = module("puzzle",
Seq(common, memo, hub, history, db, user, rating, pref, tree, game),
reactivemongo.bundle
)
lazy val quote = module("quote", Seq()).settings(
libraryDependencies ++= Seq(play.api)
lazy val quote = module("quote",
Seq(),
Seq()
)
lazy val video = module("video", Seq(
common, memo, hub, db, user
)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val video = module("video",
Seq(common, memo, hub, db, user),
reactivemongo.bundle
)
lazy val coach = module("coach", Seq(
common, hub, db, user, security, notifyModule
)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val coach = module("coach",
Seq(common, hub, db, user, security, notifyModule),
reactivemongo.bundle
)
lazy val streamer = module("streamer", Seq(
common, hub, db, user, notifyModule
)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val streamer = module("streamer",
Seq(common, hub, db, user, notifyModule),
reactivemongo.bundle
)
lazy val coordinate = module("coordinate", Seq(common, db)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val coordinate = module("coordinate",
Seq(common, db),
reactivemongo.bundle
)
lazy val blog = module("blog", Seq(common, memo, timeline)).settings(
libraryDependencies ++= Seq(play.api, prismic) ++ reactivemongo.bundle
lazy val blog = module("blog",
Seq(common, memo, timeline),
Seq(prismic) ++ reactivemongo.bundle
)
lazy val evaluation = module("evaluation", Seq(
common, hub, db, user, game, analyse
)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val evaluation = module("evaluation",
Seq(common, hub, db, user, game, analyse),
reactivemongo.bundle
)
lazy val common = module("common", Seq()).settings(
libraryDependencies ++= Seq(play.api, kamon.core, scalatags, jodaForms, scaffeine) ++ reactivemongo.bundle
lazy val common = module("common",
Seq(),
Seq(kamon.core, scalatags, jodaForms, scaffeine) ++ reactivemongo.bundle
)
lazy val rating = module("rating", Seq(common, db, memo)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val rating = module("rating",
Seq(common, db, memo),
reactivemongo.bundle
)
lazy val perfStat = module("perfStat", Seq(common, db, user, game, rating)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val perfStat = module("perfStat",
Seq(common, db, user, game, rating),
reactivemongo.bundle
)
lazy val history = module("history", Seq(common, db, memo, game, user)).settings(
libraryDependencies ++= Seq(play.api, scalatags) ++ reactivemongo.bundle
lazy val history = module("history",
Seq(common, db, memo, game, user),
Seq(scalatags) ++ reactivemongo.bundle
)
lazy val db = module("db", Seq(common)).settings(
libraryDependencies ++= Seq(play.api, hasher, scrimage) ++ reactivemongo.bundle
lazy val db = module("db",
Seq(common),
Seq(hasher, scrimage) ++ reactivemongo.bundle
)
lazy val memo = module("memo", Seq(common, db)).settings(
libraryDependencies ++= Seq(scaffeine, play.api) ++ reactivemongo.bundle
lazy val memo = module("memo",
Seq(common, db),
Seq(scaffeine, play.api) ++ reactivemongo.bundle
)
lazy val search = module("search", Seq(common, hub)).settings(
libraryDependencies ++= Seq(play.api)
lazy val search = module("search",
Seq(common, hub),
Seq()
)
lazy val chat = module("chat", Seq(common, db, user, security, i18n, socket)).settings(
libraryDependencies ++= Seq(play.api, scalatags) ++ reactivemongo.bundle
lazy val chat = module("chat",
Seq(common, db, user, security, i18n, socket),
Seq(scalatags) ++ reactivemongo.bundle
)
lazy val room = module("room", Seq(common, socket, chat)).settings(
libraryDependencies ++= Seq(play.api, lettuce) ++ reactivemongo.bundle
lazy val room = module("room",
Seq(common, socket, chat),
Seq(lettuce) ++ reactivemongo.bundle
)
lazy val timeline = module("timeline", Seq(common, db, game, user, hub, security, relation)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val timeline = module("timeline",
Seq(common, db, game, user, hub, security, relation),
reactivemongo.bundle
)
lazy val event = module("event", Seq(common, db, memo, i18n)).settings(
libraryDependencies ++= Seq(play.api, scalatags) ++ reactivemongo.bundle
lazy val event = module("event",
Seq(common, db, memo, i18n),
Seq(scalatags) ++ reactivemongo.bundle
)
lazy val mod = module("mod", Seq(common, db, user, hub, security, tournament, simul, game, analyse, evaluation,
report, notifyModule, history, perfStat)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val mod = module("mod",
Seq(common, db, user, hub, security, tournament, simul, game, analyse, evaluation, report, notifyModule, history, perfStat),
reactivemongo.bundle
)
lazy val user = module("user", Seq(common, memo, db, hub, rating, socket)).settings(
libraryDependencies ++= Seq(play.api, hasher) ++ reactivemongo.bundle
lazy val user = module("user",
Seq(common, memo, db, hub, rating, socket),
Seq(hasher) ++ reactivemongo.bundle
)
lazy val game = module("game", Seq(common, memo, db, hub, user, chat)).settings(
libraryDependencies ++= Seq(compression, play.api) ++ reactivemongo.bundle
lazy val game = module("game",
Seq(common, memo, db, hub, user, chat),
Seq(compression, play.api) ++ reactivemongo.bundle
)
lazy val gameSearch = module("gameSearch", Seq(common, hub, search, game)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val gameSearch = module("gameSearch",
Seq(common, hub, search, game),
reactivemongo.bundle
)
lazy val tv = module("tv", Seq(common, db, hub, socket, game, round, user)).settings(
libraryDependencies ++= Seq(play.api, hasher) ++ reactivemongo.bundle
lazy val tv = module("tv",
Seq(common, db, hub, socket, game, round, user),
Seq(hasher) ++ reactivemongo.bundle
)
lazy val bot = module("bot", Seq(common, db, hub, game, user, challenge, chat)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val bot = module("bot",
Seq(common, db, hub, game, user, challenge, chat),
reactivemongo.bundle
)
lazy val analyse = module("analyse", Seq(common, hub, game, user, notifyModule, evalCache)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val analyse = module("analyse",
Seq(common, hub, game, user, notifyModule, evalCache),
reactivemongo.bundle
)
lazy val round = module("round", Seq(
common, db, memo, hub, socket, game, user,
i18n, fishnet, pref, chat, history, playban, room
)).settings(
libraryDependencies ++= Seq(play.api, scalatags, hasher, kamon.core, lettuce) ++ reactivemongo.bundle
lazy val round = module("round",
Seq(common, db, memo, hub, socket, game, user, i18n, fishnet, pref, chat, history, playban, room),
Seq(scalatags, hasher, kamon.core, lettuce) ++ reactivemongo.bundle
)
lazy val pool = module("pool", Seq(common, game, user, playban)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val pool = module("pool",
Seq(common, game, user, playban),
reactivemongo.bundle
)
lazy val activity = module("activity", Seq(common, game, analyse, user, forum, study, pool, puzzle, tournament, practice, team)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val activity = module("activity",
Seq(common, game, analyse, user, forum, study, pool, puzzle, tournament, practice, team),
reactivemongo.bundle
)
lazy val lobby = module("lobby", Seq(
common, db, memo, hub, socket, game, user,
round, timeline, relation, playban, security, pool
)).settings(
libraryDependencies ++= Seq(play.api, lettuce) ++ reactivemongo.bundle
lazy val lobby = module("lobby",
Seq(common, db, memo, hub, socket, game, user, round, timeline, relation, playban, security, pool),
Seq(lettuce) ++ reactivemongo.bundle
)
lazy val setup = module("setup", Seq(
common, db, memo, hub, socket, game, user, lobby, pref, relation
)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val setup = module("setup",
Seq(common, db, memo, hub, socket, game, user, lobby, pref, relation),
reactivemongo.bundle
)
lazy val importer = module("importer", Seq(common, game, round)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val importer = module("importer",
Seq(common, game, round),
reactivemongo.bundle
)
lazy val insight = module(
"insight",
Seq(common, game, user, analyse, relation, pref, socket, round, security)
lazy val insight = module("insight",
Seq(common, game, user, analyse, relation, pref, socket, round, security),
Seq(scalatags) ++ reactivemongo.bundle
)
lazy val tournament = module("tournament",
Seq(common, hub, socket, game, round, security, chat, memo, quote, history, notifyModule, i18n, room),
Seq(scalatags, lettuce) ++ reactivemongo.bundle
)
lazy val simul = module("simul",
Seq(common, hub, socket, game, round, chat, memo, quote, room),
Seq(lettuce) ++ reactivemongo.bundle
)
lazy val fishnet = module("fishnet",
Seq(common, game, analyse, db, evalCache),
Seq(lettuce) ++ reactivemongo.bundle
)
lazy val irwin = module("irwin",
Seq(common, db, user, game, tournament, mod),
reactivemongo.bundle
)
lazy val oauth = module("oauth",
Seq(common, db, user),
reactivemongo.bundle
)
lazy val security = module("security",
Seq(common, hub, db, user, i18n, slack, oauth),
Seq(scalatags, maxmind, hasher) ++ reactivemongo.bundle
)
lazy val shutup = module("shutup",
Seq(common, db, hub, game, relation),
reactivemongo.bundle
)
lazy val challenge = module("challenge",
Seq(common, db, hub, setup, game, relation, pref, socket, room),
Seq(scalatags, lettuce) ++ reactivemongo.bundle
)
lazy val study = module("study",
Seq(common, db, hub, socket, game, round, importer, notifyModule, relation, evalCache, explorer, i18n, room),
Seq(scalatags, lettuce) ++ reactivemongo.bundle
)
lazy val relay = module("relay",
Seq(common, study),
Seq(scalaUri, markdown) ++ reactivemongo.bundle
)
lazy val studySearch = module("studySearch",
Seq(common, hub, study, search),
reactivemongo.bundle
)
lazy val learn = module("learn",
Seq(common, db, user),
reactivemongo.bundle
)
lazy val evalCache = module("evalCache",
Seq(common, db, user, security, socket, tree),
reactivemongo.bundle
)
lazy val practice = module("practice",
Seq(common, db, memo, user, study),
reactivemongo.bundle
)
lazy val playban = module("playban",
Seq(common, db, game, message, chat),
reactivemongo.bundle
)
lazy val push = module("push",
Seq(common, db, user, game, challenge, message),
Seq(googleOAuth, play.api) ++ reactivemongo.bundle
)
lazy val slack = module("slack",
Seq(common, hub, user),
reactivemongo.bundle
)
lazy val plan = module("plan",
Seq(common, user, notifyModule),
reactivemongo.bundle
)
lazy val relation = module("relation",
Seq(common, db, memo, hub, user, game, pref),
reactivemongo.bundle
)
lazy val pref = module("pref",
Seq(common, db, user),
reactivemongo.bundle
)
lazy val message = module("message",
Seq(common, db, user, hub, relation, security, shutup, notifyModule),
reactivemongo.bundle
)
lazy val forum = module("forum",
Seq(common, db, user, security, hub, mod, notifyModule),
reactivemongo.bundle
)
lazy val forumSearch = module("forumSearch",
Seq(common, hub, forum, search),
reactivemongo.bundle
)
lazy val team = module("team",
Seq(common, memo, db, user, forum, security, hub, notifyModule),
reactivemongo.bundle
)
lazy val teamSearch = module("teamSearch",
Seq(common, hub, team, search),
reactivemongo.bundle
)
lazy val i18n = module("i18n",
Seq(common, db, user, hub),
Seq(scalatags)
).settings(
libraryDependencies ++= Seq(play.api, scalatags) ++ reactivemongo.bundle
)
lazy val tournament = module("tournament", Seq(
common, hub, socket, game, round, security, chat, memo, quote, history, notifyModule, i18n, room
)).settings(
libraryDependencies ++= Seq(play.api, scalatags, lettuce) ++ reactivemongo.bundle
)
lazy val simul = module("simul", Seq(
common, hub, socket, game, round, chat, memo, quote, room
)).settings(
libraryDependencies ++= Seq(play.api, lettuce) ++ reactivemongo.bundle
)
lazy val fishnet = module("fishnet", Seq(common, game, analyse, db, evalCache)).settings(
libraryDependencies ++= Seq(play.api, lettuce) ++ reactivemongo.bundle
)
lazy val irwin = module("irwin", Seq(common, db, user, game, tournament, mod)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val oauth = module("oauth", Seq(common, db, user)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val security = module("security", Seq(common, hub, db, user, i18n, slack, oauth)).settings(
libraryDependencies ++= Seq(play.api, scalatags, maxmind, hasher) ++ reactivemongo.bundle
)
lazy val shutup = module("shutup", Seq(common, db, hub, game, relation)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val challenge = module("challenge", Seq(common, db, hub, setup, game, relation, pref, socket, room)).settings(
libraryDependencies ++= Seq(play.api, scalatags, lettuce) ++ reactivemongo.bundle
)
lazy val study = module("study", Seq(
common, db, hub, socket, game, round, importer, notifyModule, relation, evalCache, explorer, i18n, room
)).settings(
libraryDependencies ++= Seq(play.api, scalatags, lettuce) ++ reactivemongo.bundle
)
lazy val relay = module("relay", Seq(common, study)).settings(
libraryDependencies ++= Seq(scalaUri) ++ Seq(play.api, markdown) ++ reactivemongo.bundle
)
lazy val studySearch = module("studySearch", Seq(common, hub, study, search)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val learn = module("learn", Seq(common, db, user)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val evalCache = module("evalCache", Seq(common, db, user, security, socket, tree)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val practice = module("practice", Seq(common, db, memo, user, study)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val playban = module("playban", Seq(common, db, game, message, chat)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val push = module("push", Seq(common, db, user, game, challenge, message)).settings(
libraryDependencies ++= Seq(googleOAuth, play.api) ++ reactivemongo.bundle
)
lazy val slack = module("slack", Seq(common, hub, user)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val plan = module("plan", Seq(common, user, notifyModule)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val relation = module("relation", Seq(common, db, memo, hub, user, game, pref)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val pref = module("pref", Seq(common, db, user)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val message = module("message", Seq(common, db, user, hub, relation, security, shutup, notifyModule)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val forum = module("forum", Seq(common, db, user, security, hub, mod, notifyModule)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val forumSearch = module("forumSearch", Seq(common, hub, forum, search)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val team = module("team", Seq(common, memo, db, user, forum, security, hub, notifyModule)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val teamSearch = module("teamSearch", Seq(common, hub, team, search)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
)
lazy val i18n = module("i18n", Seq(common, db, user, hub)).settings(
sourceGenerators in Compile += Def.task {
MessageCompiler(
sourceDir = new File("translation/source"),
@ -333,34 +364,40 @@ lazy val i18n = module("i18n", Seq(common, db, user, hub)).settings(
dbs = List("site", "arena", "emails", "learn", "activity", "coordinates", "study"),
compileTo = (sourceManaged in Compile).value / "messages"
)
}.taskValue,
libraryDependencies ++= Seq(play.api, scalatags)
}.taskValue
)
lazy val bookmark = module("bookmark", Seq(common, memo, db, hub, user, game)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val bookmark = module("bookmark",
Seq(common, memo, db, hub, user, game),
reactivemongo.bundle
)
lazy val report = module("report", Seq(common, db, user, game, security, playban)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val report = module("report",
Seq(common, db, user, game, security, playban),
reactivemongo.bundle
)
lazy val explorer = module("explorer", Seq(common, db, game, importer)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val explorer = module("explorer",
Seq(common, db, game, importer),
reactivemongo.bundle
)
lazy val notifyModule = module("notify", Seq(common, db, game, user, hub, relation)).settings(
libraryDependencies ++= Seq(play.api) ++ reactivemongo.bundle
lazy val notifyModule = module("notify",
Seq(common, db, game, user, hub, relation),
reactivemongo.bundle
)
lazy val tree = module("tree", Seq(common)).settings(
libraryDependencies ++= Seq(play.api)
lazy val tree = module("tree",
Seq(common),
Seq()
)
lazy val socket = module("socket", Seq(common, hub, memo, tree)).settings(
libraryDependencies ++= Seq(play.api, lettuce)
lazy val socket = module("socket",
Seq(common, hub, memo, tree),
Seq(lettuce)
)
lazy val hub = module("hub", Seq(common)).settings(
libraryDependencies ++= Seq(scaffeine, play.api)
lazy val hub = module("hub",
Seq(common),
Seq(scaffeine, play.api)
)

View File

@ -26,12 +26,16 @@ object BuildSettings {
.setPreference(DanglingCloseParenthesis, Force)
.setPreference(DoubleIndentConstructorArguments, true)
def defaultDeps = Seq(
scalaz, chess, scalalib, jodaTime, ws,
def defaultLibs: Seq[ModuleID] = Seq(
play.api, scalaz, chess, scalalib, jodaTime, ws,
macwire.macros, macwire.util, autoconfig
) // , specs2, specs2Scalaz)
def module(name: String, deps: Seq[sbt.ClasspathDep[sbt.ProjectReference]] = Seq.empty) =
def module(
name: String,
deps: Seq[sbt.ClasspathDep[sbt.ProjectReference]],
libs: Seq[ModuleID]
) =
Project(
name,
file("modules/" + name)
@ -39,7 +43,7 @@ object BuildSettings {
.dependsOn(deps: _*)
.settings(
version := "3.0",
libraryDependencies ++= defaultDeps,
libraryDependencies ++= defaultLibs ++ libs,
buildSettings,
srcMain
)