-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
154 lines (120 loc) · 4.75 KB
/
build.sbt
File metadata and controls
154 lines (120 loc) · 4.75 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.stage
import com.typesafe.sbt.web.Import.WebKeys._
import com.typesafe.sbt.web.SbtWeb
import spray.revolver.RevolverPlugin.Revolver
val webAssetsBase = SettingKey[File]("web-assets-base", "The directory where web assets are written")
val webAssetsPath = SettingKey[String]("web-assets-path", "The path within the web-assets-base where assets are written")
val webAssetsTarget = SettingKey[File]("web-assets-target", "The directory where web asset files will be written")
val installWindows = TaskKey[File]("install-windows", "Deploys the application on windows.")
lazy val commonSettings = Seq(
version := "0.1-SNAPSHOT",
scalaVersion := "2.11.7"
)
lazy val root = project.in(file(".")).
aggregate(appJS, appJVM).
settings(
publish := {},
publishLocal := {}
)
lazy val app = crossProject.in(file("app"))
.settings(net.virtualvoid.sbt.graph.Plugin.graphSettings:_*)
.settings(commonSettings:_*)
.configure(Deps.appDependencies)
.jvmSettings(Revolver.settings: _*)
.jvmSettings(
resolvers ++= Deps.appJVMResolvers,
libraryDependencies ++= Deps.appJVMDependencies,
// use mkgmap to generate style for garmin maps
resourceGenerators in Compile += Def.task {
uk.me.parabola.mkgmap.main.Main.mainNoSystemExit(
Seq(
s"--output-dir=${(resourceManaged in Compile).value.absolutePath}",
(baseDirectory.value / "src" / "script" / "garmin" / "typ" / "mapstyle.txt").absolutePath
).toArray
)
Seq((resourceManaged in Compile).value / "mapstyle.typ")
}.taskValue,
resourceGenerators in Compile += Def.task {
val zipFile = (resourceManaged in Compile).value / "mapstyle.zip"
val styleDir = baseDirectory.value / "src" / "script" / "garmin" / "style"
IO.zip((styleDir ** "*") filter {!_.isDirectory} pair relativeTo(styleDir), zipFile)
Seq(zipFile)
}.taskValue
).
jsSettings(
persistLauncher in Compile := true,
persistLauncher in Test := false,
requiresDOM := true,
// generataing public resources in a directory so they can be
// added to runtime classpath to be served by jvm process
webAssetsBase := target.value / "assets",
webAssetsPath := "public",
webAssetsTarget := webAssetsBase.value / webAssetsPath.value,
(crossTarget in fastOptJS) := webAssetsTarget.value,
(crossTarget in fullOptJS) := webAssetsTarget.value,
(crossTarget in packageScalaJSLauncher) := webAssetsTarget.value,
(crossTarget in packageJSDependencies) := webAssetsTarget.value,
(webJarsDirectory in Assets) := webAssetsTarget.value,
webJarsCache in webJars in Assets := target.value / "webjars-main.cache",
fastOptJS in Compile := {
(webJars in Assets).value
(fastOptJS in Compile).value
}
)
lazy val appJVM = app.jvm
.enablePlugins(JavaAppPackaging)
.dependsOn(api)
.configs()
.settings(
// adding the fully optimized JS to the prodcution build
mappings in (Compile, packageBin) ++= (
(webJars in (appJS, Assets)).value ++
Seq(
(fastOptJS in (appJS, Compile)).value.data,
(fullOptJS in (appJS, Compile)).value.data,
(packageScalaJSLauncher in (appJS, Compile)).value.data,
(packageJSDependencies in (appJS, Compile)).value
)
) pair relativeTo((webAssetsBase in appJS).value),
// using the output of fastOptJs as resources at runtime
(fullClasspath in Runtime) += (webAssetsBase in appJS).value
)
lazy val appJS = app.js
.enablePlugins(SbtWeb)
.dependsOn(
leaflet,
leafletDraw,
pouchdb,
sidebarV2,
leafletContextmenu,
bootstrapNotify
)
.configure(Deps.appJSDependencies)
lazy val api = project
.settings(commonSettings:_*)
.settings(
libraryDependencies ++= Deps.apiDependencies
)
lazy val daemon = project
.enablePlugins(JavaAppPackaging)
.settings(Revolver.settings: _*)
.settings(commonSettings:_*)
.settings(
libraryDependencies ++= Deps.daemonDependencies,
installWindows := {
val dest = new File("c:/oracle/wls/mapping")
println("Installing on Windows...")
val staged = stage.value
IO.copyDirectory(staged, dest, overwrite = true)
dest
}
)
.dependsOn(api)
// library dependencies in git submodule
lazy val leaflet = ProjectRef(file("scalajs-facades"), "leaflet")
lazy val leafletDraw = ProjectRef(file("scalajs-facades"), "leafletDraw")
lazy val leafletContextmenu = ProjectRef(file("scalajs-facades"), "leafletContextmenu")
lazy val sidebarV2 = ProjectRef(file("scalajs-facades"), "sidebarV2")
lazy val pouchdb = ProjectRef(file("scalajs-facades"), "pouchdb")
lazy val bootstrapNotify = ProjectRef(file("scalajs-facades"), "bootstrapNotify")