-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.sbt
209 lines (194 loc) · 7.19 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
lazy val V = new {
val scala = "2.13.3"
val logback = "1.2.3"
val scalaLogging = "3.9.2"
val logEffect = "0.13.2"
val avro4s = "4.0.0"
val kafka = "2.5.1"
val confluent = "5.5.1"
val circe = "0.13.0"
val ciris = "1.2.1"
val refined = "0.9.17"
val newtype = "0.4.4"
val cats = "2.2.0"
val catsEffect = "2.2.0"
val catsRetry = "1.1.1"
val zio = "1.0.1"
val zioLogging = "0.5.2"
val zioConfig = "1.0.0-RC27"
// compatibility issues
val cakeSolutions = new {
val version = "2.0.0"
val kafka = "2.0.0"
val confluent = "5.0.0"
}
val scalaTest = "3.1.0"
val embeddedKafka = "5.5.1"
}
lazy val common = project
.in(file("common"))
.settings(
javacOptions ++= Seq("-source", "11"),
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % V.logback,
"com.typesafe.scala-logging" %% "scala-logging" % V.scalaLogging,
"org.scalatest" %% "scalatest" % V.scalaTest % Test
)
)
lazy val avro = project
.in(file("avro"))
// test dependencies are excluded by default otherwise
.dependsOn(common % "compile->compile;test->test")
.enablePlugins(SbtAvro)
.disablePlugins(SbtAvrohugger)
.settings(
libraryDependencies ++= Seq(
"com.sksamuel.avro4s" %% "avro4s-core" % V.avro4s
)
)
lazy val kafka = project
.in(file("kafka"))
.dependsOn(common % "compile->compile;test->test")
.settings(
resolvers ++= Seq(
Resolver.bintrayRepo("cakesolutions", "maven")
),
libraryDependencies ++= Seq(
"net.cakesolutions" %% "scala-kafka-client" % V.cakeSolutions.version,
"net.cakesolutions" %% "scala-kafka-client-testkit" % V.cakeSolutions.version % Test
)
)
lazy val `schema-registry` = project
.in(file("schema-registry"))
.dependsOn(common % "compile->compile;test->test")
.enablePlugins(SbtAvrohugger)
// avoid issue XXX is already defined as class XXX
.disablePlugins(SbtAvro)
.settings(
resolvers ++= Seq(
"confluent" at "https://packages.confluent.io/maven/",
Resolver.bintrayRepo("cakesolutions", "maven")
),
libraryDependencies ++= Seq(
"org.apache.kafka" % "kafka-clients" % V.cakeSolutions.kafka,
"io.confluent" % "kafka-avro-serializer" % V.cakeSolutions.confluent,
"io.confluent" % "kafka-schema-registry-client" % V.cakeSolutions.confluent,
"net.cakesolutions" %% "scala-kafka-client" % V.cakeSolutions.version,
"net.cakesolutions" %% "scala-kafka-client-testkit" % V.cakeSolutions.version % Test
),
// sbt-avrohugger: SpecificRecord
sourceGenerators in Compile += (avroScalaGenerateSpecific in Compile).taskValue
)
lazy val streams = project
.in(file("streams"))
.dependsOn(common % "compile->compile;test->test")
.settings(
libraryDependencies ++= Seq(
"org.apache.kafka" % "kafka-streams" % V.kafka,
"org.apache.kafka" %% "kafka-streams-scala" % V.kafka,
"org.apache.kafka" % "kafka-streams-test-utils" % V.kafka % Test
)
)
lazy val `streams-json-avro` = project
.in(file("streams-json-avro"))
.dependsOn(common % "compile->compile;test->test")
.settings(
resolvers ++= Seq(
"confluent" at "https://packages.confluent.io/maven/",
"jitpack.io" at "https://jitpack.io"
),
libraryDependencies ++= Seq(
"org.apache.kafka" %% "kafka-streams-scala" % V.kafka,
"io.confluent" % "kafka-streams-avro-serde" % V.confluent,
"io.circe" %% "circe-core" % V.circe,
"io.circe" %% "circe-generic" % V.circe,
"io.circe" %% "circe-parser" % V.circe,
"com.sksamuel.avro4s" %% "avro4s-core" % V.avro4s,
"io.github.embeddedkafka" %% "embedded-kafka-schema-registry-streams" % V.embeddedKafka % Test
)
)
lazy val `cats-kafka-streams` = project
.in(file("cats-kafka-streams"))
.dependsOn(common % "compile->compile;test->test")
.settings(
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-deprecation",
"-unchecked",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-Xlint",
"-Xfatal-warnings",
"-Ypartial-unification",
"-language:postfixOps"
),
// required by newtype: on 2.13.x use "-Ymacro-annotations"
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full),
resolvers ++= Seq(
"confluent" at "https://packages.confluent.io/maven/"
),
libraryDependencies ++= Seq(
"io.laserdisc" %% "log-effect-fs2" % V.logEffect,
"org.typelevel" %% "cats-core" % V.cats,
"org.typelevel" %% "cats-effect" % V.catsEffect,
"com.github.cb372" %% "cats-retry" % V.catsRetry,
"is.cir" %% "ciris" % V.ciris,
"is.cir" %% "ciris-refined" % V.ciris,
"eu.timepit" %% "refined" % V.refined,
"io.estatico" %% "newtype" % V.newtype,
"org.apache.kafka" %% "kafka-streams-scala" % V.kafka,
"io.confluent" % "kafka-streams-avro-serde" % V.confluent,
"com.sksamuel.avro4s" %% "avro4s-core" % V.avro4s
)
)
lazy val `zio-kafka-streams` = project
.in(file("zio-kafka-streams"))
.dependsOn(common % "compile->compile;test->test")
.settings(
resolvers ++= Seq(
"confluent" at "https://packages.confluent.io/maven/"
),
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % V.zio,
"dev.zio" %% "zio-logging" % V.zioLogging,
"dev.zio" %% "zio-config" % V.zioConfig,
"dev.zio" %% "zio-config-refined" % V.zioConfig,
"org.apache.kafka" %% "kafka-streams-scala" % V.kafka,
"io.confluent" % "kafka-streams-avro-serde" % V.confluent,
"com.sksamuel.avro4s" %% "avro4s-core" % V.avro4s
)
)
lazy val `interactive-queries` = project
.in(file("interactive-queries"))
.dependsOn(common % "compile->compile;test->test")
.settings(
libraryDependencies ++= Seq(
"org.apache.kafka" % "kafka-streams" % V.kafka,
"org.apache.kafka" %% "kafka-streams-scala" % V.kafka,
"org.apache.kafka" % "kafka-streams-test-utils" % V.kafka % Test
)
)
lazy val root = project
.in(file("."))
.aggregate(
avro,
kafka,
`schema-registry`,
streams,
`streams-json-avro`,
`cats-kafka-streams`,
`zio-kafka-streams`
)
.settings(
organization := "com.kafka.demo",
name := "kafka-scala-examples",
scalaVersion := V.scala,
version := "0.1",
parallelExecution := false,
addCommandAlias("checkFormat", ";scalafmtCheckAll;scalafmtSbtCheck"),
addCommandAlias("format", ";scalafmtAll;scalafmtSbt"),
addCommandAlias("build", ";checkFormat;clean;test")
)