Update build for new website

This commit is contained in:
Eike Kettner 2020-07-30 20:31:53 +02:00
parent f8c6f79b10
commit 9bc6c60dfe
5 changed files with 372 additions and 219 deletions

459
build.sbt
View File

@ -1,18 +1,16 @@
import com.github.eikek.sbt.openapi._ import com.github.eikek.sbt.openapi._
import scala.sys.process._ import scala.sys.process._
import com.typesafe.sbt.site.SitePlugin
import com.typesafe.sbt.SbtGit.GitKeys._ import com.typesafe.sbt.SbtGit.GitKeys._
import docspell.build._ import docspell.build._
import microsites.ExtraMdFileConfig
val toolsPackage = taskKey[Seq[File]]("Package the scripts/extension tools") val toolsPackage = taskKey[Seq[File]]("Package the scripts/extension tools")
val elmCompileMode = settingKey[ElmCompileMode]("How to compile elm sources") val elmCompileMode = settingKey[ElmCompileMode]("How to compile elm sources")
// --- Settings // --- Settings
val scalafixSettings = Seq( val scalafixSettings = Seq(
semanticdbEnabled := true, // enable SemanticDB semanticdbEnabled := true, // enable SemanticDB
semanticdbVersion := scalafixSemanticdb.revision, //"4.3.10", // use Scalafix compatible version semanticdbVersion := scalafixSemanticdb.revision, //"4.3.10", // use Scalafix compatible version
ThisBuild / scalafixDependencies ++= Dependencies.organizeImports ThisBuild / scalafixDependencies ++= Dependencies.organizeImports
) )
@ -199,263 +197,294 @@ ${lines.map(_._1).mkString(",\n")}
} }
""" """
val target = (Test/sourceManaged).value/"scala"/"ExampleFiles.scala" val target = (Test / sourceManaged).value / "scala" / "ExampleFiles.scala"
IO.createDirectory(target.getParentFile) IO.createDirectory(target.getParentFile)
IO.write(target, content) IO.write(target, content)
Seq(target) Seq(target)
}.taskValue }.taskValue
).dependsOn(common) )
.dependsOn(common)
val store = project.in(file("modules/store")). val store = project
disablePlugins(RevolverPlugin). .in(file("modules/store"))
settings(sharedSettings). .disablePlugins(RevolverPlugin)
settings(testSettings). .settings(sharedSettings)
settings( .settings(testSettings)
.settings(
name := "docspell-store", name := "docspell-store",
libraryDependencies ++= libraryDependencies ++=
Dependencies.doobie ++ Dependencies.doobie ++
Dependencies.bitpeace ++ Dependencies.bitpeace ++
Dependencies.tika ++ Dependencies.tika ++
Dependencies.fs2 ++ Dependencies.fs2 ++
Dependencies.databases ++ Dependencies.databases ++
Dependencies.flyway ++ Dependencies.flyway ++
Dependencies.loggingApi ++ Dependencies.loggingApi ++
Dependencies.emil ++ Dependencies.emil ++
Dependencies.emilDoobie ++ Dependencies.emilDoobie ++
Dependencies.calevCore ++ Dependencies.calevCore ++
Dependencies.calevFs2 Dependencies.calevFs2
).dependsOn(common) )
.dependsOn(common)
val extract = project.in(file("modules/extract")). val extract = project
disablePlugins(RevolverPlugin). .in(file("modules/extract"))
settings(sharedSettings). .disablePlugins(RevolverPlugin)
settings(testSettings). .settings(sharedSettings)
settings( .settings(testSettings)
.settings(
name := "docspell-extract", name := "docspell-extract",
libraryDependencies ++= libraryDependencies ++=
Dependencies.fs2 ++ Dependencies.fs2 ++
Dependencies.twelvemonkeys ++ Dependencies.twelvemonkeys ++
Dependencies.pdfbox ++ Dependencies.pdfbox ++
Dependencies.poi ++ Dependencies.poi ++
Dependencies.commonsIO ++ Dependencies.commonsIO ++
Dependencies.julOverSlf4j Dependencies.julOverSlf4j
).dependsOn(common, files % "compile->compile;test->test") )
.dependsOn(common, files % "compile->compile;test->test")
val convert = project.in(file("modules/convert")). val convert = project
disablePlugins(RevolverPlugin). .in(file("modules/convert"))
settings(sharedSettings). .disablePlugins(RevolverPlugin)
settings(testSettings). .settings(sharedSettings)
settings( .settings(testSettings)
.settings(
name := "docspell-convert", name := "docspell-convert",
libraryDependencies ++= libraryDependencies ++=
Dependencies.flexmark ++ Dependencies.flexmark ++
Dependencies.twelvemonkeys Dependencies.twelvemonkeys
).dependsOn(common, files % "compile->compile;test->test") )
.dependsOn(common, files % "compile->compile;test->test")
val analysis = project.in(file("modules/analysis")). val analysis = project
disablePlugins(RevolverPlugin). .in(file("modules/analysis"))
enablePlugins(NerModelsPlugin). .disablePlugins(RevolverPlugin)
settings(sharedSettings). .enablePlugins(NerModelsPlugin)
settings(testSettings). .settings(sharedSettings)
settings(NerModelsPlugin.nerClassifierSettings). .settings(testSettings)
settings( .settings(NerModelsPlugin.nerClassifierSettings)
.settings(
name := "docspell-analysis", name := "docspell-analysis",
libraryDependencies ++= libraryDependencies ++=
Dependencies.fs2 ++ Dependencies.fs2 ++
Dependencies.stanfordNlpCore Dependencies.stanfordNlpCore
).dependsOn(common, files % "test->test") )
.dependsOn(common, files % "test->test")
val ftsclient = project.in(file("modules/fts-client")). val ftsclient = project
disablePlugins(RevolverPlugin). .in(file("modules/fts-client"))
settings(sharedSettings). .disablePlugins(RevolverPlugin)
settings(testSettings). .settings(sharedSettings)
settings( .settings(testSettings)
.settings(
name := "docspell-fts-client", name := "docspell-fts-client",
libraryDependencies ++= Seq.empty libraryDependencies ++= Seq.empty
).dependsOn(common) )
.dependsOn(common)
val ftssolr = project.in(file("modules/fts-solr")). val ftssolr = project
disablePlugins(RevolverPlugin). .in(file("modules/fts-solr"))
settings(sharedSettings). .disablePlugins(RevolverPlugin)
settings(testSettings). .settings(sharedSettings)
settings( .settings(testSettings)
.settings(
name := "docspell-fts-solr", name := "docspell-fts-solr",
libraryDependencies ++= libraryDependencies ++=
Dependencies.http4sClient ++ Dependencies.http4sClient ++
Dependencies.http4sCirce ++ Dependencies.http4sCirce ++
Dependencies.http4sDsl ++ Dependencies.http4sDsl ++
Dependencies.circe Dependencies.circe
).dependsOn(common, ftsclient) )
.dependsOn(common, ftsclient)
val restapi = project.in(file("modules/restapi")).
disablePlugins(RevolverPlugin). val restapi = project
enablePlugins(OpenApiSchema). .in(file("modules/restapi"))
settings(sharedSettings). .disablePlugins(RevolverPlugin)
settings(testSettings). .enablePlugins(OpenApiSchema)
settings(openapiScalaSettings). .settings(sharedSettings)
settings( .settings(testSettings)
.settings(openapiScalaSettings)
.settings(
name := "docspell-restapi", name := "docspell-restapi",
libraryDependencies ++= libraryDependencies ++=
Dependencies.circe, Dependencies.circe,
openapiTargetLanguage := Language.Scala, openapiTargetLanguage := Language.Scala,
openapiPackage := Pkg("docspell.restapi.model"), openapiPackage := Pkg("docspell.restapi.model"),
openapiSpec := (Compile/resourceDirectory).value/"docspell-openapi.yml", openapiSpec := (Compile / resourceDirectory).value / "docspell-openapi.yml",
openapiStaticArgs := Seq("-l", "html2") openapiStaticArgs := Seq("-l", "html2")
).dependsOn(common) )
.dependsOn(common)
val joexapi = project.in(file("modules/joexapi")). val joexapi = project
disablePlugins(RevolverPlugin). .in(file("modules/joexapi"))
enablePlugins(OpenApiSchema). .disablePlugins(RevolverPlugin)
settings(sharedSettings). .enablePlugins(OpenApiSchema)
settings(testSettings). .settings(sharedSettings)
settings(openapiScalaSettings). .settings(testSettings)
settings( .settings(openapiScalaSettings)
.settings(
name := "docspell-joexapi", name := "docspell-joexapi",
libraryDependencies ++= libraryDependencies ++=
Dependencies.circe ++ Dependencies.circe ++
Dependencies.http4sCirce ++ Dependencies.http4sCirce ++
Dependencies.http4sClient, Dependencies.http4sClient,
openapiTargetLanguage := Language.Scala, openapiTargetLanguage := Language.Scala,
openapiPackage := Pkg("docspell.joexapi.model"), openapiPackage := Pkg("docspell.joexapi.model"),
openapiSpec := (Compile/resourceDirectory).value/"joex-openapi.yml" openapiSpec := (Compile / resourceDirectory).value / "joex-openapi.yml"
).dependsOn(common) )
.dependsOn(common)
val backend = project.in(file("modules/backend")). val backend = project
disablePlugins(RevolverPlugin). .in(file("modules/backend"))
settings(sharedSettings). .disablePlugins(RevolverPlugin)
settings(testSettings). .settings(sharedSettings)
settings( .settings(testSettings)
.settings(
name := "docspell-backend", name := "docspell-backend",
libraryDependencies ++= libraryDependencies ++=
Dependencies.loggingApi ++ Dependencies.loggingApi ++
Dependencies.fs2 ++ Dependencies.fs2 ++
Dependencies.bcrypt ++ Dependencies.bcrypt ++
Dependencies.http4sClient ++ Dependencies.http4sClient ++
Dependencies.emil Dependencies.emil
).dependsOn(store, joexapi, ftsclient) )
.dependsOn(store, joexapi, ftsclient)
val webapp = project.in(file("modules/webapp")). val webapp = project
disablePlugins(RevolverPlugin). .in(file("modules/webapp"))
enablePlugins(OpenApiSchema). .disablePlugins(RevolverPlugin)
settings(sharedSettings). .enablePlugins(OpenApiSchema)
settings(elmSettings). .settings(sharedSettings)
settings(webjarSettings). .settings(elmSettings)
settings( .settings(webjarSettings)
.settings(
name := "docspell-webapp", name := "docspell-webapp",
openapiTargetLanguage := Language.Elm, openapiTargetLanguage := Language.Elm,
openapiPackage := Pkg("Api.Model"), openapiPackage := Pkg("Api.Model"),
openapiSpec := (restapi/Compile/resourceDirectory).value/"docspell-openapi.yml", openapiSpec := (restapi / Compile / resourceDirectory).value / "docspell-openapi.yml",
openapiElmConfig := ElmConfig().withJson(ElmJson.decodePipeline) openapiElmConfig := ElmConfig().withJson(ElmJson.decodePipeline)
) )
// --- Application(s) // --- Application(s)
val joex = project.in(file("modules/joex")). val joex = project
enablePlugins(BuildInfoPlugin .in(file("modules/joex"))
, JavaServerAppPackaging .enablePlugins(BuildInfoPlugin, JavaServerAppPackaging, DebianPlugin, SystemdPlugin)
, DebianPlugin .settings(sharedSettings)
, SystemdPlugin). .settings(testSettings)
settings(sharedSettings). .settings(debianSettings("docspell-joex"))
settings(testSettings). .settings(buildInfoSettings)
settings(debianSettings("docspell-joex")). .settings(
settings(buildInfoSettings).
settings(
name := "docspell-joex", name := "docspell-joex",
libraryDependencies ++= libraryDependencies ++=
Dependencies.fs2 ++ Dependencies.fs2 ++
Dependencies.http4sServer ++ Dependencies.http4sServer ++
Dependencies.http4sCirce ++ Dependencies.http4sCirce ++
Dependencies.http4sDsl ++ Dependencies.http4sDsl ++
Dependencies.circe ++ Dependencies.circe ++
Dependencies.pureconfig ++ Dependencies.pureconfig ++
Dependencies.emilTnef ++ Dependencies.emilTnef ++
Dependencies.emilMarkdown ++ Dependencies.emilMarkdown ++
Dependencies.emilJsoup ++ Dependencies.emilJsoup ++
Dependencies.jsoup ++ Dependencies.jsoup ++
Dependencies.yamusca ++ Dependencies.yamusca ++
Dependencies.loggingApi ++ Dependencies.loggingApi ++
Dependencies.logging.map(_ % Runtime), Dependencies.logging.map(_ % Runtime),
addCompilerPlugin(Dependencies.kindProjectorPlugin), addCompilerPlugin(Dependencies.kindProjectorPlugin),
addCompilerPlugin(Dependencies.betterMonadicFor), addCompilerPlugin(Dependencies.betterMonadicFor),
buildInfoPackage := "docspell.joex", buildInfoPackage := "docspell.joex",
reStart/javaOptions ++= Seq(s"-Dconfig.file=${(LocalRootProject/baseDirectory).value/"local"/"dev.conf"}") reStart / javaOptions ++= Seq(
).dependsOn(store, backend, extract, convert, analysis, joexapi, restapi, ftssolr) s"-Dconfig.file=${(LocalRootProject / baseDirectory).value / "local" / "dev.conf"}"
)
)
.dependsOn(store, backend, extract, convert, analysis, joexapi, restapi, ftssolr)
val restserver = project.in(file("modules/restserver")). val restserver = project
enablePlugins(BuildInfoPlugin .in(file("modules/restserver"))
, JavaServerAppPackaging .enablePlugins(BuildInfoPlugin, JavaServerAppPackaging, DebianPlugin, SystemdPlugin)
, DebianPlugin .settings(sharedSettings)
, SystemdPlugin). .settings(testSettings)
settings(sharedSettings). .settings(debianSettings("docspell-server"))
settings(testSettings). .settings(buildInfoSettings)
settings(debianSettings("docspell-server")). .settings(
settings(buildInfoSettings).
settings(
name := "docspell-restserver", name := "docspell-restserver",
libraryDependencies ++= libraryDependencies ++=
Dependencies.http4sServer ++ Dependencies.http4sServer ++
Dependencies.http4sCirce ++ Dependencies.http4sCirce ++
Dependencies.http4sDsl ++ Dependencies.http4sDsl ++
Dependencies.circe ++ Dependencies.circe ++
Dependencies.pureconfig ++ Dependencies.pureconfig ++
Dependencies.yamusca ++ Dependencies.yamusca ++
Dependencies.webjars ++ Dependencies.webjars ++
Dependencies.loggingApi ++ Dependencies.loggingApi ++
Dependencies.logging.map(_ % Runtime), Dependencies.logging.map(_ % Runtime),
addCompilerPlugin(Dependencies.kindProjectorPlugin), addCompilerPlugin(Dependencies.kindProjectorPlugin),
addCompilerPlugin(Dependencies.betterMonadicFor), addCompilerPlugin(Dependencies.betterMonadicFor),
buildInfoPackage := "docspell.restserver", buildInfoPackage := "docspell.restserver",
Compile/sourceGenerators += Def.task { Compile / sourceGenerators += Def.task {
createWebjarSource(Dependencies.webjars, (Compile/sourceManaged).value) createWebjarSource(Dependencies.webjars, (Compile / sourceManaged).value)
}.taskValue, }.taskValue,
Compile/resourceGenerators += Def.task { Compile / resourceGenerators += Def.task {
copyWebjarResources(Seq((restapi/Compile/resourceDirectory).value/"docspell-openapi.yml") copyWebjarResources(
, (Compile/resourceManaged).value Seq((restapi / Compile / resourceDirectory).value / "docspell-openapi.yml"),
, name.value (Compile / resourceManaged).value,
, version.value name.value,
, streams.value.log) version.value,
streams.value.log
)
}.taskValue, }.taskValue,
Compile/unmanagedResourceDirectories ++= Seq((Compile/resourceDirectory).value.getParentFile/"templates"), Compile / unmanagedResourceDirectories ++= Seq(
reStart/javaOptions ++= Seq(s"-Dconfig.file=${(LocalRootProject/baseDirectory).value/"local"/"dev.conf"}") (Compile / resourceDirectory).value.getParentFile / "templates"
).dependsOn(restapi, joexapi, backend, webapp, ftssolr) ),
reStart / javaOptions ++= Seq(
s"-Dconfig.file=${(LocalRootProject / baseDirectory).value / "local" / "dev.conf"}"
)
)
.dependsOn(restapi, joexapi, backend, webapp, ftssolr)
// --- Website Documentation // --- Website Documentation
val website = project.in(file("website")). val website = project
disablePlugins(RevolverPlugin). .in(file("website"))
disablePlugins(ReleasePlugin). .disablePlugins(RevolverPlugin, ReleasePlugin)
settings(sharedSettings). .enablePlugins(ZolaPlugin, GhpagesPlugin)
settings( .settings(sharedSettings)
.settings(
name := "docspell-website", name := "docspell-website",
publishArtifact := false, publishArtifact := false,
skip in publish := true, skip in publish := true,
Compile/resourceGenerators += Def.task { ghpagesNoJekyll := true,
val templateOut = baseDirectory.value/"site"/"templates"/"shortcodes" // the ghpages plugins works together with the site plugin (its a dependency)
val staticOut = baseDirectory.value/"site"/"static"/"openapi" // to make it publish the zola generated site, override their mappings with the zola output
mappings in SitePlugin.autoImport.makeSite :=
Path.selectSubpaths(zolaOutputDir.value, _ => true).toSeq,
git.remoteRepo := "git@github.com:eikek/docspell",
Compile / resourceGenerators += Def.task {
val templateOut = baseDirectory.value / "site" / "templates" / "shortcodes"
val staticOut = baseDirectory.value / "site" / "static" / "openapi"
IO.createDirectories(Seq(templateOut, staticOut)) IO.createDirectories(Seq(templateOut, staticOut))
val logger = streams.value.log val logger = streams.value.log
val files = Seq( val files = Seq(
(resourceDirectory in (restserver, Compile)).value / "reference.conf" -> templateOut /"server.conf", (resourceDirectory in (restserver, Compile)).value / "reference.conf" -> templateOut / "server.conf",
(resourceDirectory in (joex, Compile)).value / "reference.conf" -> templateOut/"joex.conf", (resourceDirectory in (joex, Compile)).value / "reference.conf" -> templateOut / "joex.conf",
(LocalRootProject / baseDirectory).value / "tools" / "exim" / "exim.conf" -> templateOut/"sample-exim.conf", (LocalRootProject / baseDirectory).value / "tools" / "exim" / "exim.conf" -> templateOut / "sample-exim.conf",
(resourceDirectory in (restapi, Compile)).value/"docspell-openapi.yml" -> staticOut/"docspell-openapi.yml", (resourceDirectory in (restapi, Compile)).value / "docspell-openapi.yml" -> staticOut / "docspell-openapi.yml",
(restapi/Compile/openapiStaticDoc).value -> staticOut/"docspell-openapi.html" (restapi / Compile / openapiStaticDoc).value -> staticOut / "docspell-openapi.html"
) )
IO.copy(files) IO.copy(files)
files.map(_._2) files.map(_._2)
}.taskValue, }.taskValue,
Compile/resourceGenerators += Def.task { Compile / resourceGenerators += Def.task {
val changelog = (LocalRootProject / baseDirectory).value / "Changelog.md" val changelog = (LocalRootProject / baseDirectory).value / "Changelog.md"
val targetDir = baseDirectory.value/"site"/"content"/"docs"/"changelog" val targetDir = baseDirectory.value / "site" / "content" / "docs" / "changelog"
IO.createDirectory(targetDir) IO.createDirectory(targetDir)
val target = targetDir/"_index.md" val target = targetDir / "_index.md"
IO.write(target, """|+++ IO.write(
target,
"""|+++
|title = "Changelog" |title = "Changelog"
|description = "See what changed between releases." |description = "See what changed between releases."
|weight = 10 |weight = 10
@ -463,52 +492,60 @@ val website = project.in(file("website")).
|[extra] |[extra]
|maketoc = false |maketoc = false
|+++ |+++
|""".stripMargin) |""".stripMargin
)
IO.append(target, IO.readBytes(changelog)) IO.append(target, IO.readBytes(changelog))
Seq(target) Seq(target)
}.taskValue }.taskValue
) )
val root = project
val root = project.in(file(".")). .in(file("."))
settings(sharedSettings). .settings(sharedSettings)
settings(noPublish). .settings(noPublish)
settings( .settings(
name := "docspell-root" name := "docspell-root"
). )
aggregate(common .aggregate(
, extract common,
, convert extract,
, analysis convert,
, ftsclient analysis,
, ftssolr ftsclient,
, files ftssolr,
, store files,
, joexapi store,
, joex joexapi,
, backend joex,
, webapp backend,
, restapi webapp,
, restserver) restapi,
restserver
)
// --- Helpers // --- Helpers
def copyWebjarResources(src: Seq[File], base: File, artifact: String, version: String, logger: Logger): Seq[File] = { def copyWebjarResources(
val targetDir = base/"META-INF"/"resources"/"webjars"/artifact/version src: Seq[File],
base: File,
artifact: String,
version: String,
logger: Logger
): Seq[File] = {
val targetDir = base / "META-INF" / "resources" / "webjars" / artifact / version
logger.info(s"Copy webjar resources from ${src.size} files/directories.") logger.info(s"Copy webjar resources from ${src.size} files/directories.")
src.flatMap { dir => src.flatMap { dir =>
if (dir.isDirectory) { if (dir.isDirectory) {
val files = (dir ** "*").filter(_.isFile).get pair Path.relativeTo(dir) val files = (dir ** "*").filter(_.isFile).get.pair(Path.relativeTo(dir))
files.map { case (f, name) => files.map {
val target = targetDir/name case (f, name) =>
IO.createDirectories(Seq(target.getParentFile)) val target = targetDir / name
IO.copy(Seq(f -> target)) IO.createDirectories(Seq(target.getParentFile))
target IO.copy(Seq(f -> target))
target
} }
} else { } else {
val target = targetDir/dir.name val target = targetDir / dir.name
IO.createDirectories(Seq(target.getParentFile)) IO.createDirectories(Seq(target.getParentFile))
IO.copy(Seq(dir -> target)) IO.copy(Seq(dir -> target))
Seq(target) Seq(target)

113
project/ZolaPlugin.scala Normal file
View File

@ -0,0 +1,113 @@
package docspell.build
import sbt._
import sbt.Keys._
import scala.sys.process._
object ZolaPlugin extends AutoPlugin {
object autoImport {
val zolaRootDir = settingKey[File]("The root directory of zola")
val zolaOutputDir = settingKey[File]("The directory to put the final site")
val zolaCommand = settingKey[String]("The zola executable")
val zolaTestBaseUrl =
settingKey[String]("The base-url to use when building the test site.")
val zolaBuild = taskKey[Unit](
"Build the site using zola, which is then available in 'zolaOutputDir'."
)
val zolaBuildTest = taskKey[Unit](
"Build the site using zola, which is then available in 'zolaOutputDir'. " +
"It uses a different base-url. So the final site can be tested using " +
"'python -m SimpleHTTPServer 1234' for example."
)
val zolaCheck = taskKey[Unit]("Runs zola check to check links")
}
import autoImport._
def zolaSettings: Seq[Setting[_]] =
Seq(
zolaRootDir := baseDirectory.value / "site",
zolaOutputDir := target.value / "zola-site",
zolaCommand := "zola",
zolaTestBaseUrl := "http://localhost:1234",
zolaBuild := {
val logger = streams.value.log
logger.info("Building web site using zola ...")
buildSite(zolaCommand.value, zolaRootDir.value, zolaOutputDir.value, None, logger)
logger.info("Website built")
},
zolaBuildTest := {
val logger = streams.value.log
val baseurl = zolaTestBaseUrl.value
logger.info("Building web site (test) using zola ...")
buildSite(
zolaCommand.value,
zolaRootDir.value,
zolaOutputDir.value,
Some(baseurl),
logger
)
logger.info(s"Website built. Check it with base-url $baseurl")
},
zolaCheck := {
val logger = streams.value.log
logger.info("Checking web site using zola ...")
checkSite(zolaCommand.value, zolaRootDir.value, logger)
}
)
override def projectSettings: Seq[Setting[_]] =
zolaSettings
def buildSite(
zolaCmd: String,
inDir: File,
outDir: File,
base: Option[String],
logger: Logger
): Unit = {
val baseUrl = base match {
case Some(url) =>
Seq("--base-url", url)
case None =>
runYarnInstall("yarn", inDir.getParentFile, logger)
runElmCompile("elm", inDir.getParentFile, outDir, logger)
Seq.empty
}
val cmd = Seq(zolaCmd, "build", "-o", outDir.absolutePath.toString) ++ baseUrl
val proc = Process(cmd, Some(inDir))
val out = proc.!!
logger.info(out)
}
def checkSite(zolaCmd: String, inDir: File, logger: Logger): Unit = {
val cmd = Seq(zolaCmd, "check")
val proc = Process(cmd, Some(inDir))
val out = proc.!!
logger.info(out)
}
def runYarnInstall(yarnCmd: String, inDir: File, logger: Logger): Unit = {
val cmd = Seq(yarnCmd, "install")
val proc = Process(cmd, Some(inDir))
val out = proc.!!
logger.info(out)
}
def runElmCompile(elmCmd: String, inDir: File, zolaOut: File, logger: Logger): Unit = {
val cmd = Seq(
elmCmd,
"make",
"--output",
(zolaOut / "static" / "js" / "bundle.js").absolutePath.toString,
"--optimize",
(inDir/"elm"/"Main.elm").toString
)
val proc = Process(cmd, Some(inDir))
val out = proc.!!
logger.info(out)
}
}

View File

@ -1,14 +1,18 @@
with import <nixpkgs> { };
let let
initScript = writeScript "docspell-build-init" '' nixpkgsUnstable = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz";
};
pkgsUnstable = import nixpkgsUnstable { };
initScript = pkgsUnstable.writeScript "docspell-build-init" ''
export LD_LIBRARY_PATH= export LD_LIBRARY_PATH=
${bash}/bin/bash -c sbt ${pkgsUnstable.bash}/bin/bash -c sbt
''; '';
in in with pkgsUnstable;
buildFHSUserEnv { buildFHSUserEnv {
name = "docspell-sbt"; name = "docspell-sbt";
targetPkgs = pkgs: with pkgs; [ targetPkgs = pkgs: with pkgs; [
netcat jdk8 wget which zsh dpkg sbt git elmPackages.elm ncurses fakeroot mc jekyll netcat jdk8 wget which zsh dpkg sbt git elmPackages.elm ncurses fakeroot mc
zola yarn zola yarn
# haskells http client needs this (to download elm packages) # haskells http client needs this (to download elm packages)

View File

@ -1,9 +1,9 @@
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.19") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.19")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.github.eikek" % "sbt-openapi-schema" % "0.6.1") addSbtPlugin("com.github.eikek" % "sbt-openapi-schema" % "0.6.1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.4") addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.4")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1") addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")

View File

@ -4,8 +4,7 @@ set -e
yarn install yarn install
elm make --output site/static/js/bundle.js --optimize elm/Main.elm elm make --output site/static/js/bundle.js --optimize elm/Main.elm
cd site cd site && zola build
zola build
cd .. cd ..
echo "Site is in site/public." echo "Site is in site/public."