/
build.sbt
204 lines (176 loc) · 6.27 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
import sbt.Keys._
import sbt._
import scoverage.ScoverageSbtPlugin.autoImport._
import scala.util.Properties
val buildNumber = Properties.envOrNone("BUILD_NUMBER")
val isSnapshot = buildNumber.isEmpty
val PlayVersion = "2.7.0"
val PlayJsonVersion = "2.7.0"
val actualVersion: String = s"3.4.${buildNumber.getOrElse("0-local")}"
def withTests(project: Project) = project % "test->test;compile->compile"
val frontendCompilationSettings = Seq(
organization := "de.welt",
scalaVersion := "2.12.8",
version in ThisBuild := s"${actualVersion}_$PlayVersion${if (isSnapshot) "-SNAPSHOT" else ""}",
licenses += ("MIT", url("http://opensource.org/licenses/MIT")),
javacOptions ++= Seq("-deprecation", "-source", "-opt:l:default"),
publishArtifact in Test := false,
fork in Test := true,
javaOptions in Test += "-Xmx2048M",
javaOptions in Test += "-Dconfig.resource=application.test.conf",
javaOptions in Test += "-XX:+UseConcMarkSweepGC",
javaOptions in Test += "-XX:ReservedCodeCacheSize=128m",
javaOptions in Test += "-XX:MaxMetaspaceSize=512m",
javaOptions in Test += "-Duser.timezone=Europe/Berlin",
baseDirectory in Test := file("."),
// disable scaladoc
sources in (Compile, doc) := Seq()
)
val frontendDependencyManagementSettings = Seq(
resolvers := Seq(
Resolver.mavenLocal,
Resolver.jcenterRepo,
Resolver.bintrayRepo("welt", "metrics-play")
),
// https://www.typesafe.com/blog/improved-dependency-management-with-sbt-0137
updateOptions := updateOptions.value.withCachedResolution(true)
)
val coreDependencySettings = Seq(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % PlayJsonVersion % Provided,
"org.mockito" % "mockito-core" % "2.24.0" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "4.0.1" % Test
)
)
val clientDependencySettings = Seq(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-ws" % PlayVersion % Provided,
"com.typesafe.play" %% "play-guice" % PlayVersion % Provided,
"com.typesafe.play" %% "play-ws" % PlayVersion % Provided,
"com.typesafe.play" %% "play-cache" % PlayVersion % Provided,
"com.typesafe" % "config" % "1.3.3" % Provided,
"ch.qos.logback" % "logback-classic" % "1.2.3" % Provided,
"com.amazonaws" % "aws-java-sdk-core" % "1.11.490",
"com.amazonaws" % "aws-java-sdk-s3" % "1.11.490",
"de.welt" %% "metrics-play" % "2.7.0_5",
"org.scalatestplus.play" %% "scalatestplus-play" % "4.0.1" % Test,
"org.mockito" % "mockito-core" % "2.24.0" % Test
)
)
val bintraySettings = Seq(
pomExtra :=
<scm>
<url>git@github.com:WeltN24/{name.value}.git</url>
<connection>scm:git:git@github.com:WeltN24/{name.value}.git</connection>
</scm>
<developers>
<developer>
<id>thisismana</id>
<name>Matthias Naber</name>
<url>https://github.com/thisismana</url>
</developer>
<developer>
<id>harryurban</id>
<name>Harry Urban</name>
<url>https://github.com/harryurban</url>
</developer>
<developer>
<id>bobaaaaa</id>
<name>Patrick Dahms</name>
<url>https://github.com/bobaaaaa</url>
</developer>
</developers>,
bintrayRepository := "welt-content-api-client",
bintrayOrganization := Some("welt"),
bintrayVcsUrl := Some("git@github.com:you/your-repo.git")
)
def codeStyleSettings = Seq(
// scoverage
coverageExcludedPackages := "<empty>;",
// coverageMinimum := 25, // we are not that good yet ;)
coverageFailOnMinimum := true,
// scalastyle
scalastyleConfig := file("scalastyle-config.xml"),
scalastyleFailOnError := true
)
def project(id: String) = Project(id, base = file(id))
.settings(frontendCompilationSettings: _*)
.settings(frontendDependencyManagementSettings: _*)
.settings(bintraySettings: _*)
.settings(codeStyleSettings: _*)
// only in "welt-content-api-client"
val utils = project("utils")
.settings(
name := "welt-content-api-utils",
libraryDependencies += "com.google.guava" % "guava" % "27.0-jre",
libraryDependencies += "com.typesafe.play" %% "play" % PlayVersion % Provided
)
.settings(coreDependencySettings: _*)
val core = project("core")
.settings(
name := "welt-content-api-core"
)
.settings(coreDependencySettings: _*)
val coreTest = project("core_test")
.settings(
name := "welt-content-api-core-test"
)
.dependsOn(withTests(core)).aggregate(core)
val raw = project("raw")
.settings(clientDependencySettings: _*)
.settings(
name := "welt-content-api-raw"
)
.dependsOn(withTests(utils)).aggregate(utils)
.dependsOn(withTests(core)).aggregate(core)
val pressed = project("pressed")
.settings(
name := "welt-content-api-pressed"
)
.settings(coreDependencySettings: _*)
.dependsOn(withTests(core)).aggregate(core)
val coreClient = project("core-client")
.settings(
name := "welt-content-api-core-client"
)
.settings(clientDependencySettings: _*)
.dependsOn(withTests(utils)).aggregate(utils)
.dependsOn(withTests(core)).aggregate(core)
val menu = project("menu")
.settings(clientDependencySettings: _*)
.settings(
name := "welt-content-menu"
)
.dependsOn(withTests(utils)).aggregate(utils)
.dependsOn(withTests(coreClient)).aggregate(coreClient)
val rawClient = project("raw-client")
.settings(
name := "welt-content-api-raw-client"
)
.settings(clientDependencySettings: _*)
.dependsOn(withTests(coreClient)).aggregate(coreClient)
.dependsOn(withTests(raw)).aggregate(raw)
val rawAdminClient = project("raw-admin-client")
.settings(
name := "welt-content-api-raw-admin-client"
)
.settings(clientDependencySettings: _*)
.dependsOn(withTests(rawClient)).aggregate(rawClient)
val pressedClient = project("pressed-client")
.settings(
name := "welt-content-api-pressed-client"
)
.settings(clientDependencySettings: _*)
.dependsOn(withTests(coreClient)).aggregate(coreClient)
.dependsOn(withTests(pressed)).aggregate(pressed)
.dependsOn(withTests(rawClient)).aggregate(rawClient)
val main = Project("root", base = file("."))
.settings(
name := "welt-content-api-root"
)
.settings(frontendCompilationSettings: _*)
.settings(
publish := {},
bintrayUnpublish := {}
)
.aggregate(core, coreClient, coreTest, menu, raw, rawClient, rawAdminClient, pressed, pressedClient)