-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.sbt
237 lines (223 loc) · 7.61 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
import laika.helium.Helium
import laika.helium.config.HeliumIcon
import laika.helium.config.IconLink
import org.typelevel.sbt.site.GenericSiteSettings
ThisBuild / scalaVersion := "2.13.15"
ThisBuild / crossScalaVersions := List(scalaVersion.value)
ThisBuild / tlBaseVersion := "6.0"
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
ThisBuild / githubWorkflowTargetBranches := Seq("*", "series/*")
ThisBuild / githubWorkflowBuildPreamble := Seq(
WorkflowStep.Run(
id = Some("start-docker-compose"),
name = Some("Start docker-compose"),
commands = List("docker compose up -d"),
)
)
ThisBuild / sonatypeCredentialHost := xerial.sbt.Sonatype.sonatypeLegacy
Global / onChangedBuildSource := ReloadOnSourceChanges
val V = new {
val avro = "1.12.0"
val avro4s = "3.1.0"
val betterMonadicFor = "0.3.1"
val cats = "2.12.0"
val catsEffect = "3.4.10"
val commonsCompress = "1.27.1"
val confluent = "7.7.1"
val curator = "5.2.0"
val disciplineMunit = "2.0.0"
val epimetheus = "0.5.0"
val fs2 = "3.11.0"
val guava = "32.1.3-jre"
val junit = "4.13"
val kafka = s"$confluent-ccs"
val kindProjector = "0.13.3"
val log4cats = "2.7.0"
val logback = "1.5.12"
val natchez = "0.3.7"
val scalacheck = "1.18.1"
val scalacheckEffect = "1.0.4"
val scalacheckMagnolia = "0.6.0"
val munit = "1.0.2"
val munitScalacheck = "1.0.0"
val munitCE3 = "2.0.0"
val scalatest = "3.2.19"
val scalatestPlus = "3.2.3.0"
val snappy = "1.1.10.7"
val vulcan = "1.11.1"
}
lazy val kafka4s = project
.in(file("."))
.enablePlugins(NoPublishPlugin)
.aggregate(core, avro4s, vulcan, examples, site)
lazy val core = project
.in(file("core"))
.settings(commonSettings)
.settings(
name := "kafka4s",
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
Seq(
)
},
)
.settings(
scalacOptions += "-Wnonunit-statement",
testFrameworks += new TestFramework("munit.Framework"),
libraryDependencies ++= Seq(
"org.apache.curator" % "curator-test" % V.curator % Test,
("org.apache.kafka" %% "kafka" % V.kafka % Test).classifier("test"),
("org.apache.kafka" % "kafka-clients" % V.kafka % Test)
.classifier("test"),
("org.apache.kafka" % "kafka-streams" % V.kafka % Test)
.classifier("test"),
("org.apache.kafka" % "kafka-streams-test-utils" % V.kafka % Test),
"ch.qos.logback" % "logback-classic" % V.logback % Test,
"org.scalacheck" %% "scalacheck" % V.scalacheck % Test,
"org.scalameta" %% "munit" % V.munit % Test,
"org.scalameta" %% "munit-scalacheck" % V.munitScalacheck % Test,
"org.typelevel" %% "scalacheck-effect-munit" % V.scalacheckEffect,
"org.typelevel" %% "munit-cats-effect" % V.munitCE3 % Test,
"org.typelevel" %% "cats-effect" % V.catsEffect,
"org.tpolecat" %% "natchez-core" % V.natchez,
"org.typelevel" %% "cats-laws" % V.cats % Test,
"org.scalatest" %% "scalatest" % V.scalatest % Test,
"org.typelevel" %% "discipline-munit" % V.disciplineMunit % Test,
),
)
lazy val avro4s = project
.in(file("avro4s"))
.settings(commonSettings)
.settings(
name := "kafka4s-avro4s",
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
Seq()
},
libraryDependencies ++= Seq(
"com.sksamuel.avro4s" %% "avro4s-core" % V.avro4s,
"com.github.chocpanda" %% "scalacheck-magnolia" % V.scalacheckMagnolia % Test,
"org.scalatest" %% "scalatest" % V.scalatest % Test,
"org.scalatestplus" %% "scalacheck-1-16" % "3.2.14.0" % Test,
),
)
.settings(
scalacOptions += "-Wnonunit-statement",
testFrameworks += new TestFramework("munit.Framework"),
)
.dependsOn(core % "compile->compile;test->test")
lazy val vulcan = project
.in(file("vulcan"))
.settings(commonSettings)
.settings(
name := "kafka4s-vulcan",
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
Seq()
},
libraryDependencies ++= Seq(
"com.github.fd4s" %% "vulcan" % V.vulcan
),
)
.settings(
scalacOptions += "-Wnonunit-statement",
testFrameworks += new TestFramework("munit.Framework"),
)
.dependsOn(core)
lazy val examples = project
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % V.logback % Runtime
),
fork := true,
)
.disablePlugins(MimaPlugin)
.dependsOn(core, avro4s)
lazy val site = project
.in(file("site"))
.settings(publish / skip := true)
.enablePlugins(TypelevelSitePlugin)
.enablePlugins(TypelevelUnidocPlugin)
.dependsOn(core, avro4s)
.settings {
Seq(
mdocIn := baseDirectory.value / "docs",
tlSiteHelium := {
GenericSiteSettings.defaults.value.site
.metadata(
title = Some("kafka4s"),
description = Some("Functional programming with Kafka and Scala"),
authors = List("Jack Henry & Associates, Inc.®"),
)
.site
.topNavigationBar(
homeLink = IconLink
.external("https://banno.github.io/kafka4s", HeliumIcon.home)
)
},
)
}
lazy val commonSettings = Seq(
resolvers += "confluent".at("https://packages.confluent.io/maven/"),
addCompilerPlugin(
("org.typelevel" %% "kind-projector" % V.kindProjector)
.cross(CrossVersion.full)
),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % V.betterMonadicFor),
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % V.fs2,
"org.apache.kafka" % "kafka-clients" % V.kafka,
"org.xerial.snappy" % "snappy-java" % V.snappy, // multiple CVE, doesn't work as Runtime
"io.confluent" % "kafka-avro-serializer" % V.confluent,
"org.apache.avro" % "avro" % V.avro, // CVE-2023-39410, didn't work as Runtime
"org.apache.commons" % "commons-compress" % V.commonsCompress, // CVE-2023-42503, didn't work as Runtime
"io.chrisdavenport" %% "epimetheus" % V.epimetheus,
"org.typelevel" %% "log4cats-slf4j" % V.log4cats,
// Upgrade vulnerable guava-30.1.1-jre from confluent-7.4.1. This
// should be a Runtime dependency, but it isn't shadowing right
// unless it's Compile.
"com.google.guava" % "guava" % V.guava,
),
Test / sourceGenerators += (Test / avroScalaGenerate).taskValue,
watchSources ++= ((Test / avroSourceDirectories).value ** "*.avdl").get,
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oS"),
// Autogenerated source sometimes has unused warnings. Works for Scala 2 only!
Compile / scalacOptions += "-Wconf:src=target/.*:silent",
)
lazy val contributors = Seq(
"amohrland" -> "Andrew Mohrland",
"zcox" -> "Zach Cox",
"kazark" -> "Keith Pinson",
)
inThisBuild(
List(
organization := "com.banno",
developers := {
for {
(username, name) <- contributors
} yield {
Developer(username, name, "", url(s"http://github.com/$username"))
},
}.toList,
scalacOptions ++= Seq(
"-Xsource:3",
"-Vimplicits",
"-Vtype-diffs",
"-language:postfixOps",
"-Xlog-free-terms",
"-Xlog-free-types",
),
organizationName := "Jack Henry & Associates, Inc.®",
startYear := Some(2019),
licenses := Seq(License.Apache2),
homepage := Some(url("https://github.com/banno/kafka4s")),
)
)
addCommandAlias("fmt", "scalafmtSbt;scalafmtAll;")
addCommandAlias("fmtck", "scalafmtSbtCheck;scalafmtCheckAll;")
addCommandAlias("build", "Test / compile")