This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 565
/
Build.scala
302 lines (252 loc) · 12 KB
/
Build.scala
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
291
292
293
294
295
296
297
298
299
300
301
302
import sbt._
import Keys._
import com.typesafe.sbt.osgi.SbtOsgi._
import sbtunidoc.Plugin._
import UnidocKeys._
object Build extends Build {
import BuildSettings._
import Dependencies._
// configure prompt to show current project
override lazy val settings = super.settings :+ {
shellPrompt := { s => Project.extract(s).currentProject.id + " > " }
}
// -------------------------------------------------------------------------------------------------------------------
// Root Project
// -------------------------------------------------------------------------------------------------------------------
lazy val root = Project("root",file("."))
.aggregate(docs, examples, site, sprayCaching, sprayCan, sprayCanTests, sprayClient, sprayHttp, sprayHttpx,
sprayIO, sprayIOTests, sprayRouting, sprayRoutingTests, sprayServlet, sprayTestKit, sprayUtil)
.settings(basicSettings: _*)
.settings(noPublishing: _*)
.settings(unidocSettings: _*)
.settings(
unidocProjectFilter in (ScalaUnidoc, unidoc) := inAnyProject -- inProjects(docs, examples, site, sprayCanTests,
sprayCanExamples, sprayClientExamples, sprayIOExamples, sprayRoutingExamples, sprayServletExamples,
serverBenchmark, simpleHttpClient, simpleHttpServer, simpleSprayClient, echoServerExample, onJetty, onSprayCan,
simpleRoutingApp, simpleSprayServletServer),
target in (ScalaUnidoc, unidoc) := (resourceManaged in Compile in site).value / "api" / version.value,
scalacOptions in (ScalaUnidoc, unidoc) += "-Ymacro-no-expand")
// -------------------------------------------------------------------------------------------------------------------
// Modules
// -------------------------------------------------------------------------------------------------------------------
lazy val sprayCaching = Project("spray-caching", file("spray-caching"))
.dependsOn(sprayUtil)
.settings(sprayModuleSettings: _*)
.settings(osgiSettings(exports = Seq("spray.caching")): _*)
.settings(libraryDependencies ++=
provided(akkaActor) ++
compile(clHashMap) ++
test(specs2)
)
lazy val sprayCan = Project("spray-can", file("spray-can"))
.dependsOn(sprayIO, sprayHttp, sprayUtil)
.settings(sprayModuleSettings: _*)
.settings(osgiSettings(exports = Seq("spray.can")): _*)
.settings(libraryDependencies ++=
provided(akkaActor) ++
test(akkaTestKit, specs2)
)
lazy val sprayCanTests = Project("spray-can-tests", file("spray-can-tests"))
.dependsOn(sprayCan, sprayHttp, sprayHttpx, sprayIO, sprayTestKit, sprayUtil)
.settings(sprayModuleSettings: _*)
.settings(noPublishing: _*)
.settings(libraryDependencies ++= test(akkaActor, specs2))
lazy val sprayClient = Project("spray-client", file("spray-client"))
.dependsOn(sprayCan, sprayHttp, sprayHttpx, sprayUtil)
.settings(sprayModuleSettings: _*)
.settings(osgiSettings(exports = Seq("spray.client")): _*)
.settings(libraryDependencies ++=
provided(akkaActor) ++
test(akkaTestKit, specs2)
)
lazy val sprayHttp = Project("spray-http", file("spray-http"))
.dependsOn(sprayUtil)
.settings(sprayModuleSettings: _*)
.settings(osgiSettings(exports = Seq("spray.http")): _*)
.settings(libraryDependencies ++=
compile(parboiled) ++
provided(akkaActor) ++
test(specs2)
)
lazy val sprayHttpx = Project("spray-httpx", file("spray-httpx"))
.dependsOn(sprayHttp, sprayUtil,
sprayIO) // for access to akka.io.Tcp, can go away after upgrade to Akka 2.2
.settings(sprayModuleSettings: _*)
.settings(osgiSettings(exports = Seq("spray.httpx"), imports = Seq(
"spray.json.*;resolution := optional",
"net.liftweb.*;resolution := optional",
"org.json4s.*;resolution := optional",
"twirl.*;resolution := optional",
"play.*;resolution := optional"
)): _*)
.settings(libraryDependencies ++=
compile(mimepull) ++
provided(akkaActor, sprayJson, twirlApi, playTwirlApi, liftJson, json4sNative, json4sJackson, playJson) ++
test(specs2)
)
lazy val sprayIO = Project("spray-io", file("spray-io"))
.dependsOn(sprayUtil, sprayHttp)
.settings(sprayModuleSettings: _*)
.settings(osgiSettings(exports = Seq("spray.io", "akka.io")): _*)
.settings(libraryDependencies ++= provided(akkaActor, scalaReflect))
lazy val sprayIOTests = Project("spray-io-tests", file("spray-io-tests"))
.dependsOn(sprayIO, sprayTestKit, sprayUtil)
.settings(sprayModuleSettings: _*)
.settings(noPublishing: _*)
.settings(libraryDependencies ++= test(akkaActor, specs2, scalatest))
lazy val sprayRouting = Project("spray-routing", file("spray-routing"))
.dependsOn(
sprayCaching % "provided", // for the CachingDirectives trait and CachedUserPassAuthenticator object
sprayCan % "provided", // for the SimpleRoutingApp trait
sprayHttp, sprayHttpx, sprayUtil,
sprayIO) // for access to akka.io.Tcp, can go away after upgrade to Akka 2.2
.settings(sprayModuleSettings: _*)
.settings(spray.boilerplate.BoilerplatePlugin.Boilerplate.settings: _*)
.settings(osgiSettings(exports = Seq("spray.routing"), imports = Seq(
"spray.caching.*;resolution:=optional",
"spray.can.*;resolution:=optional",
"spray.io.*;resolution:=optional"
)): _*)
.settings(libraryDependencies ++=
compile(shapeless) ++
provided(akkaActor)
)
lazy val sprayRoutingTests = Project("spray-routing-tests", file("spray-routing-tests"))
.dependsOn(sprayCaching, sprayHttp, sprayHttpx, sprayRouting, sprayTestKit, sprayUtil)
.settings(sprayModuleSettings: _*)
.settings(noPublishing: _*)
.settings(libraryDependencies ++= test(akkaActor, specs2, shapeless, sprayJson))
lazy val sprayServlet = Project("spray-servlet", file("spray-servlet"))
.dependsOn(sprayHttp, sprayUtil,
sprayIO) // for access to akka.io.Tcp, can go away after upgrade to Akka 2.2
.settings(sprayModuleSettings: _*)
.settings(osgiSettings(exports = Seq("spray.servlet"), imports = Seq("javax.servlet.*;version=\"[2.6,4.0)\"")): _*)
.settings(libraryDependencies ++=
provided(akkaActor, servlet30) ++
test(specs2)
)
lazy val sprayTestKit = Project("spray-testkit", file("spray-testkit"))
.dependsOn(
sprayHttp % "provided",
sprayHttpx % "provided",
sprayIO % "provided",
sprayRouting % "provided",
sprayUtil
)
.settings(sprayModuleSettings: _*)
.settings(libraryDependencies ++= akkaTestKit +: provided(akkaActor, scalatest, specs2))
lazy val sprayUtil = Project("spray-util", file("spray-util"))
.settings(sprayModuleSettings: _*)
.settings(sprayVersionConfGeneration: _*)
.settings(osgiSettings(exports = Seq("spray.util", "akka.spray")): _*)
.settings(libraryDependencies ++=
provided(akkaActor, scalaReflect) ++
test(akkaTestKit, specs2)
)
// -------------------------------------------------------------------------------------------------------------------
// Site Project
// -------------------------------------------------------------------------------------------------------------------
lazy val site = Project("site", file("site"))
.dependsOn(sprayCaching, sprayCan, sprayRouting)
.enablePlugins(play.twirl.sbt.SbtTwirl)
.settings(siteSettings: _*)
.settings(SphinxSupport.settings: _*)
.settings(libraryDependencies ++=
compile(akkaActor, sprayJson) ++
runtime(akkaSlf4j, logback) ++
test(specs2)
)
lazy val docs = Project("docs", file("docs"))
.dependsOn(sprayCaching, sprayCan, sprayClient, sprayHttp, sprayHttpx, sprayIO, sprayRouting,
sprayServlet, sprayTestKit, sprayUtil)
.settings(docsSettings: _*)
.settings(libraryDependencies ++= test(akkaActor, sprayJson, specs2, json4sNative))
// -------------------------------------------------------------------------------------------------------------------
// Example Projects
// -------------------------------------------------------------------------------------------------------------------
lazy val examples = Project("examples", file("examples"))
.aggregate(sprayCanExamples, sprayClientExamples, sprayIOExamples, sprayRoutingExamples, sprayServletExamples)
.settings(exampleSettings: _*)
lazy val sprayCanExamples = Project("spray-can-examples", file("examples/spray-can"))
.aggregate(serverBenchmark, simpleHttpClient, simpleHttpServer)
.settings(exampleSettings: _*)
lazy val serverBenchmark = Project("server-benchmark", file("examples/spray-can/server-benchmark"))
.dependsOn(sprayCan, sprayHttp)
.settings(benchmarkSettings: _*)
.settings(libraryDependencies ++=
compile(akkaActor, sprayJson) ++
runtime(akkaSlf4j, logback)
)
lazy val simpleHttpClient = Project("simple-http-client", file("examples/spray-can/simple-http-client"))
.dependsOn(sprayCan, sprayHttp)
.settings(exampleSettings: _*)
.settings(libraryDependencies ++=
compile(akkaActor) ++
runtime(akkaSlf4j, logback)
)
lazy val simpleHttpServer = Project("simple-http-server", file("examples/spray-can/simple-http-server"))
.dependsOn(sprayCan, sprayHttp)
.settings(standaloneServerExampleSettings: _*)
.settings(libraryDependencies ++=
compile(akkaActor, mimepull) ++
runtime(akkaSlf4j, logback)
)
lazy val sprayClientExamples = Project("spray-client-examples", file("examples/spray-client"))
.aggregate(simpleSprayClient)
.settings(exampleSettings: _*)
lazy val simpleSprayClient = Project("simple-spray-client", file("examples/spray-client/simple-spray-client"))
.dependsOn(sprayClient)
.settings(exampleSettings: _*)
.settings(libraryDependencies ++=
compile(akkaActor, sprayJson) ++
runtime(akkaSlf4j, logback)
)
lazy val sprayIOExamples = Project("spray-io-examples", file("examples/spray-io"))
.aggregate(echoServerExample)
.settings(exampleSettings: _*)
lazy val echoServerExample = Project("echo-server", file("examples/spray-io/echo-server"))
.dependsOn(sprayIO)
.settings(standaloneServerExampleSettings: _*)
.settings(libraryDependencies ++=
compile(akkaActor) ++
runtime(akkaSlf4j, logback)
)
lazy val sprayRoutingExamples = Project("spray-routing-examples", file("examples/spray-routing"))
.aggregate(onJetty, onSprayCan, simpleRoutingApp)
.settings(exampleSettings: _*)
lazy val onJetty = Project("on-jetty", file("examples/spray-routing/on-jetty"))
.dependsOn(sprayCaching, sprayServlet, sprayRouting, sprayTestKit % "test")
.settings(jettyExampleSettings: _*)
.settings(libraryDependencies ++=
compile(akkaActor) ++
test(specs2) ++
runtime(akkaSlf4j, logback) ++
container(jettyWebApp, servlet30)
)
lazy val onSprayCan = Project("on-spray-can", file("examples/spray-routing/on-spray-can"))
.dependsOn(sprayCaching, sprayCan, sprayRouting, sprayTestKit % "test")
.settings(standaloneServerExampleSettings: _*)
.settings(libraryDependencies ++=
compile(akkaActor) ++
test(specs2) ++
runtime(akkaSlf4j, logback)
)
lazy val simpleRoutingApp = Project("simple-routing-app", file("examples/spray-routing/simple-routing-app"))
.dependsOn(sprayCan, sprayRouting)
.settings(standaloneServerExampleSettings: _*)
.settings(libraryDependencies ++= compile(akkaActor))
lazy val sprayServletExamples = Project("spray-servlet-examples", file("examples/spray-servlet"))
.aggregate(simpleSprayServletServer)
.settings(exampleSettings: _*)
lazy val simpleSprayServletServer = Project("simple-spray-servlet-server",
file("examples/spray-servlet/simple-spray-servlet-server"))
.dependsOn(sprayHttp, sprayServlet,
sprayIO) // for access to akka.io.Tcp, can go away after upgrade to Akka 2.2
.settings(jettyExampleSettings: _*)
.settings(exampleSettings: _*)
.settings(libraryDependencies ++=
compile(akkaActor) ++
runtime(akkaSlf4j, logback) ++
container(jettyWebApp, servlet30)
)
}