This repository has been archived by the owner on May 9, 2023. It is now read-only.
forked from zio/zio-kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
162 lines (148 loc) · 5.69 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
import sbt.Def
lazy val kafkaVersion = "3.4.0"
lazy val embeddedKafkaVersion = "3.4.0" // Should be the same as kafkaVersion, except for the patch part
lazy val kafkaClients = "org.apache.kafka" % "kafka-clients" % kafkaVersion
lazy val scalaCollectionCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.9.0"
lazy val jacksonDatabind = "com.fasterxml.jackson.core" % "jackson-databind" % "2.14.2"
lazy val logback = "ch.qos.logback" % "logback-classic" % "1.3.6"
enablePlugins(ZioSbtEcosystemPlugin, ZioSbtCiPlugin)
inThisBuild(
List(
name := "ZIO Kafka",
crossScalaVersions -= scala211.value,
ciEnabledBranches := Seq("master", "series/0.x"),
useCoursier := false,
Test / parallelExecution := false,
Test / fork := true,
run / fork := true,
supportedScalaVersions := Map(
(zioKafka / thisProject).value.id -> (zioKafka / crossScalaVersions).value,
(zioKafkaBench / thisProject).value.id -> (zioKafkaBench / crossScalaVersions).value,
(zioKafkaTest / thisProject).value.id -> (zioKafkaTest / crossScalaVersions).value,
(zioKafkaTestUtils / thisProject).value.id -> (zioKafkaTestUtils / crossScalaVersions).value
),
developers := List(
Developer(
"iravid",
"Itamar Ravid",
url("https://github.com/iravid")
)
)
) ++ ConduktorSettings.conduktorSettings
)
val excludeInferAny = { options: Seq[String] => options.filterNot(Set("-Xlint:infer-any")) }
lazy val root = project
.in(file("."))
.settings(
name := "zio-kafka",
publish / skip := true,
crossScalaVersions := Nil // https://www.scala-sbt.org/1.x/docs/Cross-Build.html#Cross+building+a+project+statefully
)
.aggregate(
zioKafka,
zioKafkaTestUtils,
zioKafkaTest,
zioKafkaBench,
docs
)
def stdSettings(prjName: String) = Seq(
name := s"$prjName",
scalafmtOnCompile := !insideCI.value,
Compile / compile / scalacOptions ++=
optionsOn("2.13")("-Wconf:cat=unused-nowarn:s").value,
scalacOptions -= "-Xlint:infer-any",
// workaround for bad constant pool issue
(Compile / doc) := Def.taskDyn {
val default = (Compile / doc).taskValue
Def.task(default.value)
}.value,
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"))
case _ => List.empty
}
}
) ++ scalafixSettings
lazy val zioKafka =
project
.in(file("zio-kafka"))
.enablePlugins(BuildInfoPlugin)
.settings(stdSettings("zio-kafka"))
.settings(buildInfoSettings("zio.kafka"))
.settings(enableZIO(enableStreaming = true))
.settings(
libraryDependencies ++= Seq(
kafkaClients,
jacksonDatabind,
scalaCollectionCompat
)
)
lazy val `embedded-kafka`: Def.Initialize[Seq[sbt.ModuleID]] = {
val embeddedKafka = "io.github.embeddedkafka" %% "embedded-kafka" % embeddedKafkaVersion
dependenciesOnOrElse("3")(
embeddedKafka
.cross(CrossVersion.for3Use2_13) exclude ("org.scala-lang.modules", "scala-collection-compat_2.13")
)(embeddedKafka)
}
lazy val zioKafkaTestUtils =
project
.in(file("zio-kafka-test-utils"))
.dependsOn(zioKafka)
.enablePlugins(BuildInfoPlugin)
.settings(stdSettings("zio-kafka-test-utils"))
.settings(buildInfoSettings("zio.kafka"))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion.value,
"dev.zio" %% "zio-test" % zioVersion.value,
kafkaClients,
scalaCollectionCompat
) ++ `embedded-kafka`.value
)
lazy val zioKafkaTest =
project
.in(file("zio-kafka-test"))
.dependsOn(zioKafka, zioKafkaTestUtils)
.enablePlugins(BuildInfoPlugin)
.settings(stdSettings("zio-kafka-test"))
.settings(buildInfoSettings("zio.kafka"))
.settings(enableZIO(enableStreaming = true))
.settings(publish / skip := true)
.settings(
libraryDependencies ++= Seq(
kafkaClients,
jacksonDatabind,
logback % Test,
scalaCollectionCompat
) ++ `embedded-kafka`.value
)
lazy val zioKafkaBench =
project
.in(file("zio-kafka-bench"))
.enablePlugins(JmhPlugin)
.settings(stdSettings("zio-kafka-bench"))
.settings(publish / skip := true)
.settings(libraryDependencies += logback)
.dependsOn(zioKafka, zioKafkaTestUtils)
addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck")
lazy val docs = project
.in(file("zio-kafka-docs"))
.settings(
moduleName := "zio-kafka-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
projectName := "ZIO Kafka",
mainModuleName := (zioKafka / moduleName).value,
projectStage := ProjectStage.ProductionReady,
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(zioKafka),
readmeCredits :=
"This library is heavily inspired and made possible by the research and implementation done in " +
"[Alpakka Kafka](https://github.com/akka/alpakka-kafka), a library maintained by the Akka team and originally " +
"written as Reactive Kafka by SoftwareMill.",
readmeLicense +=
"\n\n" + """|Copyright 2021 Itamar Ravid and the zio-kafka contributors. All rights reserved.
|<!-- TODO: not all rights reserved, rather Apache 2... -->""".stripMargin
)
.enablePlugins(WebsitePlugin)