-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.sbt
More file actions
71 lines (54 loc) · 2.05 KB
/
build.sbt
File metadata and controls
71 lines (54 loc) · 2.05 KB
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
import java.nio.file.Files.{copy, deleteIfExists, newDirectoryStream, walk}
import java.nio.file.StandardCopyOption.REPLACE_EXISTING
import java.nio.file.{Path, Paths}
import java.util.function.Consumer
import scala.collection.JavaConversions.asScalaIterator
enablePlugins(ScalaJSPlugin)
organization := "com.me"
name := "playground-binding.scala"
developers := List(
Developer(
"ccamel",
"Chris Camel",
"camel.christophe@gmail.com",
url("https://github.com/ccamel")
)
)
startYear := Some(2017)
scalaVersion := "2.13.5"
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.8",
"org.scala-lang.modules" % "scala-xml_2.12" % "1.3.0",
"com.thoughtworks.binding" %%% "dom" % "11.9.0",
"com.thoughtworks.binding" %%% "route" % "11.9.0",
"org.scalatest" %%% "scalatest" % "3.2.8" % "test",
"org.scalatest" %% "scalatest" % "3.2.8" % "test" // FIXME: https://github.com/scalatest/scalatest/issues/911
)
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
scalaJSUseMainModuleInitializer := true
lazy val dist = taskKey[Unit]("Make distribution")
dist := {
implicit def toPath(filename: String): Path = Paths.get(filename)
val targetDir: Path = "target"
val srcDir: Path = targetDir.resolve("scala-2.12")
val distDir: Path = "dist"
val jsDir = distDir.resolve("js")
val archive = targetDir.resolve("playground-binding.scala.zip")
streams.value.log.info(s"Make distribution to $distDir")
newDirectoryStream(srcDir, "playground*.js").forEach(new Consumer[Path]() {
override def accept(f: Path): Unit = {
val dst = jsDir.resolve(f.getFileName)
dst.toFile.mkdirs()
copy(f, dst, REPLACE_EXISTING)
}
})
copy("index.html", distDir.resolve("index.html"), REPLACE_EXISTING)
streams.value.log.info(s"Create archive")
deleteIfExists(archive)
val files = walk(distDir)
.iterator()
.toTraversable
.map { it => (it.toFile, distDir.relativize(it).toString) }
sbt.IO.zip(files, archive.toFile)
}
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)