-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
64 lines (55 loc) · 2.09 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
// shadow sbt-scalajs' crossProject and CrossType from Scala.js 0.6.x
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import scala.sys.process._
scalaVersion := "2.12.6"
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-feature",
"-Xfatal-warnings",
"-Xlint:all",
)
lazy val packagePage = taskKey[Unit]("Package an optimized version of the webpage")
lazy val testPage = taskKey[Unit]("Quickly build a test version of the webpage")
lazy val construct =
// select supported platforms
crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full)
.in(file("."))
.settings(
scalaVersion := "2.12.6",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scala-lang.modules" %%% "scala-parser-combinators" % "1.0.5",
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
"org.scalatest" %% "scalatest" % "3.0.5" % Test,
))
.jsSettings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.6",
),
packagePage := {
// Depend on fullOptJS
(fullOptJS in Compile).value
val log = streams.value.log
val webpageRoot = s"${(classDirectory in Compile).value}/webpage/"
val jsPath = (artifactPath in fullOptJS in Compile).value
jsPath #> file(s"$webpageRoot/js/construct.js") ! log
Process("tar" :: "-cf" :: "../webpage.tar" :: "webpage" :: Nil,
file(s"${(classDirectory in Compile).value}")) ! log
},
testPage := {
// Depend on fastOptJS
(fastOptJS in Compile).value
val log = streams.value.log
val webpageRoot = s"${(classDirectory in Compile).value}/webpage/"
val jsPath = (artifactPath in fastOptJS in Compile).value
jsPath #> file(s"$webpageRoot/js/construct.js") ! log
},
) // defined in sbt-scalajs-crossproject
.jvmSettings(
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-swing" % "2.0.3",
))
lazy val constructJS = construct.js
lazy val constructJVM = construct.jvm