-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sbt
290 lines (261 loc) · 10.4 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
lazy val commonSettings = Seq(
organization := "com.github.olivierblanvillain",
version := "0.1-SNAPSHOT",
scalaVersion := "2.11.5",
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-unchecked",
"-language:reflectiveCalls",
"-Yno-adapted-args",
"-Ywarn-numeric-widen",
"-Xfuture",
"-Xlint"
),
homepage := Some(url("https://github.com/OlivierBlanvillain/scalajs-transport")),
licenses := Seq(("MIT", url("http://opensource.org/licenses/mit-license.php"))),
scmInfo := Some(ScmInfo(
url("https://github.com/OlivierBlanvillain/scalajs-transport"),
"scm:git:[email protected]:OlivierBlanvillain/scalajs-transport.git",
Some("scm:git:[email protected]:OlivierBlanvillain/scalajs-transport.git"))),
pomExtra := (
<developers>
<developer>
<id>OlivierBlanvillain</id>
<name>Olivier Blanvillain</name>
<url>https://github.com/OlivierBlanvillain/</url>
</developer>
</developers>
)
) ++ sonatypeSettings
lazy val buildSettings = Defaults.defaultSettings ++ Seq(javaOptions += "-Xmx1G")
parallelExecution in Global := false
lazy val root = project
.in(file("."))
.aggregate(
transportCoreJS,
transportCoreJVM,
transportJavaScriptJS,
transportJavaScriptJVM,
transportWebRTCJS,
transportWebRTCJVM,
transportNettyJS,
transportNettyJVM,
transportPlayJS,
transportPlayJVM,
transportTyrusJS,
transportTyrusJVM,
transportAkkaJS,
transportAkkaJVM,
transportRPCJS,
transportRPCJVM)
lazy val examples = project
.in(file("examples"))
.aggregate(
transportTestJVM,
transportTestPlayJVM,
reportListingsJVM,
exampleRPCJVM,
chatWebSocketJVM,
chatWebRTCJVM,
chatWebRTCFallbackJVM)
// Transport
lazy val transportCore = crossProject
.crossType(CrossType.Full)
.in(file("transport/core"))
.settings(commonSettings: _*)
.settings(name := "transport-core")
lazy val transportCoreJVM = transportCore.jvm
lazy val transportCoreJS = transportCore.js
lazy val transportJavaScript = crossProject
.crossType(CrossType.Dummy)
.in(file("transport/javascript"))
.settings(commonSettings: _*)
.settings(name := "transport-javascript")
.dependsOn(transportCore)
.jsSettings(libraryDependencies +=
"org.scala-js" %%% "scalajs-dom" % "0.8.0")
lazy val transportJavaScriptJVM = transportJavaScript.jvm
lazy val transportJavaScriptJS = transportJavaScript.js
lazy val transportWebRTC = crossProject
.crossType(CrossType.Full)
.in(file("transport/webrtc"))
.settings(commonSettings: _*)
.settings(name := "transport-webrtc")
.dependsOn(transportCore)
.jsSettings(libraryDependencies +=
"org.scala-js" %%% "scalajs-dom" % "0.8.0")
lazy val transportWebRTCJVM = transportWebRTC.jvm
lazy val transportWebRTCJS = transportWebRTC.js
lazy val transportNetty = crossProject
.crossType(CrossType.Dummy)
.in(file("transport/netty"))
.settings(commonSettings: _*)
.settings(name := "transport-netty")
.dependsOn(transportCore)
.jvmSettings(libraryDependencies +=
"io.netty" % "netty-all" % "4.0.24.Final")
lazy val transportNettyJVM = transportNetty.jvm
lazy val transportNettyJS = transportNetty.js
lazy val transportPlay = crossProject
.crossType(CrossType.Dummy)
.in(file("transport/play"))
.settings(commonSettings: _*)
.settings(name := "transport-play")
.dependsOn(transportCore)
.jvmSettings(libraryDependencies ++= Seq(
"com.github.fdimuccio" %% "play2-sockjs" % "0.3.0",
"com.typesafe.akka" %% "akka-actor" % "2.3.6",
"com.typesafe.play" %% "play" % "2.3.5"))
lazy val transportPlayJVM = transportPlay.jvm
lazy val transportPlayJS = transportPlay.js
lazy val transportTyrus = crossProject
.crossType(CrossType.Dummy)
.in(file("transport/tyrus"))
.settings(commonSettings: _*)
.settings(name := "transport-tyrus")
.dependsOn(transportCore)
.jvmSettings(libraryDependencies +=
"org.glassfish.tyrus.bundles" % "tyrus-standalone-client" % "1.8.3")
lazy val transportTyrusJVM = transportTyrus.jvm
lazy val transportTyrusJS = transportTyrus.js
lazy val transportAkka = crossProject
.crossType(CrossType.Full)
.in(file("transport/akka"))
.settings(commonSettings: _*)
.settings(name := "transport-akka")
.dependsOn(transportCore)
.jvmSettings(libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.3.6",
"org.scalajs" %% "scalajs-pickling-play-json" % "0.4-SNAPSHOT"))
.jsSettings(libraryDependencies ++= Seq(
"org.scalajs" %%% "scalajs-pickling" % "0.4-SNAPSHOT",
"org.scalajs" %%% "scalajs-actors" % "0.1-SNAPSHOT"))
lazy val transportAkkaJVM = transportAkka.jvm
lazy val transportAkkaJS = transportAkka.js
lazy val transportRPC = crossProject
.crossType(CrossType.Pure)
.in(file("transport/rpc"))
.settings(commonSettings: _*)
.settings(name := "transport-rpc")
.dependsOn(transportCore)
.settings(libraryDependencies ++= Seq(
"com.lihaoyi" %%% "upickle" % "0.2.6",
"com.lihaoyi" %%% "autowire" % "0.2.4"))
lazy val transportRPCJVM = transportRPC.jvm
lazy val transportRPCJS = transportRPC.js
lazy val transportTestPlayJVM = project.in(file("transport/test-play"))
.settings(commonSettings: _*)
.enablePlugins(PlayScala)
.settings(libraryDependencies ++= Seq(
"org.seleniumhq.selenium" % "selenium-java" % "2.43.1",
"com.github.detro.ghostdriver" % "phantomjsdriver" % "1.0.4" % "test"))
lazy val transportTestJVM = project.in(file("transport/test"))
.settings(commonSettings: _*)
.dependsOn(transportNettyJVM)
.dependsOn(transportTyrusJVM)
.settings(libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.11" % "2.2.1" % "test"))
// Cross Play/Scala.js settings
lazy val sharedPlayScalaJS = Seq(
unmanagedSourceDirectories in Compile += baseDirectory.value / "../shared/src/main/scala",
unmanagedSourceDirectories in Test += baseDirectory.value / "../shared/src/test/scala",
unmanagedResourceDirectories in Compile += baseDirectory.value / "../shared/src/main/resources",
unmanagedResourceDirectories in Test += baseDirectory.value / "../shared/src/test/resources")
lazy val UK = new com.typesafe.sbt.packager.universal.UniversalKeys{}
def playWithScalaJS(scalaJSProject: Project) = Seq(
UK.dist <<= UK.dist dependsOn (fullOptJS in (scalaJSProject, Compile)),
UK.stage <<= UK.stage dependsOn (fullOptJS in (scalaJSProject, Compile))
, compile in Compile <<= (compile in Compile) dependsOn (fastOptJS in (scalaJSProject, Compile))
) ++ sharedPlayScalaJS
lazy val scalaJSWithPlay = Seq(
crossTarget in (Compile, packageScalaJSLauncher) := baseDirectory.value / "../jvm/public/javascripts",
crossTarget in (Compile, fastOptJS) := baseDirectory.value / "../jvm/public/javascripts",
crossTarget in (Compile, fullOptJS) := baseDirectory.value / "../jvm/public/javascripts"
) ++ sharedPlayScalaJS
// Examples
lazy val reportListings = crossProject
.crossType(CrossType.Dummy)
.in(file("examples/report-listings"))
.settings(commonSettings: _*)
.dependsOn(transportRPC, transportAkka, transportTyrus, transportNetty, transportWebRTC)
lazy val reportListingsJVM = reportListings.jvm
lazy val reportListingsJS = reportListings.js
lazy val rawWebRTC = crossProject
.crossType(CrossType.Dummy)
.in(file("examples/raw-webrtc"))
.settings(commonSettings: _*)
.dependsOn(transportJavaScript, transportAkka, transportWebRTC)
lazy val rawWebRTCJVM = rawWebRTC.jvm
lazy val rawWebRTCJS = rawWebRTC.js
lazy val exampleRPCJS = project
.in(file("examples/rpc/js"))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings: _*)
.settings(scalaJSWithPlay: _*)
.dependsOn(transportJavaScriptJS, transportPlayJS, transportRPCJS)
.settings(libraryDependencies ++= Seq(
"com.lihaoyi" %%% "scalatags" % "0.4.5"))
lazy val exampleRPCJVM = project
.in(file("examples/rpc/jvm"))
.enablePlugins(PlayScala)
.settings(commonSettings: _*)
.settings(playWithScalaJS(exampleRPCJS): _*)
.dependsOn(transportPlayJVM, transportRPCJVM, transportTestPlayJVM % "test->test")
.settings(libraryDependencies ++= Seq(
"org.webjars" % "sockjs-client" % "0.3.4",
"org.webjars" %% "webjars-play" % "2.3.0",
"org.webjars" % "bootstrap" % "3.2.0"))
lazy val chatWebSocketJS = project
.in(file("examples/chat-websocket/js"))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings: _*)
.settings(scalaJSWithPlay: _*)
.dependsOn(transportJavaScriptJS, transportPlayJS, transportAkkaJS)
.settings(libraryDependencies ++= Seq(
"be.doeraene" %%% "scalajs-jquery" % "0.8.0"))
lazy val chatWebSocketJVM = project
.in(file("examples/chat-websocket/jvm"))
.enablePlugins(PlayScala)
.settings(commonSettings: _*)
.settings(playWithScalaJS(chatWebSocketJS): _*)
.dependsOn(transportPlayJVM, transportAkkaJVM, transportTestPlayJVM % "test->test")
.settings(libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.3.0",
"org.webjars" % "sockjs-client" % "0.3.4",
"org.webjars" % "jquery" % "2.1.1"))
lazy val chatWebRTCJS = project
.in(file("examples/chat-webrtc/js"))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings: _*)
.settings(scalaJSWithPlay: _*)
.dependsOn(transportJavaScriptJS, transportPlayJS, transportAkkaJS, transportWebRTCJS)
.settings(libraryDependencies ++= Seq(
"be.doeraene" %%% "scalajs-jquery" % "0.8.0"))
lazy val chatWebRTCJVM = project
.in(file("examples/chat-webrtc/jvm"))
.enablePlugins(PlayScala)
.settings(commonSettings: _*)
.settings(playWithScalaJS(chatWebRTCJS): _*)
.dependsOn(transportPlayJVM, transportAkkaJVM, transportTestPlayJVM % "test->test")
.settings(libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.3.0",
"org.webjars" % "jquery" % "2.1.1"))
lazy val chatWebRTCFallbackJS = project
.in(file("examples/chat-webrtc-fallback/js"))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings: _*)
.settings(scalaJSWithPlay: _*)
.dependsOn(transportJavaScriptJS, transportPlayJS, transportAkkaJS, transportWebRTCJS)
.settings(libraryDependencies ++= Seq(
"be.doeraene" %%% "scalajs-jquery" % "0.8.0"))
lazy val chatWebRTCFallbackJVM = project
.in(file("examples/chat-webrtc-fallback/jvm"))
.enablePlugins(PlayScala)
.settings(commonSettings: _*)
.settings(playWithScalaJS(chatWebRTCFallbackJS): _*)
.dependsOn(transportPlayJVM, transportAkkaJVM, transportTestPlayJVM % "test->test")
.settings(libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.3.0",
"org.webjars" % "jquery" % "2.1.1"))