/
build.sbt
289 lines (274 loc) · 11.9 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
/*
scalafmt: {
style = defaultWithAlign
maxColumn = 150
align = most
align.tokens.add = [
{ code = ":=", owner = "Term.ApplyInfix" }
{ code = "+=", owner = "Term.ApplyInfix" }
{ code = "++=", owner = "Term.ApplyInfix" }
]
}
*/
val javaSpecificationVersion = "11"
val scalacSilencerVersion = "1.4.4"
val catsVersion = "2.1.1"
val catsEffectVersion = "2.1.3"
val catsRetryVersion = "0.3.2"
val circeVersion = "0.13.0"
val distageVersion = "0.10.6"
val declineVersion = "1.2.0"
val doobieVersion = "0.9.0"
val fs2Version = "2.3.0"
val http4sVersion = "0.21.3"
val jenaVersion = "3.14.0"
val kindProjectorVersion = "0.11.0"
val logbackVersion = "1.2.3"
val magnoliaVersion = "0.12.8"
val monixVersion = "3.1.0"
val parboiledVersion = "2.2.0"
val pureconfigVersion = "0.12.3"
val scalaTestVersion = "3.1.1"
lazy val alleycatsCore = "org.typelevel" %% "alleycats-core" % catsVersion
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
lazy val catsEffect = "org.typelevel" %% "cats-effect" % catsEffectVersion
lazy val catsRetry = "com.github.cb372" %% "cats-retry-core" % catsRetryVersion
lazy val catsEffectRetry = "com.github.cb372" %% "cats-retry-cats-effect" % catsRetryVersion
lazy val circeCore = "io.circe" %% "circe-core" % circeVersion
lazy val circeGeneric = "io.circe" %% "circe-generic" % circeVersion
lazy val circeLiteral = "io.circe" %% "circe-literal" % circeVersion
lazy val circeParser = "io.circe" %% "circe-parser" % circeVersion
lazy val distageCore = "io.7mind.izumi" %% "distage-core" % distageVersion
lazy val distageDocker = "io.7mind.izumi" %% "distage-framework-docker" % distageVersion
lazy val distageTestkit = "io.7mind.izumi" %% "distage-testkit-scalatest" % distageVersion
lazy val decline = "com.monovore" %% "decline" % declineVersion
lazy val doobiePostgres = "org.tpolecat" %% "doobie-postgres" % doobieVersion
lazy val fs2 = "co.fs2" %% "fs2-core" % fs2Version
lazy val http4sCirce = "org.http4s" %% "http4s-circe" % http4sVersion
lazy val http4sClient = "org.http4s" %% "http4s-blaze-client" % http4sVersion
lazy val http4sDsl = "org.http4s" %% "http4s-dsl" % http4sVersion
lazy val jenaArq = "org.apache.jena" % "jena-arq" % jenaVersion
lazy val kindProjector = "org.typelevel" %% "kind-projector" % kindProjectorVersion
lazy val logback = "ch.qos.logback" % "logback-classic" % logbackVersion
lazy val magnolia = "com.propensive" %% "magnolia" % magnoliaVersion
lazy val monixEval = "io.monix" %% "monix-eval" % monixVersion
lazy val parboiled2 = "org.parboiled" %% "parboiled" % parboiledVersion
lazy val pureconfig = "com.github.pureconfig" %% "pureconfig" % pureconfigVersion
lazy val scalaTest = "org.scalatest" %% "scalatest" % scalaTestVersion
lazy val docs = project
.in(file("docs"))
.enablePlugins(ParadoxPlugin, ParadoxMaterialThemePlugin, ParadoxSitePlugin, GhpagesPlugin)
.disablePlugins(ScapegoatSbtPlugin)
.settings(shared, compilation)
.settings(ParadoxMaterialThemePlugin.paradoxMaterialThemeSettings(Paradox))
.settings(
name := "docs",
moduleName := "docs",
// paradox settings
sourceDirectory in Paradox := sourceDirectory.value / "main" / "paradox",
paradoxMaterialTheme in Paradox := {
ParadoxMaterialTheme()
.withColor("light-blue", "cyan")
.withFavicon("./assets/img/favicon-32x32.png")
.withLogo("./assets/img/logo.png")
.withCustomStylesheet("./assets/css/docs.css")
.withRepository(uri("https://github.com/BlueBrain/nexus"))
.withSocial(
uri("https://github.com/BlueBrain"),
uri("https://gitter.im/BlueBrain/nexus")
)
.withCustomJavaScript("./public/js/gtm.js")
.withCopyright("""Nexus is Open Source and available under the Apache 2 License.<br/>
|© 2017-2020 <a href="https://epfl.ch/">EPFL</a> | <a href="https://bluebrain.epfl.ch/">The Blue Brain Project</a>
|""".stripMargin)
},
paradoxNavigationDepth in Paradox := 4,
paradoxProperties in Paradox += ("github.base_url" -> "https://github.com/BlueBrain/nexus/tree/master"),
paradoxRoots := List("docs/index.html"),
// gh pages settings
git.remoteRepo := "git@github.com:BlueBrain/nexus.git",
ghpagesNoJekyll := true,
ghpagesBranch := "gh-pages"
)
lazy val rdf = project
.in(file("rdf"))
.settings(name := "rdf", moduleName := "rdf")
.settings(noPublish)
.settings(shared, compilation, coverage, release)
.settings(
libraryDependencies ++= Seq(
alleycatsCore,
catsCore,
magnolia,
parboiled2,
circeCore,
circeParser,
circeLiteral % Test,
jenaArq % Test,
scalaTest % Test
)
)
lazy val cli = project
.in(file("cli"))
.enablePlugins(UniversalPlugin, JavaAppPackaging, DockerPlugin)
.settings(shared, compilation, coverage, release, servicePackaging)
.settings(
name := "cli",
moduleName := "cli",
Docker / packageName := "nexus-cli",
coverageMinimum := 70d,
run / fork := true,
libraryDependencies ++= Seq(
catsCore,
catsEffect,
catsEffectRetry,
catsRetry,
circeGeneric,
circeParser,
decline,
distageCore,
doobiePostgres,
distageCore,
http4sCirce,
http4sClient,
fs2,
monixEval,
pureconfig,
circeLiteral % Test,
distageDocker % Test,
distageTestkit % Test,
http4sDsl % Test,
jenaArq % Test,
scalaTest % Test
)
)
lazy val root = project
.in(file("."))
.settings(name := "nexus", moduleName := "nexus")
.settings(noPublish)
.aggregate(docs, cli, rdf)
lazy val noPublish = Seq(publishLocal := {}, publish := {}, publishArtifact := false)
lazy val shared = Seq(
organization := "ch.epfl.bluebrain.nexus",
resolvers ++= Seq(
Resolver.bintrayRepo("bbp", "nexus-releases"),
Resolver.bintrayRepo("bbp", "nexus-snapshots")
)
)
lazy val compilation = Seq(
scalaVersion := "2.13.1", // scapegoat plugin not published yet for 2.13.2
// to be removed when migrating to 2.13.2 and replaced with @nowarn (scapegoat plugin not published yet for 2.13.2)
libraryDependencies ++= Seq(
compilerPlugin("com.github.ghik" % "silencer-plugin" % scalacSilencerVersion cross CrossVersion.full),
"com.github.ghik" % "silencer-lib" % scalacSilencerVersion % Provided cross CrossVersion.full
),
scalacOptions ~= { options: Seq[String] => options.filterNot(Set("-Wself-implicit")) },
javacOptions ++= Seq(
"-source",
javaSpecificationVersion,
"-target",
javaSpecificationVersion,
"-Xlint"
),
scalacOptions in (Compile, doc) ++= Seq("-no-link-warnings"),
javacOptions in (Compile, doc) := Seq("-source", javaSpecificationVersion),
autoAPIMappings := true,
apiMappings += {
val scalaDocUrl = s"http://scala-lang.org/api/${scalaVersion.value}/"
ApiMappings.apiMappingFor((fullClasspath in Compile).value)("scala-library", scalaDocUrl)
},
// fail the build initialization if the JDK currently used is not ${javaSpecificationVersion} or higher
initialize := {
// runs the previous initialization
initialize.value
// runs the java compatibility check
val current = VersionNumber(sys.props("java.specification.version"))
val required = VersionNumber(javaSpecificationVersion)
assert(CompatibleJavaVersion(current, required), s"Java '$required' or above required; current '$current'")
}
)
lazy val coverage = Seq(
coverageMinimum := 80,
coverageFailOnMinimum := true
)
lazy val release = Seq(
bintrayOrganization := Some("bbp"),
bintrayRepository := {
import ch.epfl.scala.sbt.release.ReleaseEarly.Defaults
if (Defaults.isSnapshot.value) "nexus-snapshots"
else "nexus-releases"
},
sources in (Compile, doc) := Seq.empty,
publishArtifact in packageDoc := false,
publishArtifact in (Compile, packageSrc) := true,
publishArtifact in (Compile, packageDoc) := false,
publishArtifact in (Test, packageBin) := false,
publishArtifact in (Test, packageDoc) := false,
publishArtifact in (Test, packageSrc) := false,
publishMavenStyle := true,
pomIncludeRepository := Function.const(false),
// removes compile time only dependencies from the resulting pom
pomPostProcess := { node =>
XmlTransformer.transformer(moduleFilter("org.scoverage") | moduleFilter("com.sksamuel.scapegoat")).transform(node).head
}
)
lazy val servicePackaging = {
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport.{dockerChmodType, Docker}
import com.typesafe.sbt.packager.docker.{DockerChmodType, DockerVersion}
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.Universal
Seq(
// package the kanela agent as a fixed name jar
mappings in Universal := {
val universalMappings = (mappings in Universal).value
universalMappings.foldLeft(Vector.empty[(File, String)]) {
case (acc, (file, filename)) if filename.contains("kanela-agent") =>
acc :+ (file -> "lib/instrumentation-agent.jar")
case (acc, other) =>
acc :+ other
} :+ (WaitForIt.download(target.value) -> "bin/wait-for-it.sh")
},
// docker publishing settings
Docker / maintainer := "Nexus Team <noreply@epfl.ch>",
Docker / version := "latest",
Docker / daemonUser := "nexus",
dockerBaseImage := "adoptopenjdk:11-jre-hotspot",
dockerExposedPorts := Seq(8080, 2552),
dockerUsername := Some("bluebrain"),
dockerUpdateLatest := false,
dockerChmodType := DockerChmodType.UserGroupWriteExecute,
dockerVersion := Some(
DockerVersion(19, 3, 5, Some("ce"))
) // forces the version because gh-actions version is 3.0.x which is not recognized to support multistage
)
}
inThisBuild(
Seq(
scapegoatVersion := "1.4.3",
scapegoatMaxWarnings := 0,
scapegoatMaxErrors := 0,
scapegoatMaxInfos := 0,
scapegoatDisabledInspections := Seq(
"RedundantFinalModifierOnCaseClass",
"RedundantFinalModifierOnMethod",
"ObjectNames",
"AsInstanceOf",
"ClassNames",
"VariableShadowing"
),
homepage := Some(url("https://github.com/BlueBrain/nexus-commons")),
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
scmInfo := Some(ScmInfo(url("https://github.com/BlueBrain/nexus-commons"), "scm:git:git@github.com:BlueBrain/nexus-commons.git")),
developers := List(
Developer("bogdanromanx", "Bogdan Roman", "noreply@epfl.ch", url("https://bluebrain.epfl.ch/")),
Developer("umbreak", "Didac Montero Mendez", "noreply@epfl.ch", url("https://bluebrain.epfl.ch/")),
Developer("wwajerowicz", "Wojtek Wajerowicz", "noreply@epfl.ch", url("https://bluebrain.epfl.ch/"))
),
// These are the sbt-release-early settings to configure
releaseEarlyWith := BintrayPublisher,
releaseEarlyNoGpg := true,
releaseEarlyEnableSyncToMaven := false
)
)
addCommandAlias("review", ";clean;scalafmtCheck;test:scalafmtCheck;scalafmtSbtCheck;coverage;scapegoat;test;coverageReport;coverageAggregate")
addCommandAlias("build-docs", ";docs/clean;docs/makeSite")