~wegtam/smederee
~wegtam/smederee/build.sbt
~wegtam/smederee/build.sbt
0 | // ***************************************************************************** |
1 | // Build settings |
2 | // ***************************************************************************** |
3 |
|
4 | addCommandAlias("check", "Compile/scalafix --check; Test/scalafix --check; headerCheckAll; scalafmtCheckAll") |
5 | addCommandAlias("fix", "headerCreate; Compile/scalafix; Test/scalafix; scalafmtSbt; scalafmtAll") |
6 |
|
7 | // Enable the semanticdb compiler plugin needed by the metals language server. |
8 | Global / semanticdbEnabled := true |
9 |
|
10 | inThisBuild( |
11 | Seq( |
12 | scalaVersion := "3.3.4", |
13 | organization := "de.smederee", |
14 | organizationName := "Contributors as noted in the AUTHORS.md file", |
15 | version := "0.16.0-SNAPSHOT", |
16 | scalacOptions ++= Seq( |
17 | "-deprecation", |
18 | "-explain", |
19 | "-explain-types", |
20 | "-feature", |
21 | "-language:higherKinds", |
22 | "-language:implicitConversions", |
23 | "-no-indent", // Prevent usage of indent based syntax. |
24 | "-old-syntax", // Enforce classic syntax. |
25 | "-unchecked", |
26 | "-Wunused:imports", // Warn on unused imports including given and wildcard imports. |
27 | "-Wunused:linted", // TODO: Find out what this does! |
28 | "-Wunused:locals", // Warn on unused local definitions. |
29 | "-Wunused:nowarn", // Warn on unused (useless) `@nowarn` annotations. |
30 | "-Wunused:params", // Warn on unused parameters. |
31 | "-Wunused:privates", // Warn on unused private definitions. |
32 | "-Wunused:unsafe-warn-patvars", // TODO: Find out what this does! |
33 | "-Wvalue-discard", // Warn on discarding computed values. |
34 | // "-Xfatal-warnings", // FIXME: Make this work despite of Twirl! |
35 | "-Ykind-projector" |
36 | ), |
37 | coverageExcludedPackages := "<empty>;.*\\.views\\.html.*;.*\\.views\\.txt.*;.*\\.views\\.xml.*;", |
38 | resolvers += "jitpack" at "https://jitpack.io", // for JANSI fork |
39 | Compile / console / scalacOptions --= Seq("-Xfatal-warnings"), |
40 | Test / console / scalacOptions --= Seq("-Xfatal-warnings"), |
41 | Test / fork := true, |
42 | Test / parallelExecution := false, |
43 | Test / testOptions += Tests.Argument(TestFrameworks.MUnit, "-b") |
44 | ) |
45 | ) |
46 |
|
47 | // ***************************************************************************** |
48 | // Projects |
49 | // ***************************************************************************** |
50 |
|
51 | lazy val smederee = |
52 | project |
53 | .in(file(".")) |
54 | .settings(commonSettings) |
55 | .settings( |
56 | name := "smederee", |
57 | publish := {}, |
58 | publishLocal := {} |
59 | ) |
60 | .aggregate(darcs, email, htmlUtils, hub, i18n, security, twirl) |
61 |
|
62 | lazy val darcs = |
63 | project |
64 | .in(file("modules/darcs")) |
65 | .enablePlugins(AutomateHeaderPlugin) |
66 | .settings(commonSettings) |
67 | .settings( |
68 | name := "darcs", |
69 | scalacOptions += "-Xfatal-warnings", |
70 | libraryDependencies ++= Seq( |
71 | library.catsCore, |
72 | library.catsEffect, |
73 | library.logback, |
74 | library.osLib, |
75 | library.munit % Test, |
76 | library.munitCatsEffect % Test, |
77 | library.munitScalaCheck % Test, |
78 | library.scalaCheck % Test |
79 | ) |
80 | ) |
81 |
|
82 | lazy val email = |
83 | project |
84 | .in(file("modules/email")) |
85 | .enablePlugins(AutomateHeaderPlugin) |
86 | .settings(commonSettings) |
87 | .settings( |
88 | name := "email", |
89 | scalacOptions += "-Xfatal-warnings", |
90 | libraryDependencies ++= Seq( |
91 | library.catsCore, |
92 | library.catsEffect, |
93 | library.ip4sCore, |
94 | library.logback, |
95 | library.simpleJavaMail, |
96 | library.munit % Test, |
97 | library.munitCatsEffect % Test, |
98 | library.munitScalaCheck % Test, |
99 | library.scalaCheck % Test |
100 | ) |
101 | ) |
102 |
|
103 | lazy val htmlUtils = |
104 | project |
105 | .in(file("modules/html-utils")) |
106 | .enablePlugins(AutomateHeaderPlugin) |
107 | .settings(commonSettings) |
108 | .settings( |
109 | name := "html-utils", |
110 | scalacOptions += "-Xfatal-warnings", |
111 | libraryDependencies ++= Seq( |
112 | library.catsCore, |
113 | library.http4sCore, |
114 | library.ip4sCore, |
115 | library.laikaCore, |
116 | library.logback, |
117 | library.munit % Test, |
118 | library.munitScalaCheck % Test, |
119 | library.scalaCheck % Test |
120 | ) |
121 | ) |
122 |
|
123 | lazy val hub = |
124 | project |
125 | .in(file("modules/hub")) |
126 | .dependsOn(darcs, email, htmlUtils, i18n, security, twirl) |
127 | .enablePlugins( |
128 | AutomateHeaderPlugin, |
129 | BuildInfoPlugin, |
130 | DebianPlugin, |
131 | JavaServerAppPackaging, |
132 | JDebPackaging, |
133 | RpmPlugin, |
134 | SbtTwirl, |
135 | SystemdPlugin |
136 | ) |
137 | .settings(commonSettings) |
138 | .settings( |
139 | name := "smederee-hub", |
140 | buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion), |
141 | buildInfoPackage := "de.smederee.hub", |
142 | libraryDependencies ++= Seq( |
143 | library.apacheSshdCore, |
144 | library.apacheSshdSftp, |
145 | library.apacheSshdScp, |
146 | library.bouncyCastleProvider, |
147 | library.catsCore, |
148 | library.circeCore, |
149 | library.circeGeneric, |
150 | library.circeParser, |
151 | library.doobieCore, |
152 | library.doobieHikari, |
153 | library.doobiePostgres, |
154 | library.ed25519Java, // FIXME: Replace with BouncyCastle once implemented in Mina-SSHD! |
155 | library.flywayCore, |
156 | library.flywayPostgreSQL, |
157 | library.http4sCirce, |
158 | library.http4sCore, |
159 | library.http4sDsl, |
160 | library.http4sEmberClient, |
161 | library.http4sEmberServer, |
162 | // library.http4sTwirl, |
163 | library.jansi, |
164 | library.jclOverSlf4j, // Bridge Java Commons Logging to SLF4J. |
165 | library.log4catsSlf4j, |
166 | library.logback, |
167 | library.monocleCore, |
168 | library.monocleMacro, |
169 | library.osLib, |
170 | library.postgresql, |
171 | library.pureConfig, |
172 | library.springSecurityCrypto, |
173 | library.munit % Test, |
174 | library.munitCatsEffect % Test, |
175 | library.munitScalaCheck % Test, |
176 | library.scalaCheck % Test, |
177 | library.scalaCheckEffect % Test |
178 | ), |
179 | TwirlKeys.templateImports ++= Seq( |
180 | "cats.*", |
181 | "cats.data.*", |
182 | "cats.syntax.all.*", |
183 | "de.smederee.html.*", |
184 | "de.smederee.i18n.*", |
185 | "de.smederee.security.{ CsrfToken, UserId, Username }", |
186 | "org.http4s.Uri" |
187 | ) |
188 | ) |
189 | .settings( |
190 | Seq( |
191 | daemonUser := "smederee", |
192 | daemonGroup := "smederee", |
193 | Debian / debianPackageProvides += "smederee-hub", |
194 | Debian / debianPackageDependencies += "openjdk-17-jre-headless", |
195 | defaultLinuxInstallLocation := "/usr/local/share", |
196 | maintainer := "Wegtam GmbH <devops@wegtam.com>", |
197 | rpmLicense := Option("EUPL 1.2 or later"), |
198 | rpmVendor := "Wegtam GmbH <devops@wegtam.com>", |
199 | // Require a service restart after installation / update. |
200 | Debian / maintainerScripts := maintainerScriptsAppend((Debian / maintainerScripts).value)( |
201 | DebianConstants.Postinst -> s"restartService ${normalizedName.value}" |
202 | ), |
203 | // Require a service restart after installation / update. |
204 | Rpm / maintainerScripts := maintainerScriptsAppend((Rpm / maintainerScripts).value)( |
205 | RpmConstants.Post -> s"restartService ${normalizedName.value}" |
206 | ), |
207 | packageSummary := "Smederee Hub Service - Software collaboration platform.", |
208 | packageDescription := "Leverage the power of the darcs vcs to handle your projects with ease and confidence, this is the central hub service", |
209 | // Debian / requiredStartFacilities := Option("$local_fs $remote_fs $network $postgresql"), |
210 | // Do not package API docs. |
211 | Compile / packageDoc / publishArtifact := false, |
212 | Compile / doc / sources := Seq.empty, |
213 | // Prevent a customised local application.conf file to be packaged! |
214 | Compile / packageBin / mappings ~= { files => |
215 | files.filterNot { case (_, name) => |
216 | name == "application.conf" |
217 | } |
218 | } |
219 | ) |
220 | ) |
221 |
|
222 | lazy val i18n = |
223 | project |
224 | .in(file("modules/i18n")) |
225 | .enablePlugins(AutomateHeaderPlugin) |
226 | .settings(commonSettings) |
227 | .settings( |
228 | name := "i18n", |
229 | scalacOptions += "-Xfatal-warnings", |
230 | libraryDependencies ++= Seq( |
231 | library.catsCore, |
232 | library.logback, |
233 | library.munit % Test, |
234 | library.munitScalaCheck % Test, |
235 | library.scalaCheck % Test |
236 | ) |
237 | ) |
238 |
|
239 | lazy val security = |
240 | project |
241 | .in(file("modules/security")) |
242 | .enablePlugins(AutomateHeaderPlugin) |
243 | .settings(commonSettings) |
244 | .settings( |
245 | name := "security", |
246 | scalacOptions += "-Xfatal-warnings", |
247 | libraryDependencies ++= Seq( |
248 | library.bouncyCastleProvider % Runtime, |
249 | library.catsCore, |
250 | library.jclOverSlf4j, // Bridge Java Commons Logging to SLF4J. |
251 | library.logback, |
252 | library.springSecurityCrypto, |
253 | library.munit % Test, |
254 | library.munitScalaCheck % Test, |
255 | library.scalaCheck % Test |
256 | ) |
257 | ) |
258 |
|
259 | // FIXME: This is a workaround until http4s-twirl gets published properly for Scala 3! |
260 | lazy val twirl = |
261 | project |
262 | .in(file("twirl")) |
263 | .enablePlugins(SbtTwirl) |
264 | .settings(commonSettings) |
265 | .settings( |
266 | name := "twirl", |
267 | version := "0.1.0", |
268 | libraryDependencies += library.http4sCore |
269 | ) |
270 |
|
271 | // ***************************************************************************** |
272 | // Library dependencies |
273 | // ***************************************************************************** |
274 |
|
275 | lazy val library = |
276 | new { |
277 | object Version { |
278 | val apacheSshd = "2.14.0" |
279 | val bouncyCastle = "1.79" |
280 | val cats = "2.12.0" |
281 | val catsEffect = "3.5.7" |
282 | val circe = "0.14.10" |
283 | val doobie = "1.0.0-RC6" |
284 | val flyway = "11.0.0" |
285 | val fs2 = "3.5.0" |
286 | val http4s = "1.0.0-M43" |
287 | val ip4s = "3.6.0" |
288 | val jansi = "2.4.6" |
289 | val jclOverSlf4j = "2.0.16" |
290 | val laika = "1.2.1" |
291 | val log4cats = "2.7.0" |
292 | val logback = "1.5.12" |
293 | val monocle = "3.3.0" |
294 | val munit = "1.0.3" |
295 | val munitCatsEffect = "2.0.0" |
296 | val munitScalaCheck = "1.0.0" |
297 | val osLib = "0.11.3" |
298 | val postgresql = "42.7.4" |
299 | val pureConfig = "0.17.8" |
300 | val scalaCheck = "1.18.1" |
301 | val scalaCheckEffect = "1.0.4" |
302 | val simpleJavaMail = "8.12.3" |
303 | val springSecurity = "6.4.1" |
304 | } |
305 | val apacheSshdCore = "org.apache.sshd" % "sshd-core" % Version.apacheSshd |
306 | val apacheSshdSftp = "org.apache.sshd" % "sshd-sftp" % Version.apacheSshd |
307 | val apacheSshdScp = "org.apache.sshd" % "sshd-scp" % Version.apacheSshd |
308 | val bouncyCastleProvider = "org.bouncycastle" % "bcprov-jdk18on" % Version.bouncyCastle |
309 | val catsCore = "org.typelevel" %% "cats-core" % Version.cats |
310 | val catsEffect = "org.typelevel" %% "cats-effect" % Version.catsEffect |
311 | val circeCore = "io.circe" %% "circe-core" % Version.circe |
312 | val circeGeneric = "io.circe" %% "circe-generic" % Version.circe |
313 | val circeParser = "io.circe" %% "circe-parser" % Version.circe |
314 | val doobieCore = "org.tpolecat" %% "doobie-core" % Version.doobie |
315 | val doobieHikari = "org.tpolecat" %% "doobie-hikari" % Version.doobie |
316 | val doobiePostgres = "org.tpolecat" %% "doobie-postgres" % Version.doobie |
317 | val doobieScalaTest = "org.tpolecat" %% "doobie-scalatest" % Version.doobie |
318 | val ed25519Java = "net.i2p.crypto" % "eddsa" % "0.3.0" |
319 | val flywayCore = "org.flywaydb" % "flyway-core" % Version.flyway |
320 | val flywayPostgreSQL = "org.flywaydb" % "flyway-database-postgresql" % Version.flyway |
321 | val fs2Core = "co.fs2" %% "fs2-core" % Version.fs2 |
322 | val fs2IO = "co.fs2" %% "fs2-io" % Version.fs2 |
323 | val http4sCirce = "org.http4s" %% "http4s-circe" % Version.http4s |
324 | val http4sCore = "org.http4s" %% "http4s-core" % Version.http4s |
325 | val http4sDsl = "org.http4s" %% "http4s-dsl" % Version.http4s |
326 | val http4sEmberServer = "org.http4s" %% "http4s-ember-server" % Version.http4s |
327 | val http4sEmberClient = "org.http4s" %% "http4s-ember-client" % Version.http4s |
328 | val ip4sCore = "com.comcast" %% "ip4s-core" % Version.ip4s |
329 | val jansi = "com.github.Osiris-Team" % "jansi" % Version.jansi |
330 | val jclOverSlf4j = "org.slf4j" % "jcl-over-slf4j" % Version.jclOverSlf4j |
331 | val laikaCore = "org.typelevel" %% "laika-core" % Version.laika |
332 | val log4catsSlf4j = "org.typelevel" %% "log4cats-slf4j" % Version.log4cats |
333 | val logback = "ch.qos.logback" % "logback-classic" % Version.logback |
334 | val monocleCore = "dev.optics" %% "monocle-core" % Version.monocle |
335 | val monocleMacro = "dev.optics" %% "monocle-macro" % Version.monocle |
336 | val munit = "org.scalameta" %% "munit" % Version.munit |
337 | val munitCatsEffect = "org.typelevel" %% "munit-cats-effect" % Version.munitCatsEffect |
338 | val munitScalaCheck = "org.scalameta" %% "munit-scalacheck" % Version.munitScalaCheck |
339 | val osLib = "com.lihaoyi" %% "os-lib" % Version.osLib |
340 | val postgresql = "org.postgresql" % "postgresql" % Version.postgresql |
341 | val pureConfig = "com.github.pureconfig" %% "pureconfig-core" % Version.pureConfig |
342 | val scalaCheck = "org.scalacheck" %% "scalacheck" % Version.scalaCheck |
343 | val scalaCheckEffect = "org.typelevel" %% "scalacheck-effect-munit" % Version.scalaCheckEffect |
344 | val simpleJavaMail = "org.simplejavamail" % "simple-java-mail" % Version.simpleJavaMail |
345 | val springSecurityCrypto = "org.springframework.security" % "spring-security-crypto" % Version.springSecurity |
346 | } |
347 |
|
348 | // ***************************************************************************** |
349 | // Settings |
350 | // ***************************************************************************** |
351 |
|
352 | lazy val commonSettings = |
353 | codeSettings ++ |
354 | scalafmtSettings |
355 |
|
356 | lazy val codeSettings = |
357 | Seq( |
358 | startYear := Option(2022), |
359 | headerLicense := startYear.value.map(year => |
360 | HeaderLicense.Custom( |
361 | s"""|Copyright (c) $year ${organizationName.value} |
362 | | |
363 | |Licensed under the EUPL""".stripMargin |
364 | ) |
365 | ) |
366 | ) |
367 |
|
368 | lazy val scalafmtSettings = |
369 | Seq( |
370 | scalafmtOnCompile := false |
371 | ) |