-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
134 lines (121 loc) Β· 5.23 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
Global / onChangedBuildSource := ReloadOnSourceChanges
inThisBuild(List(
organization := "com.github.pandafolks",
homepage := Some(url("https://github.com/pandafolks/panda")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"mattszm",
"Mateusz Szmal",
"-",
url("https://github.com/MattSzm")
)
)
))
//skip in publish := true
lazy val sharedSettings = Seq(
scalaVersion := "2.13.8",
version := "0.1.0-SNAPSHOT",
mainClass in(Compile, run) := Some("com.github.pandafolks.panda.bootstrap.App"),
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-feature",
"-language:higherKinds",
"-language:implicitConversions",
"-language:experimental.macros"
),
scalacOptions in(Compile, console) ++= Seq("-Ywarn-unused:imports"),
scalacOptions ++= Seq(
"-Ywarn-unused:imports",
"-Ywarn-dead-code",
"-Xlint:adapted-args",
"-Xlint:infer-any",
"-Xlint:missing-interpolator",
"-Xlint:doc-detached",
"-Xlint:private-shadow",
"-Xlint:type-parameter-shadow",
"-Xlint:poly-implicit-overload",
"-Xlint:option-implicit",
"-Xlint:delayedinit-select",
),
// ScalaDoc settings
scalacOptions in(Compile, doc) ++= Seq("-no-link-warnings"),
autoAPIMappings := true,
scalacOptions in ThisBuild ++= Seq(
"-sourcepath",
file(".").getAbsolutePath.replaceAll("[.]$", "")
),
parallelExecution in Test := true,
parallelExecution in ThisBuild := true,
testForkedParallel in Test := true,
testForkedParallel in ThisBuild := true,
concurrentRestrictions in Global += Tags.limit(Tags.Test, 3),
logBuffered in Test := false,
logBuffered in IntegrationTest := false,
incOptions := incOptions.value.withLogRecompileOnMacro(false),
pomIncludeRepository := { _ => false },
autoAPIMappings := true,
Test / publishArtifact := false,
ThisBuild / scalafixDependencies ++= Seq(
Dependencies.scalafixScaluzzi,
Dependencies.scalafixSortImports
),
libraryDependencies ++= Seq(
compilerPlugin(Dependencies.silencer),
Dependencies.silencerLib
),
)
scalacOptions in(Compile, doc) ++= Seq("-no-link-warnings")
val IT = config("it") extend Test
lazy val panda = (project in file("."))
.configs(IntegrationTest, IT)
.settings(sharedSettings)
.settings(
name := "panda",
assembly / mainClass := Some("com.github.pandafolks.panda.bootstrap.App"),
assembly / assemblyJarName := "panda.jar",
)
.aggregate(bootstrap, db, gateway, loadBalancer, healthCheck, participant, routes, sequence, user, nodesTracker, httpClient, backgroundJobsRegistry, utils)
.dependsOn(bootstrap, db, gateway, loadBalancer, healthCheck, participant, routes, sequence, user, nodesTracker, httpClient, backgroundJobsRegistry, utils)
lazy val bootstrap = pandaConnector("bootstrap", Dependencies.bootstapDependencies, Seq(db, gateway))
lazy val db = pandaConnector("db", Dependencies.dbDependencies, Seq(user, healthCheck, participant, sequence, nodesTracker))
lazy val gateway = pandaConnector("gateway", Dependencies.gatewayDependencies, Seq(loadBalancer, routes, utils))
.enablePlugins(BuildInfoPlugin)
.settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "pandaBuildInfo"
)
lazy val loadBalancer = pandaConnector("loadBalancer", Dependencies.loadBalancerDependencies, Seq(participant, utils, httpClient, backgroundJobsRegistry))
lazy val healthCheck = pandaConnector("healthCheck", Dependencies.healthCheckDependencies, Seq(participant, nodesTracker, httpClient))
lazy val participant = pandaConnector("participant", Dependencies.participantDependencies, Seq(sequence, utils, routes, user, backgroundJobsRegistry))
lazy val routes = pandaConnector("routes", Dependencies.routesDependencies, Seq(user, backgroundJobsRegistry))
lazy val sequence = pandaConnector("sequence", Dependencies.sequenceDependencies, Seq(user))
lazy val user = pandaConnector("user", Dependencies.userDependencies, Seq(utils))
lazy val nodesTracker = pandaConnector("nodesTracker", Dependencies.nodesTrackerDependencies, Seq(utils, backgroundJobsRegistry))
lazy val httpClient = pandaConnector("httpClient", Dependencies.httpClientDependencies)
lazy val backgroundJobsRegistry = pandaConnector("backgroundJobsRegistry", Dependencies.backgroundJobsRegistryDependencies, Seq(utils))
lazy val utils = pandaConnector("utils", Dependencies.utilsDependencies)
mainClass in(Compile, run) := Some("com.github.pandafolks.panda.bootstrap.App")
ThisBuild / assemblyMergeStrategy := {
case PathList("META-INF", xs@_*) =>
(xs map {
_.toLowerCase
}) match {
case "services" :: xs =>
MergeStrategy.filterDistinctLines
case _ => MergeStrategy.discard
}
case _ => MergeStrategy.first
}
def pandaConnector(
moduleName: String,
projectDependencies: Seq[ModuleID],
dependsOn: Seq[sbt.ClasspathDep[sbt.ProjectReference]] = Seq.empty
): Project = {
Project(id = moduleName, base = file(moduleName))
.settings(name := s"panda-$moduleName", libraryDependencies ++= projectDependencies, Defaults.itSettings)
.settings(sharedSettings)
.configs(IntegrationTest, IT)
.dependsOn(dependsOn: _*)
}