-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
262 lines (233 loc) · 8.3 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
import Dependencies._
import com.typesafe.sbt.packager.docker.{Cmd, ExecCmd}
import microsites.ExtraMdFileConfig
import sbt.url
name := "talos"
sonatypeProfileName := "org.vaslabs"
(ThisBuild / version) := sys.env.getOrElse("VASLABS_PUBLISH_VERSION", "SNAPSHOT")
(ThisBuild / scalaVersion) := "2.12.13"
lazy val talos =
(project in file("."))
.settings(noPublishSettings)
.aggregate(
talosCore, talosKamon,
talosAkkaSupport, talosMonixSupport, talosLaws,
talosGateway,
talosExamples,
compat,
talosLoadTests
)
lazy val talosCore =
(project in file("core"))
.settings(
libraryDependencies ++= Seq(libraries.ScalaTest.scalatest % Test, libraries.Cats.effect)
).settings(
compilerSettings
).settings(publishSettings)
lazy val talosLaws = (project in file("laws"))
.settings(
libraryDependencies ++= libraries.ScalaCheck.all
).settings(
compilerSettings
).settings(
publishSettings
).dependsOn(talosCore, compat)
lazy val talosMonixSupport = (project in file("monix"))
.settings(
libraryDependencies ++= libraries.ScalaTest.all ++ libraries.Monix.all
)
.settings(compilerSettings)
.settings(publishSettings)
.dependsOn(talosCore, talosLaws % Test)
lazy val talosAkkaSupport = (project in file("akka"))
.settings(
libraryDependencies ++= libraries.Akka.all ++ libraries.ScalaTest.all :+ libraries.Cats.effect
).settings(compilerSettings)
.settings(publishSettings)
.dependsOn(talosCore, talosLaws % Test)
lazy val talosKamon =
(project in file("kamon")).settings(
libraryDependencies ++= Seq(libraries.Kamon.core) ++ libraries.Log4j.required.map(_ % Test) ++
libraries.ScalaTest.all ++ libraries.Akka.all :+
libraries.Cats.effect
).settings(compilerSettings)
.settings(publishSettings)
.dependsOn(talosCore)
lazy val compat =
(project in file("cross-compat"))
.settings(
(Compile / unmanagedSourceDirectories) += {
val sharedSourceDir = (ThisBuild / baseDirectory).value / "cross-compat/src/main"
if (scalaBinaryVersion.value.startsWith("2.13"))
sharedSourceDir / "scala-2.13"
else
sharedSourceDir / "scala-2.12"
}
).settings(noPublishSettings)
lazy val dockerCommonSettings = Seq(
(Docker / version) := version.value,
(Docker / maintainer) := "Vasilis Nicolaou",
dockerBaseImage := "openjdk:8-alpine",
dockerCommands += Cmd("USER", "root"),
dockerCommands ++= Seq(
ExecCmd("RUN", "apk", "add", "eudev-dev")
),
dockerExposedPorts := Seq(8080, 9095, 5266),
maintainer := "[email protected]",
dockerUsername := Some("vaslabs"),
javaAgents += "io.kamon" % "kanela-agent" % "1.0.14"
)
lazy val dockerPlugins = Seq(DockerPlugin, AshScriptPlugin, JavaAppPackaging, UniversalPlugin, JavaAgent)
lazy val talosExamples =
(project in file("examples"))
.enablePlugins(dockerPlugins: _*)
.settings(dockerCommonSettings)
.settings(
(Docker / packageName) := "talos-demo",
)
.settings(
libraryDependencies ++=
libraries.Akka.allHttp ++
Seq(libraries.Kamon.bundle, libraries.Kamon.prometheus) ++
libraries.Circe.all ++ libraries.ScalaTest.all ++
libraries.Log4j.required
).settings(noPublishSettings)
.settings(
coverageExcludedPackages := ".*"
)
.settings(compilerSettings)
.dependsOn(talosAkkaSupport, talosKamon)
lazy val noPublishSettings = Seq(
publish := {},
(publish / skip) := true,
publishLocal := {},
(Test / publishArtifact) := false
)
lazy val micrositeSettings = Seq(
micrositeName := "Talos",
micrositeDescription := "Lawful circuit breakers in Scala",
micrositeAuthor := "Vasilis Nicolaou",
micrositeTwitterCreator := "@vaslabs",
micrositeGithubOwner := "vaslabs",
micrositeGithubRepo := "talos",
micrositeUrl := "https://sbt-kubeyml.vaslabs.org",
micrositeDocumentationUrl := "/events/events.html",
micrositeExtraMdFiles := Map(
file("README.md") -> ExtraMdFileConfig(
"index.md",
"home",
Map("section" -> "home", "position" -> "0", "permalink" -> "/")
)
),
(mdoc / fork) := true,
micrositeTheme := "pattern",
(ghpagesCleanSite / excludeFilter) :=
new FileFilter{
def accept(f: File) = (ghpagesRepository.value / "CNAME").getCanonicalPath == f.getCanonicalPath
} || "versions.html"
)
lazy val talosMicrosite = (project in file("site"))
.enablePlugins(MicrositesPlugin)
.settings(noPublishSettings)
.settings(
git.remoteRepo := "[email protected]:vaslabs/talos.git"
)
.settings(micrositeSettings)
.settings(
coverageExcludedPackages := ".*"
)
.dependsOn(talosCore, talosKamon, talosAkkaSupport, talosMonixSupport)
lazy val talosGateway =
(project in file("gateway"))
.enablePlugins(dockerPlugins: _*)
.settings(
libraryDependencies ++=
libraries.Akka.allHttp ++
libraries.ScalaTest.all ++
Seq(libraries.Kamon.bundle, libraries.Kamon.prometheus) ++
libraries.Wiremock.all ++
libraries.Log4j.required :+ libraries.PureConf.core
)
.settings(
(Docker / packageName) := "talos-gateway",
)
.settings(
compilerSettings
)
.settings(
noPublishSettings
).settings(
dockerCommonSettings
).dependsOn(
talosKamon, talosAkkaSupport, talosCore
)
lazy val talosLoadTests = (project in file("load-tests"))
.settings(
libraryDependencies ++= libraries.Gatling.all
).enablePlugins(GatlingPlugin)
.settings(noPublishSettings)
.settings(compilerSettings)
.settings((ThisProject / crossScalaVersions) := Nil)
addCommandAlias("release", ";project talos ;reload ;+publishSigned ;sonatypeReleaseAll; talosMicrosite/publishMicrosite")
addCommandAlias("reportTestCov", ";project talos; coverageReport; coverageAggregate; codacyCoverage")
lazy val publishSettings = Seq(
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
organization := "org.vaslabs.talos",
organizationName := "vaslabs",
scmInfo := Some(ScmInfo(url("https://github.com/vaslabs/talos"), "scm:[email protected]:vaslabs/talos.git")),
developers := List(
Developer(
id = "vaslabs",
name = "Vasilis Nicolaou",
email = "[email protected]",
url = url("http://vaslabs.org")
)
),
publishMavenStyle := true,
licenses := List("MIT" -> new URL("https://opensource.org/licenses/MIT")),
homepage := Some(url("https://talos.vaslabs.org")),
startYear := Some(2018)
)
lazy val compilerSettings = Seq(
scalacOptions ++= {
if (scalaVersion.value.startsWith("2.13"))
sharedFlags
else
sharedFlags ++ scala212Flags
},
(ThisBuild / crossScalaVersions) := Seq(scala212, scala213)
)
lazy val scala212 = "2.12.13"
lazy val scala213 = "2.13.2"
lazy val scala212Flags = Seq(
"-Ypartial-unification",
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Ywarn-nullary-unit" // Warn when nullary methods return Unit.
)
lazy val sharedFlags = Seq(
"-deprecation",
"-feature",
"-language:postfixOps", //Allow postfix operator notation, such as `1 to 10 toList'
"-language:implicitConversions",
"-language:higherKinds",
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused.
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused.
"-Ywarn-unused:imports",
"-Xfatal-warnings"
)