-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sbt
190 lines (169 loc) · 6.23 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
val scalaV = "2.12.10"
val projectName = "org.seekloud.geek"
val projectVersion = "2020.02.26a"
resolvers += Resolver.sonatypeRepo("snapshots")
resolvers += "jitpack" at "https://jitpack.io"
val projectMainClass = "org.seekloud.geek.Boot"
val clientMain = "org.seekloud.geek.client.Boot"
def commonSettings = Seq(
version := projectVersion,
scalaVersion := scalaV,
scalacOptions ++= Seq(
//"-deprecation",
"-feature"
),
javacOptions ++= Seq("-encoding", "UTF-8")
)
// shadow sbt-scalajs' crossProject and CrossType until Scala.js 1.0.0 is released
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
lazy val shared =
crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.settings(commonSettings: _*)
lazy val sharedJvm = shared.jvm
lazy val sharedJs = shared.js
// Scala-Js frontend
lazy val frontend = (project in file("frontend"))
.enablePlugins(ScalaJSPlugin)
.settings(name := "frontend")
.settings(commonSettings: _*)
.settings(
inConfig(Compile)(
Seq(
fullOptJS,
fastOptJS,
packageJSDependencies,
packageMinifiedJSDependencies
).map(f => (crossTarget in f) ~= (_ / "sjsout"))
))
.settings(skip in packageJSDependencies := false)
.settings(
scalaJSUseMainModuleInitializer := true,
//mainClass := Some("com.neo.sk.virgour.front.Main"),
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % Dependencies.circeVersion,
"io.circe" %%% "circe-generic" % Dependencies.circeVersion,
"io.circe" %%% "circe-parser" % Dependencies.circeVersion,
"org.scala-js" %%% "scalajs-dom" % Dependencies.scalaJsDomV,
//"io.suzaku" %%% "diode" % "1.1.2",
"com.lihaoyi" %%% "scalatags" % "0.6.7" withSources(),
// "com.github.japgolly.scalacss" %%% "core" % "0.5.5" withSources(),
"com.github.karasiq" %%% "scalajs-videojs" % "1.0.5",
"in.nvilla" %%% "monadic-html" % "0.4.0" withSources()
)
)
.dependsOn(sharedJs)
val captureMain = "org.seekloud.geek.capture.Boot"
lazy val capture = (project in file("capture")).enablePlugins(PackPlugin)
.settings(commonSettings: _*)
.settings(
mainClass in reStart := Some(captureMain),
javaOptions in reStart += "-Xmx2g"
)
.settings(name := "capture")
.settings(
//pack
// If you need to specify main classes manually, use packSettings and packMain
//packSettings,
// [Optional] Creating `hello` command that calls org.mydomain.Hello#main(Array[String])
packMain := Map("capture" -> playerMain),
packJvmOpts := Map("capture" -> Seq("-Xmx256m", "-Xms64m")),
packExtraClasspath := Map("capture" -> Seq("."))
)
.settings(
// libraryDependencies ++= Dependencies.backendDependencies,
libraryDependencies ++= Dependencies.bytedecoLibs,
libraryDependencies ++= Dependencies4Capture.captureDependencies,
)
.dependsOn(sharedJvm)
lazy val client = (project in file("client")).enablePlugins(PackPlugin)
.settings(commonSettings: _*)
.settings(
mainClass in reStart := Some(clientMain),
javaOptions in reStart += "-Xmx2g"
)
.settings(name := "client")
.settings(
//pack
// If you need to specify main classes manually, use packSettings and packMain
//packSettings,
// [Optional] Creating `hello` command that calls org.mydomain.Hello#main(Array[String])
packMain := Map("client" -> clientMain),
packJvmOpts := Map("client" -> Seq("-Xmx4096m", "-Xms128m")),
packExtraClasspath := Map("client" -> Seq("."))
)
.settings(
// libraryDependencies ++= Dependencies.backendDependencies,
libraryDependencies ++= Dependencies.bytedecoLibs,
libraryDependencies ++= Dependencies4Client.clientDependencies,
)
.dependsOn(sharedJvm,player,capture)
val playerMain = "org.seekloud.geek.player.Boot"
lazy val player = (project in file("player")).enablePlugins(PackPlugin)
.settings(commonSettings: _*)
.settings(
mainClass in reStart := Some(playerMain),
javaOptions in reStart += "-Xmx2g"
)
.settings(name := "player")
.settings(
//pack
// If you need to specify main classes manually, use packSettings and packMain
//packSettings,
// [Optional] Creating `hello` command that calls org.mydomain.Hello#main(Array[String])
packMain := Map("player" -> playerMain),
packJvmOpts := Map("player" -> Seq("-Xmx256m", "-Xms64m")),
packExtraClasspath := Map("player" -> Seq("."))
)
.settings(
// libraryDependencies ++= Dependencies.backendDependencies,
libraryDependencies ++= Dependencies.bytedecoLibs,
libraryDependencies ++= Dependencies4Player.playerDependencies,
)
.dependsOn(sharedJvm)
// Akka Http based backend
lazy val backend = (project in file("backend")).enablePlugins(PackPlugin)
.settings(commonSettings: _*)
.settings(
mainClass in reStart := Some(projectMainClass),
javaOptions in reStart += "-Xmx2g"
)
.settings(name := "backend")
.settings(
//pack
// If you need to specify main classes manually, use packSettings and packMain
//packSettings,
// [Optional] Creating `hello` command that calls org.mydomain.Hello#main(Array[String])
packMain := Map("org.seekloud.geek" -> projectMainClass),
packJvmOpts := Map("org.seekloud.geek" -> Seq("-Xmx4096m", "-Xms1024m")),
packExtraClasspath := Map("org.seekloud.geek" -> Seq("."))
)
.settings(
libraryDependencies ++= Dependencies.backendDependencies,
libraryDependencies ++= Dependencies.bytedecoLibs,
libraryDependencies ++= Dependencies.testLibs
)
.settings {
(resourceGenerators in Compile) += Def.task {
val fastJsOut = (fastOptJS in Compile in frontend).value.data
val fastJsSourceMap = fastJsOut.getParentFile / (fastJsOut.getName + ".map")
Seq(
fastJsOut,
fastJsSourceMap
)
}.taskValue
}
.settings((resourceGenerators in Compile) += Def.task {
Seq(
(packageJSDependencies in Compile in frontend).value
//(packageMinifiedJSDependencies in Compile in frontend).value
)
}.taskValue)
.settings(
(resourceDirectories in Compile) += (crossTarget in frontend).value,
watchSources ++= (watchSources in frontend).value
)
.dependsOn(sharedJvm)
lazy val root = (project in file("."))
.aggregate(frontend,backend)
.settings(name := projectName)