-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
51 lines (45 loc) · 1.6 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
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
def generateIndexTask(index: String, suffix: String) = Def.task {
val source = baseDirectory.value / "index.html"
val target = (Compile / crossTarget).value / index
val log = streams.value.log
IO.writeLines(target,
IO.readLines(source).map {
line => line.replace("{{target-js}}", s"formulafx-$suffix.js")
}
)
log.info(s"Generate $index with suffix: $suffix")
}
lazy val commonSettings = Seq(
scalaVersion := "3.5.0",
version := "0.4.0",
libraryDependencies += "org.scala-lang.modules" %%% "scala-parser-combinators" % "2.4.0",
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.19" % "test"
)
lazy val root = project.in(file(".")).
aggregate(pJVM, pJS).
settings(
name := "FormulaFX",
publish := {},
publishLocal := {}
)
lazy val projs = crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Full)
.in(file("."))
.settings(
commonSettings,
name := "FormulaFX",
maxErrors := 1,
scalacOptions ++= Seq("-unchecked", "-deprecation")
)
.jvmSettings(
// Add JVM-specific settings here
libraryDependencies += "org.scala-lang.modules" %% "scala-swing" % "3.0.0",
assemblyJarName := "FormulaFX.jar"
)
.jsSettings(
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.8.0",
(Compile / fastOptJS) := (Compile / fastOptJS).dependsOn(generateIndexTask("index-fast.html","fastOpt")).value,
(Compile / fullOptJS) := (Compile / fullOptJS).dependsOn(generateIndexTask("index.html","opt")).value
)
lazy val pJVM = projs.jvm
lazy val pJS = projs.js