-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
build.sbt
98 lines (87 loc) · 2.8 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
import scala.sys.process._
import laika.config.LinkConfig
import laika.config.ApiLinks
import laika.ast.Path
val scala213 = "2.13.14"
val scala3 = "3.3.4"
ThisBuild / organization := "org.creativescala"
ThisBuild / organizationName := "Creative Scala"
ThisBuild / crossScalaVersions := List(scala3, scala213)
ThisBuild / scalaVersion := crossScalaVersions.value.head
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0"
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / console / initialCommands := """
|import doodle.core._
|import doodle.image._
|import doodle.syntax.all._
|import doodle.image.syntax.all._
|import doodle.java2d._
""".trim.stripMargin
lazy val css = taskKey[Unit]("Build the CSS")
lazy val build = taskKey[Unit]("Build the book")
val commonSettings = Seq(
libraryDependencies ++= Seq(
"org.creativescala" %%% "doodle" % "0.23.0",
"org.creativescala" %%% "chartreuse-core" % "0.2.0"
)
)
lazy val book = project
.in(file("book"))
.settings(
commonSettings,
scalacOptions ++= Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-unchecked",
"-feature",
"-language:implicitConversions",
"-language:postfixOps",
"-Xfatal-warnings"
),
mdocIn := sourceDirectory.value / "pages",
mdocOut := target.value / "pages",
Laika / sourceDirectories := Seq(
mdocOut.value,
sourceDirectory.value / "js",
(examples.js / Compile / fastOptJS / artifactPath).value
.getParentFile() / s"${(examples.js / moduleName).value}-fastopt"
),
laikaExtensions ++= Seq(
laika.format.Markdown.GitHubFlavor,
laika.config.SyntaxHighlighting,
),
laikaSite / target := target.value / "creative-scala",
laikaIncludeEPUB := false,
laikaIncludePDF := false,
laikaTheme := CreativeScalaTheme.empty.addJs(Path.Root / "main.js").build,
css := {
val src = sourceDirectory.value / "css"
val dest1 = mdocOut.value
val dest2 = (laikaSite / target).value
val cmd1 =
s"npx tailwindcss -i ${src.toString}/creative-scala.css -o ${dest1.toString}/creative-scala.css"
val cmd2 =
s"npx tailwindcss -i ${src.toString}/creative-scala.css -o ${dest2.toString}/creative-scala.css"
cmd1 !
cmd2 !
}
)
.enablePlugins(MdocPlugin, LaikaPlugin)
.dependsOn(examples.jvm)
lazy val examples =
crossProject(JSPlatform, JVMPlatform)
.in(file("examples"))
.settings(commonSettings)
build := Def
.sequential(
(examples.js / Compile / fastLinkJS),
(book / Compile / run).toTask(""),
(book / mdoc).toTask(""),
book / css,
book / laikaSite,
book / css
)
.value