forked from Philippus/elastic4s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
364 lines (326 loc) · 12.5 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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
val isTravis = settingKey[Boolean]("Flag indicating whether the current build is running under Travis")
isTravis in Global := sys.env.get("TRAVIS").isDefined
val travisBuildNumber = settingKey[String]("Value of the travis build number")
travisBuildNumber in Global := sys.env.getOrElse("TRAVIS_BUILD_NUMBER", "0")
val org = "com.sksamuel.elastic4s"
val AkkaVersion = "2.6.1"
val AkkaHttpVersion = "10.1.11"
val CatsVersion = "2.0.0"
val CirceVersion = "0.12.3"
val CatsEffectVersion = "2.0.0"
val CommonsIoVersion = "2.6"
val ElasticsearchVersion = "7.3.2"
val ExtsVersion = "1.61.1"
val JacksonVersion = "2.10.2"
val Json4sVersion = "3.6.7"
val AWSJavaSdkVersion = "2.7.1"
val Log4jVersion = "2.13.0"
val MockitoVersion = "3.2.4"
val MonixVersion = "3.1.0"
val PlayJsonVersion = "2.8.1"
val ReactiveStreamsVersion = "1.0.3"
val ScalatestVersion = "3.1.0"
val ScalatestPlusVersion = "3.1.0.0"
val ScalamockVersion = "4.4.0"
val ScalazVersion = "7.2.30"
val ZIOVersion = "1.0.0-RC17"
val SprayJsonVersion = "1.3.5"
val SttpVersion = "1.7.2"
val Slf4jVersion = "1.7.30"
lazy val commonScalaVersionSettings = Seq(
scalaVersion := "2.12.8",
crossScalaVersions := Seq("2.12.8", "2.13.0")
)
lazy val warnUnusedImport = Seq(
scalacOptions ++= Seq("-Ywarn-unused:imports"),
scalacOptions in(Compile, console) ~= {
_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports"))
},
scalacOptions in(Test, console) := (scalacOptions in(Compile, console)).value,
)
lazy val commonSettings = Seq(
organization := "com.sksamuel.elastic4s",
version := (if (isTravis.value) version.value + s".$travisBuildNumber-SNAPSHOT" else version.value),
resolvers ++= Seq(Resolver.mavenLocal),
parallelExecution in Test := false,
scalacOptions in(Compile, doc) := (scalacOptions in(Compile, doc)).value.filter(_ != "-Xfatal-warnings"),
scalacOptions ++= Seq("-unchecked", "-deprecation", "-encoding", "utf8")
)
lazy val publishSettings = Seq(
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := Function.const(false),
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isTravis.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
)
lazy val commonJvmSettings = Seq(
testOptions in Test += {
val flag = if ((isTravis in Global).value) "-oCI" else "-oDF"
Tests.Argument(TestFrameworks.ScalaTest, flag)
},
Test / fork := true,
Test / javaOptions := Seq("-Xmx3G"),
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
javaOptions ++= Seq("-Xms512M", "-Xmx2048M", "-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled"),
)
lazy val commonDeps = Seq(
libraryDependencies ++= Seq(
"com.sksamuel.exts" %% "exts" % ExtsVersion,
"org.slf4j" % "slf4j-api" % Slf4jVersion,
"org.scalatest" %% "scalatest" % ScalatestVersion % "test",
"org.mockito" % "mockito-core" % MockitoVersion % "test",
"org.scalatestplus" %% "mockito-1-10" % ScalatestPlusVersion % "test"
)
)
lazy val pomSettings = Seq(
homepage := Some(url("https://github.com/sksamuel/elastic4s")),
licenses := Seq("Apache 2" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
scmInfo := Some(ScmInfo(url("https://github.com/sksamuel/elastic4s"), "scm:git:[email protected]:sksamuel/elastic4s.git")),
apiURL := Some(url("http://github.com/sksamuel/elastic4s/")),
pomExtra := <developers>
<developer>
<id>sksamuel</id>
<name>Sam Samuel</name>
<url>https://github.com/sksamuel</url>
</developer>
</developers>
)
val travisCreds = Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
sys.env.getOrElse("OSSRH_USERNAME", ""),
sys.env.getOrElse("OSSRH_PASSWORD", "")
)
val localCreds = Credentials(Path.userHome / ".sbt" / "credentials.sbt")
lazy val credentialSettings = Seq(
credentials := (if (isTravis.value) Seq(travisCreds) else Seq(localCreds))
)
lazy val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false
)
lazy val allSettings = commonScalaVersionSettings ++
commonJvmSettings ++
commonSettings ++
commonDeps ++
credentialSettings ++
pomSettings ++
warnUnusedImport ++
publishSettings
lazy val root = Project("elastic4s", file("."))
.settings(name := "elastic4s")
.settings(allSettings)
.settings(noPublishSettings)
.aggregate(
core,
clientesjava,
clientsSniffed,
cats_effect,
zio,
scalaz,
monix,
tests,
testkit,
circe,
jackson,
json4s,
playjson,
sprayjson,
aws,
clientsttp,
clientakka,
httpstreams,
akkastreams
)
lazy val core = (project in file("elastic4s-core"))
.settings(name := "elastic4s-core")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"joda-time" % "joda-time" % "2.10.2",
"com.fasterxml.jackson.core" % "jackson-core" % JacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonVersion,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % JacksonVersion
)
)
lazy val clientesjava = (project in file("elastic4s-client-esjava"))
.dependsOn(core)
.settings(name := "elastic4s-client-esjava")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"org.elasticsearch.client" % "elasticsearch-rest-client" % ElasticsearchVersion,
"org.apache.logging.log4j" % "log4j-api" % Log4jVersion % "test",
"com.fasterxml.jackson.core" % "jackson-core" % JacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonVersion,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % JacksonVersion exclude("org.scala-lang", "scala-library")
)
)
lazy val clientsSniffed = (project in file("elastic4s-client-sniffed"))
.dependsOn(clientesjava)
.settings(name := "elastic4s-client-sniffed")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"org.elasticsearch.client" % "elasticsearch-rest-client-sniffer" % ElasticsearchVersion,
)
)
lazy val cats_effect = (project in file("elastic4s-effect-cats"))
.dependsOn(core)
.settings(name := "elastic4s-effect-cats")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % CatsEffectVersion
)
)
lazy val zio = (project in file("elastic4s-effect-zio"))
.dependsOn(core, testkit % "test")
.settings(name := "elastic4s-effect-zio")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % ZIOVersion
)
)
lazy val scalaz = (project in file("elastic4s-effect-scalaz"))
.dependsOn(core)
.settings(name := "elastic4s-effect-scalaz")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % ScalazVersion,
"org.scalaz" %% "scalaz-concurrent" % ScalazVersion
)
)
lazy val monix = (project in file("elastic4s-effect-monix"))
.dependsOn(core)
.settings(name := "elastic4s-effect-monix")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"io.monix" %% "monix" % MonixVersion
)
)
lazy val testkit = (project in file("elastic4s-testkit"))
.dependsOn(core, clientesjava)
.settings(name := "elastic4s-testkit")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % ScalatestVersion,
"org.scalatestplus" %% "mockito-1-10" % ScalatestPlusVersion
)
)
lazy val httpstreams = (project in file("elastic4s-http-streams"))
.dependsOn(core, testkit % "test", jackson % "test")
.settings(name := "elastic4s-http-streams")
.settings(allSettings)
.settings(
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % AkkaVersion,
libraryDependencies += "org.reactivestreams" % "reactive-streams" % ReactiveStreamsVersion,
libraryDependencies += "org.reactivestreams" % "reactive-streams-tck" % ReactiveStreamsVersion % "test",
libraryDependencies += "org.scalatestplus" %% "testng-6-7" % ScalatestPlusVersion % "test"
)
lazy val akkastreams = (project in file("elastic4s-streams-akka"))
.dependsOn(core, testkit % "test", jackson % "test")
.settings(name := "elastic4s-streams-akka")
.settings(allSettings)
.settings(
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % AkkaVersion
)
lazy val jackson = (project in file("elastic4s-json-jackson"))
.dependsOn(core)
.settings(name := "elastic4s-json-jackson")
.settings(allSettings)
.settings(
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-core" % JacksonVersion,
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % JacksonVersion,
libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala" % JacksonVersion exclude("org.scala-lang", "scala-library"),
libraryDependencies += "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % JacksonVersion
)
lazy val circe = (project in file("elastic4s-json-circe"))
.dependsOn(core)
.settings(name := "elastic4s-json-circe")
.settings(allSettings)
.settings(
libraryDependencies += "io.circe" %% "circe-core" % CirceVersion,
libraryDependencies += "io.circe" %% "circe-generic" % CirceVersion,
libraryDependencies += "io.circe" %% "circe-parser" % CirceVersion
)
lazy val json4s = (project in file("elastic4s-json-json4s"))
.dependsOn(core)
.settings(name := "elastic4s-json-json4s")
.settings(allSettings)
.settings(
libraryDependencies += "org.json4s" %% "json4s-core" % Json4sVersion,
libraryDependencies += "org.json4s" %% "json4s-jackson" % Json4sVersion
)
lazy val playjson = (project in file("elastic4s-json-play"))
.dependsOn(core)
.settings(name := "elastic4s-json-play")
.settings(allSettings)
.settings(
libraryDependencies += "com.typesafe.play" %% "play-json" % PlayJsonVersion
)
lazy val sprayjson = (project in file("elastic4s-json-spray"))
.dependsOn(core)
.settings(name := "elastic4s-json-spray")
.settings(allSettings)
.settings(
libraryDependencies += "io.spray" %% "spray-json" % SprayJsonVersion
)
lazy val clientsttp = (project in file("elastic4s-client-sttp"))
.dependsOn(core)
.settings(name := "elastic4s-client-sttp")
.settings(allSettings)
.settings(
libraryDependencies += "com.softwaremill.sttp" %% "core" % SttpVersion,
libraryDependencies += "com.softwaremill.sttp" %% "async-http-client-backend-future" % SttpVersion
)
lazy val clientakka = (project in file("elastic4s-client-akka"))
.dependsOn(core, testkit % "test")
.settings(name := "elastic4s-client-akka")
.settings(allSettings)
.settings(
libraryDependencies += "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion,
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % AkkaVersion,
libraryDependencies += "org.scalamock" %% "scalamock" % ScalamockVersion % "test"
)
lazy val aws = (project in file("elastic4s-client-aws"))
.dependsOn(core, clientesjava)
.settings(name := "elastic4s-client-aws")
.settings(allSettings)
.settings(
libraryDependencies += "software.amazon.awssdk" % "auth" % AWSJavaSdkVersion,
libraryDependencies += "software.amazon.awssdk" % "core" % AWSJavaSdkVersion,
libraryDependencies += "software.amazon.awssdk" % "regions" % AWSJavaSdkVersion
)
lazy val tests = (project in file("elastic4s-tests"))
.dependsOn(clientesjava, jackson, circe, aws, testkit % "test")
.settings(name := "elastic4s-tests")
.settings(allSettings)
.settings(noPublishSettings)
.settings(
libraryDependencies ++= Seq(
"commons-io" % "commons-io" % CommonsIoVersion % "test",
"org.mockito" % "mockito-core" % MockitoVersion % "test",
"com.fasterxml.jackson.core" % "jackson-core" % JacksonVersion % "test",
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonVersion % "test",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % JacksonVersion % "test" exclude("org.scala-lang", "scala-library"),
"org.apache.logging.log4j" % "log4j-api" % "2.12.0" % "test",
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.12.0" % "test",
"org.apache.logging.log4j" % "log4j-core" % "2.12.0" % "test"
),
fork in Test := false,
parallelExecution in Test := false,
testForkedParallel in Test := false
)