forked from zio/zio-kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
117 lines (109 loc) · 4.48 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
import sbt.Keys.{ fork, parallelExecution }
lazy val scala211 = "2.11.12"
lazy val scala212 = "2.12.11"
lazy val scala213 = "2.13.3"
lazy val scala3 = "3.0.0"
lazy val mainScala = scala213
lazy val allScala = Seq(scala211, scala212, scala3, mainScala)
lazy val zioVersion = "1.0.8"
lazy val kafkaVersion = "2.6.0"
// Allows to silence scalac compilation warnings selectively by code block or file path
// This is only compile time dependency, therefore it does not affect the generated bytecode
// https://github.com/ghik/silencer
lazy val silencer = {
val Version = "1.7.0"
Seq(
compilerPlugin("com.github.ghik" % "silencer-plugin" % Version cross CrossVersion.full),
"com.github.ghik" % "silencer-lib" % Version % Provided cross CrossVersion.full
)
}
lazy val kindProjector = Seq(
compilerPlugin("org.typelevel" % "kind-projector" % "0.11.3" cross CrossVersion.full)
)
lazy val embeddedKafka = "io.github.embeddedkafka" %% "embedded-kafka" % kafkaVersion % "test"
inThisBuild(
List(
organization := "dev.zio",
homepage := Some(url("https://github.com/zio/zio-kafka")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
useCoursier := false,
scalaVersion := mainScala,
crossScalaVersions := allScala,
Test / parallelExecution := false,
Test / fork := true,
run / fork := true,
pgpPublicRing := file("/tmp/public.asc"),
pgpSecretRing := file("/tmp/secret.asc"),
pgpPassphrase := sys.env.get("PGP_PASSWORD").map(_.toArray),
scmInfo := Some(
ScmInfo(url("https://github.com/zio/zio-kafka/"), "scm:git:[email protected]:zio/zio-kafka.git")
),
developers := List(
Developer(
"iravid",
"Itamar Ravid",
url("https://github.com/iravid")
)
)
)
)
lazy val kafka =
project
.in(file("."))
.enablePlugins(BuildInfoPlugin)
.settings(
name := "zio-kafka",
scalafmtOnCompile := true,
Compile / compile / scalacOptions ++= {
if (scalaBinaryVersion.value == "2.13") Seq("-P:silencer:globalFilters=[import scala.collection.compat._]")
else if (scalaBinaryVersion.value == "2.11") Seq("-Xmax-classfile-name", "242")
else if (scalaBinaryVersion.value == "3") Seq("-Ykind-projector")
else Seq.empty
},
// workaround for bad constant pool issue
(Compile / doc) := Def.taskDyn {
val default = (Compile / doc).taskValue
if (scalaBinaryVersion.value == "2.11") {
(Compile / doc / target).toTask
} else {
Def.task(default.value)
}
}.value,
Compile / doc / scalacOptions ++= {
if (scalaBinaryVersion.value == "2.13") Seq("-P:silencer:globalFilters=[import scala.collection.compat._]")
else Seq.empty
}
)
.settings(
buildInfoKeys := Seq[BuildInfoKey](organization, name, version, scalaVersion, sbtVersion, isSnapshot),
buildInfoPackage := "zio.kafka"
)
.settings(
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
libraryDependencies ++= Seq(
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion % "test",
"dev.zio" %% "zio-test-sbt" % zioVersion % "test",
"org.apache.kafka" % "kafka-clients" % kafkaVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % "2.12.3",
"ch.qos.logback" % "logback-classic" % "1.2.3" % "test",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.4.4"
) ++ {
if (scalaBinaryVersion.value == "2.13") silencer
else if (scalaBinaryVersion.value == "2.12") silencer
else Seq.empty
} ++ {
if (scalaBinaryVersion.value == "2.11") Seq.empty
else if (scalaBinaryVersion.value == "3") Seq(embeddedKafka.cross(CrossVersion.for3Use2_13))
else Seq(embeddedKafka)
} ++ {
if(scalaBinaryVersion.value == "2.13") kindProjector
else if(scalaBinaryVersion.value == "2.12") kindProjector
else if(scalaBinaryVersion.value == "2.11") kindProjector
else Seq.empty
},
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)
addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck")