forked from finagle/finch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
296 lines (272 loc) · 8.83 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
291
292
293
294
295
296
import sbtunidoc.Plugin.UnidocKeys._
lazy val buildSettings = Seq(
organization := "com.github.finagle",
version := "0.12.0-SNAPSHOT",
scalaVersion := "2.11.8"
)
lazy val finagleVersion = "6.40.0"
lazy val utilVersion = "6.39.0"
lazy val twitterServerVersion = "1.25.0"
lazy val finagleOAuth2Version = "0.2.0"
lazy val circeVersion = "0.6.1"
lazy val circeJacksonVersion = "0.6.2"
lazy val catbirdVersion = "0.9.0"
lazy val shapelessVersion = "2.3.2"
lazy val catsVersion = "0.8.1"
lazy val sprayVersion = "1.3.2"
lazy val playVersion = "2.3.10"
lazy val jacksonVersion = "2.8.5"
lazy val compilerOptions = Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Xfuture",
"-Xlint"
)
val testDependencies = Seq(
"org.scalacheck" %% "scalacheck" % "1.13.3",
"org.scalatest" %% "scalatest" % "3.0.0",
"org.typelevel" %% "cats-laws" % catsVersion,
"org.typelevel" %% "discipline" % "0.7.2"
)
val baseSettings = Seq(
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % shapelessVersion,
"org.typelevel" %% "cats-core" % catsVersion,
"com.twitter" %% "finagle-http" % finagleVersion,
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"io.catbird" %% "catbird-util" % catbirdVersion
) ++ testDependencies.map(_ % "test"),
resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
),
scalacOptions ++= compilerOptions ++ Seq("-Ywarn-unused-import"),
scalacOptions in (Compile, console) ~= (_ filterNot (_ == "-Ywarn-unused-import")),
scalacOptions in (Compile, console) += "-Yrepl-class-based"
)
lazy val publishSettings = Seq(
publishMavenStyle := true,
publishArtifact := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
publishArtifact in Test := false,
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
homepage := Some(url("https://github.com/finagle/finch")),
autoAPIMappings := true,
apiURL := Some(url("https://finagle.github.io/finch/docs/")),
scmInfo := Some(
ScmInfo(
url("https://github.com/finagle/finch"),
"scm:git:[email protected]:finagle/finch.git"
)
),
pomExtra :=
<developers>
<developer>
<id>vkostyukov</id>
<name>Vladimir Kostyukov</name>
<url>http://vkostyukov.net</url>
</developer>
<developer>
<id>travisbrown</id>
<name>Travis Brown</name>
<url>https://meta.plasm.us/</url>
</developer>
</developers>
)
lazy val noPublish = Seq(
publish := {},
publishLocal := {},
publishArtifact := false
)
lazy val allSettings = baseSettings ++ buildSettings ++ publishSettings
lazy val docSettings = site.settings ++ ghpages.settings ++ unidocSettings ++ Seq(
site.addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), "docs"),
git.remoteRepo := s"[email protected]:finagle/finch.git",
unidocProjectFilter in (ScalaUnidoc, unidoc) := inAnyProject -- inProjects(benchmarks, jsonTest)
)
lazy val finch = project.in(file("."))
.settings(moduleName := "finch")
.settings(allSettings)
.settings(docSettings)
.settings(noPublish)
.settings(
initialCommands in console :=
"""
|import io.finch._
|import io.finch.circe._
|import io.finch.items._
|import com.twitter.util.{Future, Await}
|import com.twitter.concurrent.AsyncStream
|import com.twitter.io.{Buf, Reader}
|import com.twitter.finagle.Service
|import com.twitter.finagle.Http
|import com.twitter.finagle.http.{Request, Response, Status, Version}
|import io.circe._
|import io.circe.generic.auto._
|import shapeless._
""".stripMargin
)
.settings(libraryDependencies ++= Seq(
"io.circe" %% "circe-generic" % circeVersion,
"io.spray" %% "spray-json" % sprayVersion
))
.aggregate(
core, argonaut, jackson, json4s, circe, playjson, sprayjson, benchmarks, test, jsonTest, oauth2,
examples, sse
)
.dependsOn(core, circe)
lazy val core = project
.settings(moduleName := "finch-core")
.settings(allSettings)
lazy val test = project
.settings(moduleName := "finch-test")
.settings(allSettings)
.settings(coverageExcludedPackages := "io\\.finch\\.test\\..*")
.settings(libraryDependencies ++= testDependencies)
.dependsOn(core)
lazy val jsonTest = project.in(file("json-test"))
.settings(moduleName := "finch-json-test")
.settings(allSettings)
.settings(noPublish)
.settings(coverageExcludedPackages := "io\\.finch\\.test\\..*")
.settings(
libraryDependencies ++= "io.argonaut" %% "argonaut" % "6.1" +: testDependencies
)
.dependsOn(core)
lazy val argonaut = project
.settings(moduleName := "finch-argonaut")
.settings(allSettings)
.settings(libraryDependencies ++= Seq(
"io.argonaut" %% "argonaut" % "6.1",
"org.spire-math" %% "jawn-parser" % "0.8.4",
"org.spire-math" %% "jawn-argonaut" % "0.8.4"
))
.dependsOn(core, jsonTest % "test")
lazy val jackson = project
.settings(moduleName := "finch-jackson")
.settings(allSettings)
.settings(libraryDependencies ++= Seq(
"com.fasterxml.jackson.core" % "jackson-core" % jacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion
))
.dependsOn(core, jsonTest % "test")
lazy val json4s = project
.settings(moduleName := "finch-json4s")
.settings(allSettings)
.settings(libraryDependencies ++= Seq(
"org.json4s" %% "json4s-jackson" % "3.2.11",
"org.json4s" %% "json4s-ext" % "3.2.11"
))
.dependsOn(core, jsonTest % "test")
lazy val circe = project
.settings(moduleName := "finch-circe")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-jawn" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion % "test",
"io.circe" %% "circe-jackson28" % circeJacksonVersion
)
)
.dependsOn(core, jsonTest % "test")
lazy val playjson = project
.settings(moduleName :="finch-playjson")
.settings(allSettings)
.settings(libraryDependencies += "com.typesafe.play" %% "play-json" % playVersion)
.dependsOn(core, jsonTest % "test")
lazy val sprayjson = project
.settings(moduleName := "finch-sprayjson")
.settings(allSettings)
.settings(libraryDependencies += "io.spray" %% "spray-json" % sprayVersion)
.dependsOn(core, jsonTest % "test")
lazy val oauth2 = project
.settings(moduleName := "finch-oauth2")
.settings(allSettings)
.settings(libraryDependencies ++= Seq(
"com.github.finagle" %% "finagle-oauth2" % finagleOAuth2Version,
"org.mockito" % "mockito-all" % "1.10.19" % "test"
))
.dependsOn(core)
lazy val sse = project
.settings(moduleName := "finch-sse")
.settings(allSettings)
.dependsOn(core)
lazy val examples = project
.settings(moduleName := "finch-examples")
.settings(allSettings)
.settings(noPublish)
.settings(resolvers += "TM" at "http://maven.twttr.com")
.settings(coverageExcludedPackages :=
"""
|io\.finch\.div\..*;
|io\.finch\.todo\..*;
|io\.finch\.eval\..*;
|io\.finch\.streaming\..*;
|io\.finch\.oauth2\..*;
|io\.finch\.wrk\..*;
|io\.finch\.sse\..*;
""".stripMargin)
.settings(
libraryDependencies ++= Seq(
"io.circe" %% "circe-generic" % circeVersion,
"com.twitter" %% "twitter-server" % twitterServerVersion,
"com.twitter" %% "util-eval" % utilVersion,
"com.github.finagle" %% "finagle-oauth2" % finagleOAuth2Version
)
)
.dependsOn(core, circe, jackson, oauth2)
lazy val benchmarks = project
.settings(moduleName := "finch-benchmarks")
.enablePlugins(JmhPlugin)
.settings(allSettings)
.settings(noPublish)
.settings(libraryDependencies += "io.circe" %% "circe-generic" % circeVersion)
.settings(coverageExcludedPackages := "io\\.finch\\..*;")
.settings(
javaOptions in run ++= Seq(
"-Djava.net.preferIPv4Stack=true",
"-XX:+AggressiveOpts",
"-XX:+UseParNewGC",
"-XX:+UseConcMarkSweepGC",
"-XX:+CMSParallelRemarkEnabled",
"-XX:+CMSClassUnloadingEnabled",
"-XX:ReservedCodeCacheSize=128m",
"-XX:MaxPermSize=1024m",
"-Xss8M",
"-Xms512M",
"-XX:SurvivorRatio=128",
"-XX:MaxTenuringThreshold=0",
"-Xss8M",
"-Xms512M",
"-Xmx2G",
"-server"
)
)
.dependsOn(core, circe, jackson)
val validateCommands = List(
"clean",
"scalastyle",
"test:scalastyle",
"compile",
"test:compile",
"coverage",
"test",
"coverageReport",
"coverageAggregate"
)
addCommandAlias("validate", validateCommands.mkString(";", ";", ""))