2019-07-17 20:03:10 +00:00
|
|
|
|
import com.github.eikek.sbt.openapi._
|
|
|
|
|
import scala.sys.process._
|
|
|
|
|
import com.typesafe.sbt.SbtGit.GitKeys._
|
2019-07-22 22:53:30 +00:00
|
|
|
|
import docspell.build._
|
2021-07-04 08:15:30 +00:00
|
|
|
|
import de.heikoseeberger.sbtheader.CommentBlockCreator
|
2019-07-17 20:03:10 +00:00
|
|
|
|
|
2021-09-22 15:23:24 +00:00
|
|
|
|
val toolsPackage = taskKey[Seq[File]]("Package the scripts/extension tools")
|
2019-12-29 19:52:43 +00:00
|
|
|
|
val elmCompileMode = settingKey[ElmCompileMode]("How to compile elm sources")
|
|
|
|
|
|
2020-05-06 20:04:51 +00:00
|
|
|
|
// --- Settings
|
|
|
|
|
|
2021-06-26 21:33:25 +00:00
|
|
|
|
def inTest(d0: Seq[ModuleID], ds: Seq[ModuleID]*) =
|
|
|
|
|
ds.fold(d0)(_ ++ _).map(_ % Test)
|
|
|
|
|
|
2020-06-28 18:47:19 +00:00
|
|
|
|
val scalafixSettings = Seq(
|
2021-09-22 15:23:24 +00:00
|
|
|
|
semanticdbEnabled := true, // enable SemanticDB
|
2020-11-27 22:47:51 +00:00
|
|
|
|
semanticdbVersion := scalafixSemanticdb.revision, //"4.4.0"
|
2020-06-28 18:47:19 +00:00
|
|
|
|
ThisBuild / scalafixDependencies ++= Dependencies.organizeImports
|
|
|
|
|
)
|
|
|
|
|
|
2019-07-17 20:03:10 +00:00
|
|
|
|
val sharedSettings = Seq(
|
2021-09-22 15:23:24 +00:00
|
|
|
|
organization := "com.github.eikek",
|
|
|
|
|
scalaVersion := "2.13.6",
|
2021-09-21 20:23:56 +00:00
|
|
|
|
organizationName := "Eike K. & Contributors",
|
|
|
|
|
licenses += ("AGPL-3.0-or-later", url(
|
|
|
|
|
"https://spdx.org/licenses/AGPL-3.0-or-later.html"
|
2021-07-04 08:15:30 +00:00
|
|
|
|
)),
|
2021-09-22 15:23:24 +00:00
|
|
|
|
startYear := Some(2020),
|
|
|
|
|
headerLicenseStyle := HeaderLicenseStyle.SpdxSyntax,
|
2021-07-04 08:15:30 +00:00
|
|
|
|
headerSources / excludeFilter := HiddenFileFilter || "*.java" || "StringUtil.scala",
|
2019-07-17 20:03:10 +00:00
|
|
|
|
scalacOptions ++= Seq(
|
|
|
|
|
"-deprecation",
|
2020-07-30 18:32:04 +00:00
|
|
|
|
"-encoding",
|
|
|
|
|
"UTF-8",
|
2019-07-17 20:03:10 +00:00
|
|
|
|
"-language:higherKinds",
|
|
|
|
|
"-feature",
|
2019-07-22 22:53:30 +00:00
|
|
|
|
"-Werror", // fail when there are warnings
|
2019-07-17 20:03:10 +00:00
|
|
|
|
"-unchecked",
|
2020-07-31 23:03:43 +00:00
|
|
|
|
// remove -byname-implicit, once https://github.com/scala/bug/issues/12072 is resolved
|
|
|
|
|
"-Xlint:-byname-implicit,_",
|
2019-09-28 20:17:45 +00:00
|
|
|
|
"-Wdead-code",
|
|
|
|
|
"-Wunused",
|
|
|
|
|
"-Wvalue-discard",
|
|
|
|
|
"-Wnumeric-widen"
|
2019-07-17 20:03:10 +00:00
|
|
|
|
),
|
2021-06-15 23:04:35 +00:00
|
|
|
|
javacOptions ++= Seq("-target", "1.8", "-source", "1.8"),
|
2020-07-30 18:32:04 +00:00
|
|
|
|
LocalRootProject / toolsPackage := {
|
2021-09-22 15:23:24 +00:00
|
|
|
|
val v = version.value
|
2020-01-19 19:32:52 +00:00
|
|
|
|
val logger = streams.value.log
|
2021-09-22 15:23:24 +00:00
|
|
|
|
val dir = (LocalRootProject / baseDirectory).value / "tools"
|
2020-01-19 19:32:52 +00:00
|
|
|
|
packageTools(logger, dir, v)
|
|
|
|
|
},
|
2021-04-10 15:16:01 +00:00
|
|
|
|
Compile / console / scalacOptions :=
|
2021-01-10 07:45:31 +00:00
|
|
|
|
(scalacOptions.value.filter(o => !o.contains("-Xlint") && !o.contains("-W"))),
|
2021-04-10 15:16:01 +00:00
|
|
|
|
Test / console / scalacOptions :=
|
2021-08-21 09:02:29 +00:00
|
|
|
|
(scalacOptions.value.filter(o => !o.contains("-Xlint") && !o.contains("-W"))),
|
|
|
|
|
libraryDependencySchemes ++= Seq(
|
2021-09-22 15:23:24 +00:00
|
|
|
|
"com.github.eikek" %% "calev-core" % VersionScheme.Always,
|
2021-08-21 09:02:29 +00:00
|
|
|
|
"com.github.eikek" %% "calev-circe" % VersionScheme.Always
|
|
|
|
|
)
|
2020-06-28 18:47:19 +00:00
|
|
|
|
) ++ scalafixSettings
|
2019-07-17 20:03:10 +00:00
|
|
|
|
|
2021-02-28 20:15:21 +00:00
|
|
|
|
val testSettingsMUnit = Seq(
|
2021-06-26 21:33:25 +00:00
|
|
|
|
libraryDependencies ++= inTest(Dependencies.munit, Dependencies.logging),
|
2021-02-28 20:15:21 +00:00
|
|
|
|
testFrameworks += new TestFramework("munit.Framework")
|
|
|
|
|
)
|
|
|
|
|
|
2020-03-17 21:34:50 +00:00
|
|
|
|
lazy val noPublish = Seq(
|
2021-09-22 15:23:24 +00:00
|
|
|
|
publish := {},
|
|
|
|
|
publishLocal := {},
|
2020-03-17 21:34:50 +00:00
|
|
|
|
publishArtifact := false
|
|
|
|
|
)
|
|
|
|
|
|
2019-07-17 20:03:10 +00:00
|
|
|
|
val elmSettings = Seq(
|
2019-12-29 19:52:43 +00:00
|
|
|
|
elmCompileMode := ElmCompileMode.Debug,
|
2020-07-30 18:32:04 +00:00
|
|
|
|
Compile / resourceGenerators += Def.task {
|
2021-01-29 19:44:36 +00:00
|
|
|
|
val _ = openapiCodegen.value
|
2020-07-30 18:32:04 +00:00
|
|
|
|
compileElm(
|
|
|
|
|
streams.value.log,
|
|
|
|
|
(Compile / baseDirectory).value,
|
|
|
|
|
(Compile / resourceManaged).value,
|
|
|
|
|
name.value,
|
|
|
|
|
version.value,
|
|
|
|
|
elmCompileMode.value
|
|
|
|
|
)
|
2019-07-22 22:53:30 +00:00
|
|
|
|
}.taskValue,
|
2019-07-17 20:03:10 +00:00
|
|
|
|
watchSources += Watched.WatchSource(
|
2020-07-30 18:32:04 +00:00
|
|
|
|
(Compile / sourceDirectory).value / "elm",
|
|
|
|
|
FileFilter.globFilter("*.elm"),
|
|
|
|
|
HiddenFileFilter
|
2021-07-04 08:15:30 +00:00
|
|
|
|
),
|
|
|
|
|
Compile / unmanagedSourceDirectories += (Compile / sourceDirectory).value / "elm",
|
|
|
|
|
headerSources / includeFilter := "*.elm",
|
|
|
|
|
headerMappings := headerMappings.value + (HeaderFileType("elm") -> HeaderCommentStyle(
|
2021-07-25 11:59:48 +00:00
|
|
|
|
new CommentBlockCreator("{-", " ", "-}\n"),
|
|
|
|
|
HeaderPattern.commentBetween("\\{\\-", " ", "\\-\\}")
|
2021-07-04 08:15:30 +00:00
|
|
|
|
))
|
2019-07-17 20:03:10 +00:00
|
|
|
|
)
|
2021-01-29 19:44:36 +00:00
|
|
|
|
val stylesSettings = Seq(
|
|
|
|
|
stylesMode := StylesMode.Dev,
|
|
|
|
|
Compile / resourceGenerators += stylesBuild.taskValue
|
|
|
|
|
)
|
2019-07-17 20:03:10 +00:00
|
|
|
|
|
2021-03-01 23:51:13 +00:00
|
|
|
|
def webjarSettings(queryJS: Project) = Seq(
|
2020-07-30 18:32:04 +00:00
|
|
|
|
Compile / resourceGenerators += Def.task {
|
|
|
|
|
copyWebjarResources(
|
2021-04-10 15:16:01 +00:00
|
|
|
|
Seq((Compile / sourceDirectory).value / "webjar"),
|
2020-07-30 18:32:04 +00:00
|
|
|
|
(Compile / resourceManaged).value,
|
|
|
|
|
name.value,
|
|
|
|
|
version.value,
|
|
|
|
|
streams.value.log
|
2019-07-17 20:03:10 +00:00
|
|
|
|
)
|
2019-07-22 22:53:30 +00:00
|
|
|
|
}.taskValue,
|
2021-03-01 23:51:13 +00:00
|
|
|
|
Compile / resourceGenerators += Def.task {
|
|
|
|
|
val logger = streams.value.log
|
2021-09-22 15:23:24 +00:00
|
|
|
|
val out = (queryJS / Compile / fullOptJS).value
|
2021-03-01 23:51:13 +00:00
|
|
|
|
logger.info(s"Produced query js file: ${out.data}")
|
|
|
|
|
copyWebjarResources(
|
|
|
|
|
Seq(out.data),
|
2021-04-10 14:31:58 +00:00
|
|
|
|
(Compile / resourceManaged).value,
|
2021-03-01 23:51:13 +00:00
|
|
|
|
name.value,
|
|
|
|
|
version.value,
|
|
|
|
|
logger
|
|
|
|
|
)
|
|
|
|
|
}.taskValue,
|
2019-07-17 20:03:10 +00:00
|
|
|
|
watchSources += Watched.WatchSource(
|
2020-07-30 18:32:04 +00:00
|
|
|
|
(Compile / sourceDirectory).value / "webjar",
|
|
|
|
|
FileFilter.globFilter("*.js") || FileFilter.globFilter("*.css"),
|
|
|
|
|
HiddenFileFilter
|
2019-07-17 20:03:10 +00:00
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
2020-07-30 18:32:04 +00:00
|
|
|
|
def debianSettings(cfgFile: String) =
|
|
|
|
|
Seq(
|
2021-07-04 08:15:30 +00:00
|
|
|
|
maintainer := "Eike Kettner <eikek@posteo.de>",
|
2021-04-10 15:16:01 +00:00
|
|
|
|
Universal / mappings += {
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val conf = (Compile / resourceDirectory).value / "reference.conf"
|
|
|
|
|
if (!conf.exists)
|
|
|
|
|
sys.error(s"File $conf not found")
|
|
|
|
|
conf -> s"conf/$cfgFile.conf"
|
|
|
|
|
},
|
2020-10-19 23:07:23 +00:00
|
|
|
|
daemonUser := "docspell",
|
2020-07-30 18:32:04 +00:00
|
|
|
|
bashScriptExtraDefines += s"""addJava "-Dconfig.file=$${app_home}/../conf/$cfgFile.conf""""
|
|
|
|
|
)
|
2019-07-17 20:03:10 +00:00
|
|
|
|
|
|
|
|
|
val buildInfoSettings = Seq(
|
2020-07-30 18:32:04 +00:00
|
|
|
|
buildInfoKeys := Seq[BuildInfoKey](
|
|
|
|
|
name,
|
|
|
|
|
version,
|
|
|
|
|
scalaVersion,
|
|
|
|
|
sbtVersion,
|
|
|
|
|
gitHeadCommit,
|
|
|
|
|
gitHeadCommitDate,
|
|
|
|
|
gitUncommittedChanges,
|
|
|
|
|
gitDescribedVersion
|
|
|
|
|
),
|
2019-07-17 20:03:10 +00:00
|
|
|
|
buildInfoOptions += BuildInfoOption.ToJson,
|
|
|
|
|
buildInfoOptions += BuildInfoOption.BuildTime
|
|
|
|
|
)
|
|
|
|
|
|
2019-07-22 22:53:30 +00:00
|
|
|
|
val openapiScalaSettings = Seq(
|
2020-07-30 18:32:04 +00:00
|
|
|
|
openapiScalaConfig := ScalaConfig()
|
|
|
|
|
.withJson(ScalaJson.circeSemiauto)
|
2021-08-19 06:50:30 +00:00
|
|
|
|
.addMapping(CustomMapping.forType { case TypeDef("LocalDateTime", _) =>
|
2020-11-11 00:08:07 +00:00
|
|
|
|
TypeDef("Timestamp", Imports("docspell.common.Timestamp"))
|
2021-08-19 06:50:30 +00:00
|
|
|
|
})
|
|
|
|
|
.addMapping(CustomMapping.forFormatType {
|
2020-07-30 18:32:04 +00:00
|
|
|
|
case "ident" =>
|
|
|
|
|
field => field.copy(typeDef = TypeDef("Ident", Imports("docspell.common.Ident")))
|
2021-01-04 15:32:54 +00:00
|
|
|
|
case "accountid" =>
|
2021-01-19 00:20:13 +00:00
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("AccountId", Imports("docspell.common.AccountId")))
|
2020-07-30 18:32:04 +00:00
|
|
|
|
case "collectivestate" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef =
|
|
|
|
|
TypeDef("CollectiveState", Imports("docspell.common.CollectiveState"))
|
|
|
|
|
)
|
|
|
|
|
case "userstate" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("UserState", Imports("docspell.common.UserState")))
|
|
|
|
|
case "password" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("Password", Imports("docspell.common.Password")))
|
|
|
|
|
case "contactkind" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef =
|
|
|
|
|
TypeDef("ContactKind", Imports("docspell.common.ContactKind"))
|
|
|
|
|
)
|
|
|
|
|
case "direction" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("Direction", Imports("docspell.common.Direction")))
|
|
|
|
|
case "priority" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("Priority", Imports("docspell.common.Priority")))
|
|
|
|
|
case "jobstate" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("JobState", Imports("docspell.common.JobState")))
|
|
|
|
|
case "loglevel" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("LogLevel", Imports("docspell.common.LogLevel")))
|
|
|
|
|
case "mimetype" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("MimeType", Imports("docspell.common.MimeType")))
|
|
|
|
|
case "itemstate" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("ItemState", Imports("docspell.common.ItemState")))
|
|
|
|
|
case "nertag" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("NerTag", Imports("docspell.common.NerTag")))
|
|
|
|
|
case "language" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("Language", Imports("docspell.common.Language")))
|
|
|
|
|
case "calevent" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef =
|
|
|
|
|
TypeDef(
|
|
|
|
|
"CalEvent",
|
|
|
|
|
Imports(
|
|
|
|
|
"com.github.eikek.calev.CalEvent",
|
|
|
|
|
"com.github.eikek.calev.circe.CalevCirceCodec._"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
2020-11-11 00:08:07 +00:00
|
|
|
|
case "glob" =>
|
|
|
|
|
field => field.copy(typeDef = TypeDef("Glob", Imports("docspell.common.Glob")))
|
2020-09-28 20:54:35 +00:00
|
|
|
|
case "customfieldtype" =>
|
2020-12-05 01:59:57 +00:00
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef =
|
|
|
|
|
TypeDef("CustomFieldType", Imports("docspell.common.CustomFieldType"))
|
|
|
|
|
)
|
2021-01-19 00:20:13 +00:00
|
|
|
|
case "listtype" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("ListType", Imports("docspell.common.ListType")))
|
2021-02-16 21:37:56 +00:00
|
|
|
|
case "personuse" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("PersonUse", Imports("docspell.common.PersonUse")))
|
2021-03-10 22:54:04 +00:00
|
|
|
|
case "orguse" =>
|
|
|
|
|
field =>
|
|
|
|
|
field.copy(typeDef = TypeDef("OrgUse", Imports("docspell.common.OrgUse")))
|
|
|
|
|
case "equipmentuse" =>
|
|
|
|
|
field =>
|
2021-04-10 14:31:58 +00:00
|
|
|
|
field.copy(typeDef =
|
|
|
|
|
TypeDef("EquipmentUse", Imports("docspell.common.EquipmentUse"))
|
|
|
|
|
)
|
2021-08-14 13:08:29 +00:00
|
|
|
|
case "searchmode" =>
|
|
|
|
|
field =>
|
|
|
|
|
field
|
|
|
|
|
.copy(typeDef = TypeDef("SearchMode", Imports("docspell.common.SearchMode")))
|
2021-08-15 10:28:42 +00:00
|
|
|
|
case "duration" =>
|
|
|
|
|
field =>
|
|
|
|
|
field
|
|
|
|
|
.copy(typeDef = TypeDef("Duration", Imports("docspell.common.Duration")))
|
2021-08-30 14:15:13 +00:00
|
|
|
|
case "uri" =>
|
|
|
|
|
field =>
|
|
|
|
|
field
|
|
|
|
|
.copy(typeDef = TypeDef("LenientUri", Imports("docspell.common.LenientUri")))
|
2021-09-05 15:08:52 +00:00
|
|
|
|
case "accountsource" =>
|
|
|
|
|
field =>
|
|
|
|
|
field
|
|
|
|
|
.copy(typeDef =
|
|
|
|
|
TypeDef("AccountSource", Imports("docspell.common.AccountSource"))
|
|
|
|
|
)
|
2021-08-19 06:50:30 +00:00
|
|
|
|
})
|
2019-07-22 22:53:30 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// --- Modules
|
2019-07-17 20:03:10 +00:00
|
|
|
|
|
2020-04-29 20:44:05 +00:00
|
|
|
|
// Base module, everything depends on this – including restapi and
|
|
|
|
|
// joexapi modules. This should aim to have least possible
|
|
|
|
|
// dependencies
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val common = project
|
|
|
|
|
.in(file("modules/common"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:32:04 +00:00
|
|
|
|
.settings(
|
2019-07-17 20:03:10 +00:00
|
|
|
|
name := "docspell-common",
|
2021-09-29 21:04:26 +00:00
|
|
|
|
addCompilerPlugin(Dependencies.kindProjectorPlugin),
|
2019-07-17 20:03:10 +00:00
|
|
|
|
libraryDependencies ++=
|
2019-07-22 22:53:30 +00:00
|
|
|
|
Dependencies.fs2 ++
|
2020-07-30 18:32:04 +00:00
|
|
|
|
Dependencies.circe ++
|
|
|
|
|
Dependencies.loggingApi ++
|
|
|
|
|
Dependencies.calevCore ++
|
|
|
|
|
Dependencies.calevCirce ++
|
|
|
|
|
Dependencies.pureconfig.map(_ % "optional")
|
2019-07-17 20:03:10 +00:00
|
|
|
|
)
|
|
|
|
|
|
2020-02-11 21:46:23 +00:00
|
|
|
|
// Some example files for testing
|
|
|
|
|
// https://file-examples.com/index.php/sample-documents-download/sample-doc-download/
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val files = project
|
|
|
|
|
.in(file("modules/files"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:32:04 +00:00
|
|
|
|
.settings(
|
2020-02-14 10:14:09 +00:00
|
|
|
|
name := "docspell-files",
|
2020-02-14 10:09:39 +00:00
|
|
|
|
libraryDependencies ++=
|
2020-03-23 21:43:15 +00:00
|
|
|
|
Dependencies.tika ++
|
2020-07-30 18:32:04 +00:00
|
|
|
|
Dependencies.icu4j,
|
2020-02-14 10:09:39 +00:00
|
|
|
|
Test / sourceGenerators += Def.task {
|
2021-09-22 15:23:24 +00:00
|
|
|
|
val base = (Test / resourceDirectory).value
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val files = (base ** (_.isFile)).pair(sbt.io.Path.relativeTo(base))
|
|
|
|
|
val lines = files.toList.map(_._2).map { s =>
|
2020-02-14 10:09:39 +00:00
|
|
|
|
val ident = s.replaceAll("[^a-zA-Z0-9_]+", "_")
|
2021-08-19 06:50:30 +00:00
|
|
|
|
ident -> s"""val $ident = createUrl("$s")"""
|
2020-07-30 18:32:04 +00:00
|
|
|
|
}
|
2020-02-14 10:14:09 +00:00
|
|
|
|
val content = s"""package docspell.files
|
2020-02-14 10:09:39 +00:00
|
|
|
|
|
|
|
|
|
object ExampleFiles extends ExampleFilesSupport {
|
|
|
|
|
|
|
|
|
|
${lines.map(_._2).mkString("\n")}
|
|
|
|
|
|
|
|
|
|
val all = List(
|
|
|
|
|
${lines.map(_._1).mkString(",\n")}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
"""
|
2021-08-19 06:50:30 +00:00
|
|
|
|
val target = (Test / sourceManaged).value / "scala" / "ExampleFiles.scala"
|
2020-02-14 10:09:39 +00:00
|
|
|
|
IO.createDirectory(target.getParentFile)
|
|
|
|
|
IO.write(target, content)
|
|
|
|
|
Seq(target)
|
|
|
|
|
}.taskValue
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
|
|
|
|
.dependsOn(common)
|
|
|
|
|
|
2021-02-21 11:04:48 +00:00
|
|
|
|
val query =
|
|
|
|
|
crossProject(JSPlatform, JVMPlatform)
|
2021-02-28 20:15:21 +00:00
|
|
|
|
.withoutSuffixFor(JVMPlatform)
|
2021-02-21 11:04:48 +00:00
|
|
|
|
.in(file("modules/query"))
|
2021-02-27 17:06:59 +00:00
|
|
|
|
.disablePlugins(RevolverPlugin)
|
2021-02-21 11:04:48 +00:00
|
|
|
|
.settings(sharedSettings)
|
2021-02-28 20:15:21 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2021-02-21 11:04:48 +00:00
|
|
|
|
.settings(
|
|
|
|
|
name := "docspell-query",
|
|
|
|
|
libraryDependencies +=
|
2021-02-28 15:11:25 +00:00
|
|
|
|
Dependencies.catsParseJS.value,
|
|
|
|
|
libraryDependencies +=
|
|
|
|
|
Dependencies.scalaJavaTime.value
|
2021-02-21 11:04:48 +00:00
|
|
|
|
)
|
2021-02-23 23:22:45 +00:00
|
|
|
|
.jsSettings(
|
|
|
|
|
Test / fork := false
|
|
|
|
|
)
|
2021-02-21 11:04:48 +00:00
|
|
|
|
.jvmSettings(
|
|
|
|
|
libraryDependencies +=
|
|
|
|
|
Dependencies.scalaJsStubs
|
|
|
|
|
)
|
|
|
|
|
|
2021-08-29 19:27:56 +00:00
|
|
|
|
val totp = project
|
|
|
|
|
.in(file("modules/totp"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
|
|
|
|
.settings(testSettingsMUnit)
|
|
|
|
|
.settings(
|
|
|
|
|
name := "docspell-totp",
|
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.javaOtp ++
|
|
|
|
|
Dependencies.scodecBits ++
|
|
|
|
|
Dependencies.fs2 ++
|
|
|
|
|
Dependencies.circe
|
|
|
|
|
)
|
|
|
|
|
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val store = project
|
|
|
|
|
.in(file("modules/store"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(
|
2019-07-17 20:03:10 +00:00
|
|
|
|
name := "docspell-store",
|
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.doobie ++
|
2021-09-21 22:28:47 +00:00
|
|
|
|
Dependencies.binny ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.tika ++
|
|
|
|
|
Dependencies.fs2 ++
|
|
|
|
|
Dependencies.databases ++
|
|
|
|
|
Dependencies.flyway ++
|
|
|
|
|
Dependencies.loggingApi ++
|
|
|
|
|
Dependencies.emil ++
|
|
|
|
|
Dependencies.emilDoobie ++
|
|
|
|
|
Dependencies.calevCore ++
|
2021-08-23 19:47:54 +00:00
|
|
|
|
Dependencies.calevFs2,
|
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.testContainer.map(_ % Test)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
2021-09-23 07:27:04 +00:00
|
|
|
|
.dependsOn(common, query.jvm, totp, files)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
|
|
|
|
|
val extract = project
|
|
|
|
|
.in(file("modules/extract"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(
|
2020-02-15 15:40:50 +00:00
|
|
|
|
name := "docspell-extract",
|
2019-07-22 22:53:30 +00:00
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.fs2 ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.twelvemonkeys ++
|
|
|
|
|
Dependencies.pdfbox ++
|
|
|
|
|
Dependencies.poi ++
|
|
|
|
|
Dependencies.commonsIO ++
|
|
|
|
|
Dependencies.julOverSlf4j
|
|
|
|
|
)
|
|
|
|
|
.dependsOn(common, files % "compile->compile;test->test")
|
|
|
|
|
|
|
|
|
|
val convert = project
|
|
|
|
|
.in(file("modules/convert"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(
|
2020-02-10 23:33:52 +00:00
|
|
|
|
name := "docspell-convert",
|
|
|
|
|
libraryDependencies ++=
|
2020-02-18 20:32:21 +00:00
|
|
|
|
Dependencies.flexmark ++
|
2021-09-29 21:04:26 +00:00
|
|
|
|
Dependencies.twelvemonkeys ++
|
|
|
|
|
Dependencies.pdfbox
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
|
|
|
|
.dependsOn(common, files % "compile->compile;test->test")
|
|
|
|
|
|
|
|
|
|
val analysis = project
|
|
|
|
|
.in(file("modules/analysis"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.enablePlugins(NerModelsPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(NerModelsPlugin.nerClassifierSettings)
|
|
|
|
|
.settings(
|
2020-02-15 15:40:50 +00:00
|
|
|
|
name := "docspell-analysis",
|
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.fs2 ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.stanfordNlpCore
|
|
|
|
|
)
|
|
|
|
|
.dependsOn(common, files % "test->test")
|
|
|
|
|
|
|
|
|
|
val ftsclient = project
|
|
|
|
|
.in(file("modules/fts-client"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(
|
2020-06-14 20:53:20 +00:00
|
|
|
|
name := "docspell-fts-client",
|
|
|
|
|
libraryDependencies ++= Seq.empty
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
|
|
|
|
.dependsOn(common)
|
|
|
|
|
|
|
|
|
|
val ftssolr = project
|
|
|
|
|
.in(file("modules/fts-solr"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(
|
2020-06-14 20:53:20 +00:00
|
|
|
|
name := "docspell-fts-solr",
|
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.http4sClient ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.http4sCirce ++
|
|
|
|
|
Dependencies.http4sDsl ++
|
|
|
|
|
Dependencies.circe
|
|
|
|
|
)
|
|
|
|
|
.dependsOn(common, ftsclient)
|
|
|
|
|
|
|
|
|
|
val restapi = project
|
|
|
|
|
.in(file("modules/restapi"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.enablePlugins(OpenApiSchema)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(openapiScalaSettings)
|
|
|
|
|
.settings(
|
2019-07-17 20:03:10 +00:00
|
|
|
|
name := "docspell-restapi",
|
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.circe,
|
|
|
|
|
openapiTargetLanguage := Language.Scala,
|
2021-09-22 15:23:24 +00:00
|
|
|
|
openapiPackage := Pkg("docspell.restapi.model"),
|
|
|
|
|
openapiSpec := (Compile / resourceDirectory).value / "docspell-openapi.yml",
|
|
|
|
|
openapiStaticGen := OpenApiDocGenerator.Redoc
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
|
|
|
|
.dependsOn(common)
|
|
|
|
|
|
|
|
|
|
val joexapi = project
|
|
|
|
|
.in(file("modules/joexapi"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.enablePlugins(OpenApiSchema)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(openapiScalaSettings)
|
|
|
|
|
.settings(
|
2019-07-17 20:03:10 +00:00
|
|
|
|
name := "docspell-joexapi",
|
|
|
|
|
libraryDependencies ++=
|
2020-03-03 22:07:49 +00:00
|
|
|
|
Dependencies.circe ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.http4sCirce ++
|
|
|
|
|
Dependencies.http4sClient,
|
2019-07-17 20:03:10 +00:00
|
|
|
|
openapiTargetLanguage := Language.Scala,
|
2021-09-22 15:23:24 +00:00
|
|
|
|
openapiPackage := Pkg("docspell.joexapi.model"),
|
|
|
|
|
openapiSpec := (Compile / resourceDirectory).value / "joex-openapi.yml",
|
|
|
|
|
openapiStaticGen := OpenApiDocGenerator.Redoc
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
|
|
|
|
.dependsOn(common)
|
|
|
|
|
|
|
|
|
|
val backend = project
|
|
|
|
|
.in(file("modules/backend"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(
|
2019-07-17 20:03:10 +00:00
|
|
|
|
name := "docspell-backend",
|
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.loggingApi ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.fs2 ++
|
|
|
|
|
Dependencies.bcrypt ++
|
|
|
|
|
Dependencies.http4sClient ++
|
|
|
|
|
Dependencies.emil
|
|
|
|
|
)
|
2021-08-30 14:15:13 +00:00
|
|
|
|
.dependsOn(store, joexapi, ftsclient, totp)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
|
2021-09-05 14:29:42 +00:00
|
|
|
|
val oidc = project
|
|
|
|
|
.in(file("modules/oidc"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
|
|
|
|
.settings(sharedSettings)
|
|
|
|
|
.settings(testSettingsMUnit)
|
|
|
|
|
.settings(
|
|
|
|
|
name := "docspell-oidc",
|
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.loggingApi ++
|
|
|
|
|
Dependencies.fs2 ++
|
|
|
|
|
Dependencies.http4sClient ++
|
|
|
|
|
Dependencies.http4sCirce ++
|
|
|
|
|
Dependencies.http4sDsl ++
|
|
|
|
|
Dependencies.circe ++
|
|
|
|
|
Dependencies.jwtScala
|
|
|
|
|
)
|
|
|
|
|
.dependsOn(common)
|
|
|
|
|
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val webapp = project
|
|
|
|
|
.in(file("modules/webapp"))
|
|
|
|
|
.disablePlugins(RevolverPlugin)
|
2021-01-29 19:44:36 +00:00
|
|
|
|
.enablePlugins(OpenApiSchema, StylesPlugin)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(sharedSettings)
|
|
|
|
|
.settings(elmSettings)
|
2021-01-29 19:44:36 +00:00
|
|
|
|
.settings(stylesSettings)
|
2021-03-01 23:51:13 +00:00
|
|
|
|
.settings(webjarSettings(query.js))
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(
|
2021-09-22 15:23:24 +00:00
|
|
|
|
name := "docspell-webapp",
|
2019-07-17 20:03:10 +00:00
|
|
|
|
openapiTargetLanguage := Language.Elm,
|
2021-09-22 15:23:24 +00:00
|
|
|
|
openapiPackage := Pkg("Api.Model"),
|
2020-07-30 18:31:53 +00:00
|
|
|
|
openapiSpec := (restapi / Compile / resourceDirectory).value / "docspell-openapi.yml",
|
2019-07-17 20:03:10 +00:00
|
|
|
|
openapiElmConfig := ElmConfig().withJson(ElmJson.decodePipeline)
|
|
|
|
|
)
|
2021-02-23 00:24:24 +00:00
|
|
|
|
.dependsOn(query.js)
|
2019-07-17 20:03:10 +00:00
|
|
|
|
|
2020-05-06 20:04:51 +00:00
|
|
|
|
// --- Application(s)
|
|
|
|
|
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val joex = project
|
|
|
|
|
.in(file("modules/joex"))
|
2021-09-08 21:09:38 +00:00
|
|
|
|
.enablePlugins(
|
|
|
|
|
BuildInfoPlugin,
|
|
|
|
|
JavaServerAppPackaging,
|
|
|
|
|
DebianPlugin,
|
|
|
|
|
SystemdPlugin,
|
|
|
|
|
ClasspathJarPlugin
|
|
|
|
|
)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(debianSettings("docspell-joex"))
|
|
|
|
|
.settings(buildInfoSettings)
|
|
|
|
|
.settings(
|
2020-05-06 20:04:51 +00:00
|
|
|
|
name := "docspell-joex",
|
2020-10-19 23:07:23 +00:00
|
|
|
|
description := "The joex component (job executor) for docspell which executes long-running tasks.",
|
2021-09-22 15:23:24 +00:00
|
|
|
|
packageSummary := "Docspell Joex",
|
2020-10-19 23:07:23 +00:00
|
|
|
|
packageDescription := description.value,
|
2020-05-06 20:04:51 +00:00
|
|
|
|
libraryDependencies ++=
|
|
|
|
|
Dependencies.fs2 ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.http4sServer ++
|
|
|
|
|
Dependencies.http4sCirce ++
|
|
|
|
|
Dependencies.http4sDsl ++
|
|
|
|
|
Dependencies.circe ++
|
|
|
|
|
Dependencies.pureconfig ++
|
|
|
|
|
Dependencies.emilTnef ++
|
2021-01-24 19:06:53 +00:00
|
|
|
|
Dependencies.poi ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.emilMarkdown ++
|
|
|
|
|
Dependencies.emilJsoup ++
|
|
|
|
|
Dependencies.jsoup ++
|
|
|
|
|
Dependencies.yamusca ++
|
|
|
|
|
Dependencies.loggingApi ++
|
|
|
|
|
Dependencies.logging.map(_ % Runtime),
|
2020-05-06 20:04:51 +00:00
|
|
|
|
addCompilerPlugin(Dependencies.kindProjectorPlugin),
|
|
|
|
|
addCompilerPlugin(Dependencies.betterMonadicFor),
|
|
|
|
|
buildInfoPackage := "docspell.joex",
|
2020-07-30 18:31:53 +00:00
|
|
|
|
reStart / javaOptions ++= Seq(
|
2021-01-05 19:54:53 +00:00
|
|
|
|
s"-Dconfig.file=${(LocalRootProject / baseDirectory).value / "local" / "dev.conf"}",
|
|
|
|
|
"-Xmx1596M",
|
|
|
|
|
"-XX:+UseG1GC"
|
2020-12-16 23:11:33 +00:00
|
|
|
|
),
|
|
|
|
|
Revolver.enableDebugging(port = 5051, suspend = false)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
|
|
|
|
.dependsOn(store, backend, extract, convert, analysis, joexapi, restapi, ftssolr)
|
|
|
|
|
|
|
|
|
|
val restserver = project
|
|
|
|
|
.in(file("modules/restserver"))
|
2021-09-08 21:09:38 +00:00
|
|
|
|
.enablePlugins(
|
|
|
|
|
BuildInfoPlugin,
|
|
|
|
|
JavaServerAppPackaging,
|
|
|
|
|
DebianPlugin,
|
|
|
|
|
SystemdPlugin,
|
|
|
|
|
ClasspathJarPlugin
|
|
|
|
|
)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(sharedSettings)
|
2021-03-10 18:48:56 +00:00
|
|
|
|
.settings(testSettingsMUnit)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(debianSettings("docspell-server"))
|
|
|
|
|
.settings(buildInfoSettings)
|
|
|
|
|
.settings(
|
2021-09-22 15:23:24 +00:00
|
|
|
|
name := "docspell-restserver",
|
|
|
|
|
description := "Docspell server providing the user interface and a REST Api.",
|
|
|
|
|
packageSummary := "Docspell Rest server",
|
2020-10-19 23:07:23 +00:00
|
|
|
|
packageDescription := description.value,
|
2019-07-17 20:03:10 +00:00
|
|
|
|
libraryDependencies ++=
|
2020-06-18 22:43:35 +00:00
|
|
|
|
Dependencies.http4sServer ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.http4sCirce ++
|
|
|
|
|
Dependencies.http4sDsl ++
|
|
|
|
|
Dependencies.circe ++
|
|
|
|
|
Dependencies.pureconfig ++
|
|
|
|
|
Dependencies.yamusca ++
|
2020-12-05 01:59:57 +00:00
|
|
|
|
Dependencies.kittens ++
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Dependencies.webjars ++
|
|
|
|
|
Dependencies.loggingApi ++
|
|
|
|
|
Dependencies.logging.map(_ % Runtime),
|
2019-07-17 20:03:10 +00:00
|
|
|
|
addCompilerPlugin(Dependencies.kindProjectorPlugin),
|
|
|
|
|
addCompilerPlugin(Dependencies.betterMonadicFor),
|
|
|
|
|
buildInfoPackage := "docspell.restserver",
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Compile / sourceGenerators += Def.task {
|
|
|
|
|
createWebjarSource(Dependencies.webjars, (Compile / sourceManaged).value)
|
2019-07-22 22:53:30 +00:00
|
|
|
|
}.taskValue,
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Compile / resourceGenerators += Def.task {
|
|
|
|
|
copyWebjarResources(
|
|
|
|
|
Seq((restapi / Compile / resourceDirectory).value / "docspell-openapi.yml"),
|
|
|
|
|
(Compile / resourceManaged).value,
|
|
|
|
|
name.value,
|
|
|
|
|
version.value,
|
|
|
|
|
streams.value.log
|
|
|
|
|
)
|
2019-07-22 22:53:30 +00:00
|
|
|
|
}.taskValue,
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Compile / unmanagedResourceDirectories ++= Seq(
|
|
|
|
|
(Compile / resourceDirectory).value.getParentFile / "templates"
|
|
|
|
|
),
|
|
|
|
|
reStart / javaOptions ++= Seq(
|
2021-01-05 19:54:53 +00:00
|
|
|
|
s"-Dconfig.file=${(LocalRootProject / baseDirectory).value / "local" / "dev.conf"}",
|
|
|
|
|
"-Xmx150M",
|
|
|
|
|
"-XX:+UseG1GC"
|
2020-12-16 23:11:33 +00:00
|
|
|
|
),
|
2021-05-30 07:58:58 +00:00
|
|
|
|
Revolver.enableDebugging(port = 5050, suspend = false),
|
|
|
|
|
Universal / mappings := {
|
|
|
|
|
val allMappings = (Universal / mappings).value
|
|
|
|
|
allMappings.filter {
|
|
|
|
|
//scalajs artifacts are not needed at runtime
|
|
|
|
|
case (file, name) => !name.contains("_sjs1_")
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
2021-09-05 14:29:42 +00:00
|
|
|
|
.dependsOn(restapi, joexapi, backend, webapp, ftssolr, oidc)
|
2020-05-06 20:04:51 +00:00
|
|
|
|
|
2020-07-27 20:13:22 +00:00
|
|
|
|
// --- Website Documentation
|
2020-05-06 20:04:51 +00:00
|
|
|
|
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val website = project
|
|
|
|
|
.in(file("website"))
|
|
|
|
|
.disablePlugins(RevolverPlugin, ReleasePlugin)
|
2021-05-31 11:44:47 +00:00
|
|
|
|
.enablePlugins(ZolaPlugin, GitHubPagesPlugin)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(sharedSettings)
|
|
|
|
|
.settings(
|
2021-09-22 15:23:24 +00:00
|
|
|
|
name := "docspell-website",
|
|
|
|
|
publishArtifact := false,
|
|
|
|
|
publish / skip := true,
|
|
|
|
|
gitHubPagesOrgName := "eikek",
|
2021-05-31 11:44:47 +00:00
|
|
|
|
gitHubPagesRepoName := "docspell",
|
2021-09-22 15:23:24 +00:00
|
|
|
|
gitHubPagesSiteDir := zolaOutputDir.value,
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Compile / resourceGenerators += Def.task {
|
|
|
|
|
val templateOut = baseDirectory.value / "site" / "templates" / "shortcodes"
|
2021-09-22 15:23:24 +00:00
|
|
|
|
val staticOut = baseDirectory.value / "site" / "static" / "openapi"
|
2020-07-27 20:13:22 +00:00
|
|
|
|
IO.createDirectories(Seq(templateOut, staticOut))
|
2020-06-14 19:35:20 +00:00
|
|
|
|
val logger = streams.value.log
|
|
|
|
|
|
|
|
|
|
val files = Seq(
|
2021-08-19 06:50:30 +00:00
|
|
|
|
(restserver / Compile / resourceDirectory).value / "reference.conf" -> templateOut / "server.conf",
|
|
|
|
|
(joex / Compile / resourceDirectory).value / "reference.conf" -> templateOut / "joex.conf",
|
2020-07-30 18:31:53 +00:00
|
|
|
|
(LocalRootProject / baseDirectory).value / "tools" / "exim" / "exim.conf" -> templateOut / "sample-exim.conf",
|
2021-08-19 06:50:30 +00:00
|
|
|
|
(restapi / Compile / resourceDirectory).value / "docspell-openapi.yml" -> staticOut / "docspell-openapi.yml",
|
|
|
|
|
(restapi / Compile / openapiStaticDoc).value -> staticOut / "docspell-openapi.html"
|
2020-06-14 19:35:20 +00:00
|
|
|
|
)
|
|
|
|
|
IO.copy(files)
|
2020-07-27 20:13:22 +00:00
|
|
|
|
files.map(_._2)
|
2019-07-22 22:53:30 +00:00
|
|
|
|
}.taskValue,
|
2020-07-30 18:31:53 +00:00
|
|
|
|
Compile / resourceGenerators += Def.task {
|
2020-07-27 20:13:22 +00:00
|
|
|
|
val changelog = (LocalRootProject / baseDirectory).value / "Changelog.md"
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val targetDir = baseDirectory.value / "site" / "content" / "docs" / "changelog"
|
2020-07-27 20:13:22 +00:00
|
|
|
|
IO.createDirectory(targetDir)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val target = targetDir / "_index.md"
|
2020-07-27 20:13:22 +00:00
|
|
|
|
|
2020-07-30 18:31:53 +00:00
|
|
|
|
IO.write(
|
|
|
|
|
target,
|
|
|
|
|
"""|+++
|
2021-09-22 15:23:24 +00:00
|
|
|
|
|title = "Changelog"
|
|
|
|
|
|description = "See what changed between releases."
|
|
|
|
|
|weight = 10
|
|
|
|
|
|insert_anchor_links = "right"
|
|
|
|
|
|[extra]
|
|
|
|
|
|maketoc = false
|
|
|
|
|
|+++
|
|
|
|
|
|""".stripMargin
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
2020-07-27 20:13:22 +00:00
|
|
|
|
IO.append(target, IO.readBytes(changelog))
|
2019-07-22 22:53:30 +00:00
|
|
|
|
Seq(target)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
}.taskValue
|
2019-07-22 22:53:30 +00:00
|
|
|
|
)
|
|
|
|
|
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val root = project
|
|
|
|
|
.in(file("."))
|
2021-02-27 17:06:59 +00:00
|
|
|
|
.disablePlugins(RevolverPlugin)
|
2020-07-30 18:31:53 +00:00
|
|
|
|
.settings(sharedSettings)
|
|
|
|
|
.settings(noPublish)
|
|
|
|
|
.settings(
|
2019-07-17 20:03:10 +00:00
|
|
|
|
name := "docspell-root"
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
|
|
|
|
.aggregate(
|
|
|
|
|
common,
|
|
|
|
|
extract,
|
|
|
|
|
convert,
|
|
|
|
|
analysis,
|
|
|
|
|
ftsclient,
|
|
|
|
|
ftssolr,
|
|
|
|
|
files,
|
|
|
|
|
store,
|
|
|
|
|
joexapi,
|
|
|
|
|
joex,
|
|
|
|
|
backend,
|
|
|
|
|
webapp,
|
|
|
|
|
restapi,
|
2021-02-21 11:04:48 +00:00
|
|
|
|
restserver,
|
2021-02-23 00:24:24 +00:00
|
|
|
|
query.jvm,
|
2021-08-29 19:27:56 +00:00
|
|
|
|
query.js,
|
2021-09-05 14:29:42 +00:00
|
|
|
|
totp,
|
|
|
|
|
oidc
|
2020-07-30 18:31:53 +00:00
|
|
|
|
)
|
2019-07-17 20:03:10 +00:00
|
|
|
|
|
2020-05-06 20:04:51 +00:00
|
|
|
|
// --- Helpers
|
2019-07-22 22:53:30 +00:00
|
|
|
|
|
2020-09-02 22:22:06 +00:00
|
|
|
|
def copyWithGZ(src: File, target: File): Seq[File] = {
|
|
|
|
|
val gzipFilter = "*.html" || "*.css" || "*.js"
|
|
|
|
|
IO.copy(Seq(src -> target))
|
|
|
|
|
if (gzipFilter.accept(src)) {
|
|
|
|
|
val gz = file(target.toString + ".gz")
|
|
|
|
|
IO.gzip(src, gz)
|
|
|
|
|
Seq(target, gz)
|
|
|
|
|
} else {
|
|
|
|
|
Seq(target)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-30 18:31:53 +00:00
|
|
|
|
def copyWebjarResources(
|
|
|
|
|
src: Seq[File],
|
|
|
|
|
base: File,
|
|
|
|
|
artifact: String,
|
|
|
|
|
version: String,
|
|
|
|
|
logger: Logger
|
|
|
|
|
): Seq[File] = {
|
|
|
|
|
val targetDir = base / "META-INF" / "resources" / "webjars" / artifact / version
|
2019-07-22 22:53:30 +00:00
|
|
|
|
logger.info(s"Copy webjar resources from ${src.size} files/directories.")
|
2019-07-17 20:03:10 +00:00
|
|
|
|
src.flatMap { dir =>
|
|
|
|
|
if (dir.isDirectory) {
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val files = (dir ** "*").filter(_.isFile).get.pair(Path.relativeTo(dir))
|
2020-11-11 00:08:07 +00:00
|
|
|
|
files.flatMap { case (f, name) =>
|
|
|
|
|
val target = targetDir / name
|
|
|
|
|
IO.createDirectories(Seq(target.getParentFile))
|
|
|
|
|
copyWithGZ(f, target)
|
2019-07-17 20:03:10 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-07-30 18:31:53 +00:00
|
|
|
|
val target = targetDir / dir.name
|
2019-07-17 20:03:10 +00:00
|
|
|
|
IO.createDirectories(Seq(target.getParentFile))
|
2020-09-02 22:22:06 +00:00
|
|
|
|
copyWithGZ(dir, target)
|
2019-07-17 20:03:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-30 18:32:04 +00:00
|
|
|
|
def compileElm(
|
|
|
|
|
logger: Logger,
|
|
|
|
|
wd: File,
|
|
|
|
|
outBase: File,
|
|
|
|
|
artifact: String,
|
|
|
|
|
version: String,
|
|
|
|
|
mode: ElmCompileMode
|
|
|
|
|
): Seq[File] = {
|
2019-07-17 20:03:10 +00:00
|
|
|
|
logger.info("Compile elm files ...")
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val target =
|
|
|
|
|
outBase / "META-INF" / "resources" / "webjars" / artifact / version / "docspell-app.js"
|
2019-12-29 19:52:43 +00:00
|
|
|
|
val cmd = Seq("elm", "make") ++ mode.flags ++ Seq("--output", target.toString)
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val proc = Process(
|
|
|
|
|
cmd ++ Seq(wd / "src" / "main" / "elm" / "Main.elm").map(_.toString),
|
|
|
|
|
Some(wd)
|
|
|
|
|
)
|
2019-07-17 20:03:10 +00:00
|
|
|
|
val out = proc.!!
|
|
|
|
|
logger.info(out)
|
2020-09-02 22:22:06 +00:00
|
|
|
|
val targetGZ = file(target.toString + ".gz")
|
|
|
|
|
IO.gzip(target, targetGZ)
|
|
|
|
|
Seq(target, targetGZ)
|
2019-07-17 20:03:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def createWebjarSource(wj: Seq[ModuleID], out: File): Seq[File] = {
|
2021-09-22 15:23:24 +00:00
|
|
|
|
val target = out / "Webjars.scala"
|
2020-08-03 21:58:41 +00:00
|
|
|
|
val badChars = "-.".toSet
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val fields = wj
|
|
|
|
|
.map(m =>
|
2020-11-11 00:08:07 +00:00
|
|
|
|
s"""val ${m.name.toLowerCase.filter(c =>
|
|
|
|
|
!badChars.contains(c)
|
|
|
|
|
)} = "/${m.name}/${m.revision}" """
|
2020-07-30 18:32:04 +00:00
|
|
|
|
)
|
|
|
|
|
.mkString("\n\n")
|
2019-07-17 20:03:10 +00:00
|
|
|
|
val content = s"""package docspell.restserver.webapp
|
2021-09-22 15:23:24 +00:00
|
|
|
|
|object Webjars {
|
|
|
|
|
|$fields
|
|
|
|
|
|}
|
|
|
|
|
|""".stripMargin
|
2019-07-17 20:03:10 +00:00
|
|
|
|
|
|
|
|
|
IO.write(target, content)
|
|
|
|
|
Seq(target)
|
|
|
|
|
}
|
2019-07-22 22:53:30 +00:00
|
|
|
|
|
2020-01-19 19:32:52 +00:00
|
|
|
|
def packageTools(logger: Logger, dir: File, version: String): Seq[File] = {
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val target = dir / "target"
|
2020-01-19 19:32:52 +00:00
|
|
|
|
IO.delete(target)
|
|
|
|
|
IO.createDirectory(target)
|
2021-08-19 06:50:30 +00:00
|
|
|
|
val archive = target / s"docspell-tools-$version.zip"
|
2020-01-19 19:32:52 +00:00
|
|
|
|
logger.info(s"Packaging tools to $archive ...")
|
2020-07-30 18:32:04 +00:00
|
|
|
|
val webext = target / "docspell-firefox-extension.xpi"
|
2021-09-22 15:23:24 +00:00
|
|
|
|
val wx = dir / "webextension"
|
2020-07-30 18:32:04 +00:00
|
|
|
|
IO.zip(
|
|
|
|
|
Seq(
|
|
|
|
|
wx / "_locales/de/messages.json" -> "_locales/de/messages.json",
|
|
|
|
|
wx / "_locales/en/messages.json" -> "_locales/en/messages.json",
|
2021-09-22 15:23:24 +00:00
|
|
|
|
wx / "docspell.js" -> "docspell.js",
|
|
|
|
|
wx / "icons" / "logo-48.png" -> "icons/logo-48.png",
|
|
|
|
|
wx / "icons" / "logo-96.png" -> "icons/logo-96.png",
|
|
|
|
|
wx / "manifest.json" -> "manifest.json"
|
2020-07-30 18:32:04 +00:00
|
|
|
|
),
|
2021-03-10 18:48:56 +00:00
|
|
|
|
webext,
|
|
|
|
|
None
|
2020-07-30 18:32:04 +00:00
|
|
|
|
)
|
|
|
|
|
|
2020-11-13 21:19:21 +00:00
|
|
|
|
val excludes = Seq(wx, target)
|
|
|
|
|
|
|
|
|
|
val files =
|
|
|
|
|
(dir ** "*")
|
|
|
|
|
.filter(f => !excludes.exists(p => f.absolutePath.startsWith(p.absolutePath)))
|
|
|
|
|
.pair(sbt.io.Path.relativeTo(dir))
|
2021-08-19 06:50:30 +00:00
|
|
|
|
.map { case (f, name) => (f, s"docspell-tools-$version/$name") }
|
2020-11-13 21:19:21 +00:00
|
|
|
|
|
2020-07-30 18:32:04 +00:00
|
|
|
|
IO.zip(
|
|
|
|
|
Seq(
|
2021-08-19 06:50:30 +00:00
|
|
|
|
webext -> s"docspell-tools-$version/firefox/docspell-extension.xpi",
|
|
|
|
|
wx / "native/app_manifest.json" -> s"docspell-tools-$version/firefox/native/app_manifest.json",
|
|
|
|
|
wx / "native/native.py" -> s"docspell-tools-$version/firefox/native/native.py"
|
2020-11-13 21:19:21 +00:00
|
|
|
|
) ++ files,
|
2021-03-10 18:48:56 +00:00
|
|
|
|
archive,
|
|
|
|
|
None
|
2020-07-30 18:32:04 +00:00
|
|
|
|
)
|
2020-01-19 19:32:52 +00:00
|
|
|
|
|
|
|
|
|
Seq(archive)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- aliases
|
2019-07-22 22:53:30 +00:00
|
|
|
|
|
2020-07-30 18:32:04 +00:00
|
|
|
|
addCommandAlias(
|
|
|
|
|
"make",
|
2021-05-30 07:58:58 +00:00
|
|
|
|
";set webapp/elmCompileMode := ElmCompileMode.Production; set webapp/stylesMode := StylesMode.Prod ;root/openapiCodegen ;root/Test/compile"
|
2020-07-30 18:32:04 +00:00
|
|
|
|
)
|
2021-05-30 22:59:01 +00:00
|
|
|
|
addCommandAlias("make-zip", ";restserver/Universal/packageBin ;joex/Universal/packageBin")
|
|
|
|
|
addCommandAlias("make-deb", ";restserver/Debian/packageBin ;joex/Debian/packageBin")
|
2020-01-19 19:32:52 +00:00
|
|
|
|
addCommandAlias("make-tools", ";root/toolsPackage")
|
|
|
|
|
addCommandAlias("make-pkg", ";clean ;make ;make-zip ;make-deb ;make-tools")
|
2021-04-10 15:16:01 +00:00
|
|
|
|
|
|
|
|
|
addCommandAlias("ci", "make; lint; test")
|
|
|
|
|
addCommandAlias(
|
|
|
|
|
"lint",
|
2021-07-04 08:15:30 +00:00
|
|
|
|
"restapi/openapiLint; joexapi/openapiLint; headerCheck; scalafmtSbtCheck; scalafmtCheckAll; Compile/scalafix --check; Test/scalafix --check"
|
|
|
|
|
)
|
|
|
|
|
addCommandAlias(
|
|
|
|
|
"fix",
|
|
|
|
|
"headerCreateAll; Compile/scalafix; Test/scalafix; scalafmtSbt; scalafmtAll"
|
2021-04-10 15:16:01 +00:00
|
|
|
|
)
|
2021-05-31 12:33:49 +00:00
|
|
|
|
addCommandAlias("make-website", ";website/clean ;website/zolaBuild ;website/zolaCheck")
|
|
|
|
|
addCommandAlias("publish-website", "website/publishToGitHubPages")
|