This repository has been archived by the owner on Sep 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.sbt
65 lines (48 loc) · 2.25 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
import java.io.{FileReader, StringWriter}
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.events.ScalarEvent
name := "ledger-wallet-ethereum-chrome"
version := "1.0"
scalaVersion := "2.11.8"
enablePlugins(ScalaJSPlugin)
val build = taskKey[Unit]("Build the chrome packaged app")
persistLauncher := true
relativeSourceMaps := true
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.8.0"
libraryDependencies += "biz.enef" %%% "scalajs-angulate" % "0.2.4"
libraryDependencies += "net.lullabyte" %%% "scala-js-chrome" % "0.2.1"
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.0"
libraryDependencies += "be.doeraene" %%% "scalajs-jquery" % "0.9.0"
libraryDependencies += "com.lihaoyi" %%% "upickle" % "0.4.0"
libraryDependencies += "io.github.widok" %%% "scala-js-momentjs" % "0.1.5"
resolvers += Resolver.sonatypeRepo("snapshots")
resolvers += Resolver.sonatypeRepo("releases")
lazy val root = (project in file(".")).enablePlugins(SbtWeb)
includeFilter in (Assets, LessKeys.less) := "common.less"
sourceGenerators in Compile <+= sourceManaged in Compile map { dir =>
val file = dir / "co" / "ledger" / "wallet" / "web" / "ethereum" / "i18n" / "I18nLanguagesManifest.scala"
file.getParentFile.mkdirs()
new BuildI18nFiles().buildManifest(new File("src/main/resources/locales"), file)
Seq(file)
}
build := {
val appDir = target(_/"chrome-app").value
appDir.mkdir()
val resDir = (resourceDirectory in Compile).value
// Copy all resources in chrome unpackaged directory
IO.copyDirectory(resDir, appDir)
// Build the application and copy to app directory
val sourceFile = fastOptJS.in(Compile).value.data
IO.copyFile(sourceFile, new File(appDir, sourceFile.name))
val mapSourceFile = new File(sourceFile.absolutePath + ".map")
if (mapSourceFile.exists())
IO.copyFile(mapSourceFile, new File(appDir, mapSourceFile.name))
val launcherFile = new File(sourceFile.getParent, name.value + "-launcher.js")
IO.copyFile(launcherFile, new File(appDir, launcherFile.name))
// Copy less files in bundle
IO.copyDirectory(new File(sourceFile.getParentFile.getParentFile, "web/less/main/stylesheets"), appDir)
// Compile i18n files
new BuildI18nFiles().build(resDir, appDir)
()
}
build <<= build.dependsOn(fastOptJS in Compile)