-
Notifications
You must be signed in to change notification settings - Fork 34
/
build.sbt
325 lines (283 loc) · 10.8 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
import ReleaseTransformations._
import sbtrelease.Version.Bump
lazy val buildSettings = inThisBuild(
Seq(organization := "io.aecor", crossScalaVersions := Seq("2.13.6", "2.12.15"))
)
lazy val akkaVersion = "2.5.26"
lazy val akkaPersistenceCassandraVersion = "0.62"
lazy val apacheKafkaClientsVersion = "2.3.0"
lazy val catsVersion = "2.6.1"
lazy val catsEffectVersion = "3.2.9"
lazy val logbackVersion = "1.2.3"
lazy val cassandraDriverExtrasVersion = "3.8.0"
lazy val jsr305Version = "3.0.2"
lazy val boopickleVersion = "1.3.1"
lazy val monocleVersion = "2.1.0"
lazy val fs2Version = "3.1.3"
lazy val scodecBitsVersion = "1.1.13"
lazy val scodecCoreVersion = "1.11.4"
lazy val catsTaglessVersion = "0.14.0"
lazy val scalatestPlusScalaCheckVersion = "3.1.0.0-RC2"
lazy val scalaCheckShapelessVersion = "1.2.4"
lazy val disciplineScalatestVersion = "1.0.0-RC1"
lazy val embeddedKafkaVersion = "2.3.0"
lazy val shapelessVersion = "2.3.3"
lazy val kindProjectorVersion = "0.13.2"
lazy val betterMonadicForVersion = "0.3.1"
// Example dependencies
lazy val circeVersion = "0.14.1"
lazy val http4sVersion = "0.23.4"
lazy val catsMTLVersion = "0.7.1"
lazy val commonSettings = Seq(
scalacOptions += "-Xsource:2.13",
scalacOptions ~= { opts => opts.filterNot(Set("-Xlint:nullary-override")) },
libraryDependencies ++= Seq(
compilerPlugin("org.typelevel" % "kind-projector" % kindProjectorVersion cross CrossVersion.full)
),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % betterMonadicForVersion),
parallelExecution in Test := false
)
lazy val macroSettings =
Seq(
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
// if scala 2.13+ is used, quasiquotes are merged into scala-reflect
case Some((2, scalaMajor)) if scalaMajor >= 13 => Seq()
// otherwise, quasiquotes are provided by macro paradise
case _ =>
Seq(compilerPlugin("org.scalamacros" %% "paradise" % "2.1.1" cross CrossVersion.full))
}
},
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided,
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided
)
)
lazy val aecorSettings = buildSettings ++ commonSettings ++ publishSettings
lazy val aecor = project
.in(file("."))
.withId("aecor")
.settings(moduleName := "aecor", name := "Aecor")
.settings(aecorSettings)
.settings(noPublishSettings)
.aggregate(
core,
boopickleWireProtocol,
akkaPersistence,
akkaGeneric,
distributedProcessing,
example,
schedule,
testKit,
tests,
benchmarks
)
def aecorModule(id: String, description: String): Project =
Project(id, file(s"modules/$id"))
.settings(moduleName := id, name := description)
lazy val core = aecorModule("core", "Aecor Core")
.settings(aecorSettings)
.settings(coreSettings)
lazy val boopickleWireProtocol =
aecorModule("boopickle-wire-protocol", "Aecor Boopickle Wire Protocol derivation")
.dependsOn(core)
.settings(aecorSettings)
.settings(boopickleWireProtocolSettings)
lazy val akkaPersistence = aecorModule(
"akka-persistence-runtime",
"Aecor Runtime based on Akka Cluster Sharding and Persistence"
).dependsOn(core)
.settings(aecorSettings)
.settings(commonProtobufSettings)
.settings(akkaPersistenceSettings)
lazy val akkaGeneric =
aecorModule("akka-cluster-runtime", "Aecor Runtime based on Akka Cluster Sharding")
.dependsOn(core)
.dependsOn(boopickleWireProtocol % "test->compile")
.settings(aecorSettings)
.settings(commonTestSettings)
.settings(commonProtobufSettings)
.settings(akkaGenericSettings)
lazy val distributedProcessing =
aecorModule("distributed-processing", "Aecor Distributed Processing")
.dependsOn(core)
.settings(aecorSettings)
.settings(commonProtobufSettings)
.settings(distributedProcessingSettings)
lazy val kafkaDistributedProcessing =
aecorModule(
"kafka-distributed-processing",
"Aecor Distributed Processing based on Kafka partition assignment"
).dependsOn(core)
.settings(aecorSettings)
.settings(commonTestSettings)
.settings(kafkaDistributedProcessingSettings)
lazy val schedule = aecorModule("schedule", "Aecor Schedule")
.dependsOn(akkaPersistence, distributedProcessing, boopickleWireProtocol)
.settings(aecorSettings)
.settings(commonProtobufSettings)
.settings(scheduleSettings)
lazy val testKit = aecorModule("test-kit", "Aecor Test Kit")
.dependsOn(core)
.settings(aecorSettings)
.settings(testKitSettings)
lazy val tests = aecorModule("tests", "Aecor Tests")
.dependsOn(core, schedule, testKit, akkaPersistence, distributedProcessing, boopickleWireProtocol)
.settings(aecorSettings)
.settings(noPublishSettings)
.settings(commonTestSettings)
.settings(testsSettings)
lazy val example = aecorModule("example", "Aecor Example Application")
.dependsOn(core, schedule, distributedProcessing, boopickleWireProtocol)
.settings(aecorSettings)
.settings(noPublishSettings)
.settings(exampleSettings)
lazy val benchmarks = aecorModule("benchmarks", "Aecor Benchmarks")
.dependsOn(core)
.settings(aecorSettings)
.settings(noPublishSettings)
.enablePlugins(JmhPlugin)
lazy val coreSettings = Seq(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % fs2Version,
"org.typelevel" %% "cats-tagless-core" % catsTaglessVersion,
"com.chuusai" %% "shapeless" % shapelessVersion,
"org.typelevel" %% "cats-core" % catsVersion,
"org.typelevel" %% "cats-effect" % catsEffectVersion,
"org.scodec" %% "scodec-bits" % scodecBitsVersion,
"org.scodec" %% "scodec-core" % scodecCoreVersion
)
)
lazy val boopickleWireProtocolSettings =
macroSettings ++ Seq(libraryDependencies ++= Seq("io.suzaku" %% "boopickle" % boopickleVersion))
lazy val scheduleSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"com.datastax.cassandra" % "cassandra-driver-extras" % cassandraDriverExtrasVersion,
"com.google.code.findbugs" % "jsr305" % jsr305Version % Compile
)
)
lazy val distributedProcessingSettings = Seq(
libraryDependencies ++= Seq("com.typesafe.akka" %% "akka-cluster-sharding" % akkaVersion)
)
lazy val kafkaDistributedProcessingSettings = Seq(
libraryDependencies ++= Seq(
"org.apache.kafka" % "kafka-clients" % apacheKafkaClientsVersion,
"co.fs2" %% "fs2-core" % fs2Version,
"co.fs2" %% "fs2-reactive-streams" % fs2Version,
"io.github.embeddedkafka" %% "embedded-kafka" % embeddedKafkaVersion % Test
)
)
lazy val akkaPersistenceSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"com.typesafe.akka" %% "akka-cluster-sharding" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence-query" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence-cassandra" % akkaPersistenceCassandraVersion
)
)
lazy val akkaGenericSettings = Seq(
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-cluster-sharding" % akkaVersion,
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion % Test,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-persistence-cassandra-launcher" % akkaPersistenceCassandraVersion % Test
)
)
lazy val exampleSettings = Seq(
libraryDependencies ++=
Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"co.fs2" %% "fs2-reactive-streams" % fs2Version,
"org.typelevel" %% "cats-mtl-core" % catsMTLVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"org.http4s" %% "http4s-dsl" % http4sVersion,
"org.http4s" %% "http4s-blaze-server" % http4sVersion,
"org.http4s" %% "http4s-circe" % http4sVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"ch.qos.logback" % "logback-classic" % logbackVersion
)
)
lazy val testKitSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-mtl-core" % catsMTLVersion,
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
"com.github.julien-truffaut" %% "monocle-macro" % monocleVersion
)
)
lazy val testsSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-persistence-cassandra-launcher" % akkaPersistenceCassandraVersion % Test
)
)
lazy val commonTestSettings = Seq(
libraryDependencies ++= Seq(
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % scalaCheckShapelessVersion % Test,
"org.scalatestplus" %% "scalatestplus-scalacheck" % scalatestPlusScalaCheckVersion % Test,
"org.typelevel" %% "discipline-scalatest" % disciplineScalatestVersion % Test,
"org.typelevel" %% "cats-laws" % catsVersion % Test
)
)
lazy val commonProtobufSettings = Seq(
PB.targets in Compile := Seq(scalapb.gen(flatPackage = true) -> (sourceManaged in Compile).value)
)
lazy val noPublishSettings = Seq(publish := (()), publishLocal := (()), publishArtifact := false)
lazy val publishSettings = Seq(
releaseCrossBuild := true,
releaseVersionBump := Bump.Minor,
releaseCommitMessage := s"Set version to ${if (releaseUseGlobalVersion.value) (version in ThisBuild).value
else version.value}",
releaseIgnoreUntrackedFiles := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
homepage := Some(url("https://github.com/notxcain/aecor")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ =>
false
},
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")
},
autoAPIMappings := true,
scmInfo := Some(
ScmInfo(url("https://github.com/notxcain/aecor"), "scm:git:[email protected]:notxcain/aecor.git")
),
pomExtra :=
<developers>
<developer>
<id>notxcain</id>
<name>Denis Mikhaylov</name>
<url>https://github.com/notxcain</url>
</developer>
</developers>
)
lazy val sharedReleaseProcess = Seq(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion,
ReleaseStep(action = "sonatypeReleaseAll" :: _),
pushChanges
)
)
addCommandAlias("validate", ";compile;test")