-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
63 lines (52 loc) · 1.99 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
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
ThisBuild / scalaVersion := "2.13.2"
name := "endpoints-talk"
val endpointsVersion = "1.0.0"
val shared =
crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("shared"))
.settings(
libraryDependencies += "org.endpoints4s" %%% "algebra" % endpointsVersion
)
val client =
project.in(file("client"))
.enablePlugins(ScalaJSPlugin, ScalaJSWeb)
.dependsOn(shared.js)
.settings(
libraryDependencies += "org.endpoints4s" %%% "xhr-client" % endpointsVersion,
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.7"
)
val server =
project.in(file("server"))
.enablePlugins(SbtWeb)
.dependsOn(shared.jvm)
.settings(
libraryDependencies += "org.endpoints4s" %% "akka-http-server" % endpointsVersion,
// Put client’s JavaScript artifact on the server’s classpath
libraryDependencies += "com.vmunier" %% "scalajs-scripts" % "1.1.4",
scalaJSProjects := Seq(client),
pipelineStages in Assets := Seq(scalaJSPipeline),
managedClasspath in Runtime += (packageBin in Assets).value,
WebKeys.packagePrefix in Assets := "public/",
compile in Compile := ((compile in Compile) dependsOn scalaJSPipeline).value
)
val slides = settingKey[Slides]("Utility class for rendering the slides")
slides := new Slides(
baseDirectory.value / "slides" / "index.md",
((baseDirectory.value / "slides") * "*.png" +++ (baseDirectory.value / "slides") * "*.svg").get(),
target.value / "slides" / "index.html",
baseDirectory.value / "slides" / "slidy"
)
val makeSlides = taskKey[Unit]("Compile the slides")
makeSlides := slides.value.compile()
val showSlides = taskKey[Unit]("Show the slides in a web browser")
showSlides := slides.value.startServer()
watchSources += WatchSource(baseDirectory.value / "slides")
(onLoad in Global) := {
(onLoad in Global).value.compose(
_.addExitHook {
slides.value.stopServer()
}
)
}