-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.sbt
349 lines (341 loc) · 12.1 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
import java.net.URL
import scala.language.postfixOps
// Centralized control of the application's core settings
// See version in version.sbt
Global / name := "RDFShape API" // Friendly app name
Global / packageName := "rdfshape" // Output filename of "sbt-native-packager" tasks
Global / cancelable := true
Global / apiURL := Some(url("https://github.com/weso/rdfshape-api"))
Global / scalaVersion := scala213
// Lint-excluded keys
Global / excludeLintKeys ++= Set(
name,
ThisBuild / maintainer,
rdfshape / reStartArgs
)
/* ------------------------------------------------------------------------- */
/* GITHUB INTEGRATION settings */
/* GROUPED SETTINGS */
// Shared dependencies for all modules.
lazy val sharedDependencies = Seq()
// Shared packaging settings for all modules.
lazy val packagingSettings = Seq(
// Do not package logback files in .jar, they interfere with other logback
// files in classpath
Compile / packageBin / mappings ~= { project =>
project.filter { case (file, _) =>
val fileName = file.getName
!(fileName.startsWith("logback") && (fileName.endsWith(".xml") || fileName
.endsWith(".groovy")))
}
},
Compile / mainClass := Some("es.weso.rdfshape.Main"),
assembly / mainClass := Some("es.weso.rdfshape.Main"),
assembly / test := {},
assembly / assemblyJarName := s"${(Global / packageName).value}.jar",
// Output filename on "sbt-native-packager" tasks
Universal / packageName := (Global / packageName).value
)
/* ------------------------------------------------------------------------- */
// Shared compilation settings for all modules.
// https://docs.scala-lang.org/overviews/compiler-options/index.html
lazy val compilationSettings = Seq(
Compile / scalacOptions ++= Seq(
"-deprecation",
"-explaintypes",
"-feature",
"-language:_",
"-unchecked",
"-Yrangepos"
)
)
// Scaladoc settings for docs generation. Run task "doc" or "server / doc".
// https://www.scala-sbt.org/1.x/docs/Howto-Scaladoc.html
/* https://github.com/scala/scala/blob/2.13.x/src/scaladoc/scala/tools/nsc/doc/Settings.scala */
lazy val scaladocSettings: Seq[Def.Setting[_]] = Seq(
// Generate documentation on a separated "docs" folder
Compile / doc / target := baseDirectory.value / "target" / "scaladoc",
Compile / doc / scalacOptions ++= Seq(
// Base source path
"-sourcepath",
(LocalRootProject / baseDirectory).value.getAbsolutePath,
// Link to GitHub source
"-doc-source-url",
scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",
// Page title
"-doc-title",
"RDFShape API - Docs",
// Docs version
"-doc-version",
version.value,
// Docs footer
"-doc-footer",
"WESO Research Group - University of Oviedo",
// Skip unnecessary source
"-skip-packages",
"org:buildinfo",
// Other settings
"-diagrams",
"-implicits",
"-private",
"-no-link-warnings"
),
// Need to generate docs to publish to oss
Compile / packageDoc / publishArtifact := true
)
// Setup Mdoc + Docusaurus settings
lazy val mdocSettings = Seq(
mdocVariables := Map(
"APP_NAME" -> (Global / name).value,
"INNER_NAME" -> name.value,
"VERSION" -> version.value,
"WEBPAGE_URL" -> "https://www.weso.es/rdfshape-api/",
"API_URL" -> "https://api.rdfshape.weso.es",
"API_CONTAINER_REGISTRY" -> "https://github.com/orgs/weso/packages/container/package/rdfshape-api",
"CLIENT_NAME" -> "RDFShape Client",
"CLIENT_REPO" -> "https://github.com/weso/rdfshape-client/",
"CLIENT_URL" -> "https://rdfshape.weso.es/",
"WESOLOCAL_URL" -> "https://github.com/weso/wesolocal/wiki/RDFShape",
"API-DOCS_URL" -> "https://app.swaggerhub.com/apis-docs/weso/RDFShape",
"STREAMING_APP_NAME" -> "Comet"
),
mdocExtraArguments := Seq("--no-link-hygiene"),
/* When creating/publishing the docusaurus site, update the dynamic mdoc and
* the static scaladoc first */
docusaurusCreateSite := docusaurusCreateSite
.dependsOn(Compile / unidoc)
.value,
docusaurusPublishGhpages :=
docusaurusPublishGhpages
.dependsOn(Compile / unidoc)
.value
)
// Unidoc settings
lazy val unidocSettings: Seq[Def.Setting[_]] = Seq(
// Generate docs for the root project and the server module
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(rdfshape, server),
// Dump docs into the website static part, to link them with docusaurus
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
// When cleaning, remove unidoc generated docs as well
cleanFiles += (ScalaUnidoc / unidoc / target).value,
// Scalac options, mirroring scaladoc settings
ScalaUnidoc / unidoc / scalacOptions ++= (Compile / doc / scalacOptions).value
)
// Shared publish settings for all modules.
lazy val publishSettings = Seq(
organization := "es.weso",
sonatypeProfileName := "es.weso",
maintainer := "[email protected]",
homepage := Some(url("https://github.com/weso/rdfshape-api")),
licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT")),
scmInfo := Some(
ScmInfo(
url("https://github.com/weso/rdfshape-api"),
"scm:git:[email protected]:weso/rdfshape-api.git"
)
),
developers := List(
Developer(
"WESO",
"WESO Research Group",
new URL("https://github.com/weso")
),
Developer(
"labra",
"Jose Emilio Labra Gayo",
new URL("https://labra.weso.es/")
),
Developer(
"ulitol",
"Eduardo Ulibarri Toledo",
new URL("https://github.com/ulitol97")
)
),
publishMavenStyle := true // generate POM, not ivy
)
// Aggregate resolver settings passed down to modules to resolve dependencies
// Helper to resolve dependencies from GitHub packages
lazy val resolverSettings = Seq(
resolvers ++= Seq(
Resolver.DefaultMavenRepository, // maven
Opts.resolver.sonatypeSnapshots, // sonatype
Opts.resolver.sonatypeReleases
)
)
// Shared settings for the BuildInfo Plugin
// See https://github.com/sbt/sbt-buildinfo
lazy val buildInfoSettings = Seq(
buildInfoKeys := Seq[BuildInfoKey](
name,
packageName,
version,
scalaVersion,
sbtVersion,
apiURL
),
buildInfoPackage := "buildinfo",
buildInfoObject := "BuildInfo"
)
lazy val noPublishSettings = publish / skip := true
/* PROJECT and MODULE settings */
// Root project: rdfshape
lazy val rdfshape = project
.in(file("."))
.aggregate(server, docs)
.dependsOn(server)
.enablePlugins(
BuildInfoPlugin,
SbtNativePackager,
JavaAppPackaging
)
.disablePlugins(RevolverPlugin)
.settings(
// Pre-existing settings
compilationSettings,
packagingSettings,
publishSettings,
resolverSettings,
scaladocSettings,
sharedDependencies,
buildInfoSettings,
// Custom settings
name := (Global / packageName).value,
moduleName := (Global / packageName).value,
run / fork := true,
trapExit := false,
reStartArgs := Seq("--server"),
crossScalaVersions := Nil,
libraryDependencies ++= Seq(
logbackClassic,
scalaLogging
),
excludeDependencies ++= Seq(
// Exclude slf4j backend if present in other dependencies to avoid
// warnings/conflicts with logback
ExclusionRule("org.slf4j", "slf4j-simple")
)
)
// Server project in /modules: server
lazy val server = project
.in(file("modules/server"))
.settings(
// Pre-existing settings
compilationSettings,
publishSettings,
resolverSettings,
scaladocSettings,
sharedDependencies,
// Custom settings
name := s"${(Global / packageName).value}-server",
moduleName := s"${(Global / packageName).value}-server",
run / fork := false,
testFrameworks += MUnitFramework,
libraryDependencies ++= Seq(
http4sDsl,
http4sBlazeServer,
http4sBlazeClient,
http4sEmberClient,
http4sCirce,
rho_swagger,
comet,
umlShaclex,
shexs,
shaclex,
any23_core,
any23_api,
any23_scraper,
rdf4j_runtime,
plantuml,
graphvizJava,
scalaj,
wesoUtils % Test,
munitEffect % Test,
mongo4catsCore,
mongo4catsCirce
)
)
// "sbt-github-actions" plugin settings
lazy val scala212 = "2.12.17"
lazy val scala213 = "2.13.10"
lazy val Java11 = JavaSpec.temurin("11")
ThisBuild / githubWorkflowJavaVersions := Seq(Java11)
ThisBuild / githubWorkflowScalaVersions := Seq(scala213)
/* ------------------------------------------------------------------------- */
// Documentation project, for MDoc + Docusaurus documentation
lazy val docs = project
.in(file("rdfshape-docs"))
.dependsOn()
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)
.settings(
// Pre-existing settings
unidocSettings,
mdocSettings,
noPublishSettings,
// Custom settings
name := s"${(Global / packageName).value}-api-docs",
moduleName := s"${(Global / packageName).value}-api-docs"
)
lazy val MUnitFramework = new TestFramework("munit.Framework")
/* DEPENDENCY versions */
lazy val http4sVersion = "1.0.0-M30"
lazy val rhoVersion = "0.23.0-M1"
lazy val catsVersion = "2.7.0"
lazy val cometVersion = "0.1.7"
/* ------------------------------------------------------------------------- */
lazy val mongodbVersion = "4.6.0"
lazy val mongo4catsVersion = "0.4.8"
lazy val any23Version = "2.7"
lazy val rdf4jVersion = "4.0.0"
lazy val graphvizJavaVersion = "0.18.1"
lazy val logbackVersion = "1.2.11"
lazy val scalaLoggingVersion = "3.9.4"
lazy val munitVersion = "0.7.29"
lazy val munitEffectVersion = "1.0.7"
lazy val plantumlVersion = "1.2021.14"
lazy val scalajVersion = "2.4.2"
// WESO dependencies
lazy val shaclexVersion = "0.2.4"
lazy val shexsVersion = "0.2.33"
lazy val umlShaclexVersion = "0.1.3"
lazy val wesoUtilsVersion = "0.2.25"
// Dependency modules
lazy val http4sDsl = "org.http4s" %% "http4s-dsl" % http4sVersion
lazy val http4sBlazeServer =
"org.http4s" %% "http4s-blaze-server" % http4sVersion
lazy val http4sBlazeClient =
"org.http4s" %% "http4s-blaze-client" % http4sVersion
lazy val http4sEmberClient =
"org.http4s" %% "http4s-ember-client" % http4sVersion
lazy val http4sCirce = "org.http4s" %% "http4s-circe" % http4sVersion
lazy val rho_swagger = "org.http4s" %% "rho-swagger" % rhoVersion
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
lazy val catsKernel = "org.typelevel" %% "cats-kernel" % catsVersion
lazy val comet = "io.github.ulitol97" %% "comet" % cometVersion
lazy val mongodb = "org.mongodb.scala" %% "mongo-scala-driver" % mongodbVersion
lazy val mongo4catsCore =
"io.github.kirill5k" %% "mongo4cats-core" % mongo4catsVersion
lazy val mongo4catsCirce =
"io.github.kirill5k" %% "mongo4cats-circe" % mongo4catsVersion
lazy val any23_core = "org.apache.any23" % "apache-any23-core" % any23Version
lazy val any23_api = "org.apache.any23" % "apache-any23-api" % any23Version
lazy val any23_scraper =
"org.apache.any23.plugins" % "apache-any23-html-scraper" % "2.3"
lazy val rdf4j_runtime = "org.eclipse.rdf4j" % "rdf4j-runtime" % rdf4jVersion
lazy val graphvizJava = "guru.nidi" % "graphviz-java" % graphvizJavaVersion
//noinspection SbtDependencyVersionInspection
lazy val plantuml = "net.sourceforge.plantuml" % "plantuml" % plantumlVersion
lazy val logbackClassic = "ch.qos.logback" % "logback-classic" % logbackVersion
lazy val scalaLogging =
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion
lazy val munit = "org.scalameta" %% "munit" % munitVersion
lazy val munitEffect =
"org.typelevel" %% "munit-cats-effect-3" % munitEffectVersion
lazy val scalaj = "org.scalaj" %% "scalaj-http" % scalajVersion
// WESO dependencies
lazy val shexs = "es.weso" %% "shexs" % shexsVersion
lazy val shaclex = "es.weso" %% "shaclex" % shaclexVersion
lazy val umlShaclex = "es.weso" %% "umlshaclex" % umlShaclexVersion
lazy val wesoUtils = "es.weso" %% "utilstest" % wesoUtilsVersion