forked from laserdisc-io/tamer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
189 lines (168 loc) · 5.26 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
import sbt.addCommandAlias
lazy val scala_212 = "2.12.12"
lazy val scala_213 = "2.13.4"
lazy val V = new {
val avro4s = "4.0.4"
val cats = "2.3.1"
val `cats-effect` = "2.3.1"
val ciris = "1.2.1"
val confluent = "6.0.1"
val doobie = "0.9.4"
val kafka = "2.7.0"
val logback = "1.2.3"
val `log-effect` = "0.14.1"
val postgres = "42.2.18"
val refined = "0.9.19"
val scalacheck = "1.15.2"
val scalatest = "3.2.3"
val silencer = "1.7.1"
val zio = "1.0.3"
val `zio-interop` = "2.2.0.1"
val `zio-kafka` = "0.13.0"
}
lazy val D = new {
val cats = Seq(
"org.typelevel" %% "cats-core" % V.cats,
"org.typelevel" %% "cats-effect" % V.`cats-effect`
)
val config = Seq(
"is.cir" %% "ciris" % V.ciris,
"is.cir" %% "ciris-refined" % V.ciris
)
val doobie = Seq(
"org.tpolecat" %% "doobie-core" % V.doobie,
"org.tpolecat" %% "doobie-hikari" % V.doobie
)
val kafka = Seq(
"org.apache.kafka" % "kafka-clients" % V.kafka
)
val avro = Seq(
"io.confluent" % "kafka-avro-serializer" % V.confluent
)
val logs = Seq(
"ch.qos.logback" % "logback-classic" % V.logback,
"io.laserdisc" %% "log-effect-fs2" % V.`log-effect`,
"io.laserdisc" %% "log-effect-zio" % V.`log-effect`
)
val postgres = Seq(
"org.postgresql" % "postgresql" % V.postgres
)
val refined = Seq(
"eu.timepit" %% "refined" % V.refined
)
val serialization = Seq(
"com.sksamuel.avro4s" %% "avro4s-core" % V.avro4s
)
val silencer = Seq(
"com.github.ghik" %% "silencer-lib" % V.silencer % Provided cross CrossVersion.full
)
val tests = Seq(
"org.scalacheck" %% "scalacheck" % V.scalacheck % Test,
"org.scalactic" %% "scalactic" % V.scalatest % Test,
"org.scalatest" %% "scalatest" % V.scalatest % Test
)
val zio = Seq(
"dev.zio" %% "zio-interop-cats" % V.`zio-interop`,
"dev.zio" %% "zio-kafka" % V.`zio-kafka`,
"dev.zio" %% "zio-streams" % V.zio,
"dev.zio" %% "zio-test" % V.zio
)
}
lazy val flags = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-explaintypes",
"-Yrangepos",
"-feature",
"-language:higherKinds",
"-language:existentials",
"-language:implicitConversions",
"-unchecked",
"-Xlint:_,-type-parameter-shadow",
"-Xsource:2.13",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfatal-warnings",
"-Ywarn-unused",
"-opt-warnings",
"-Xlint:constant",
"-Ywarn-extra-implicit"
)
def versionDependent(scalaVersion: String) =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, major)) if major >= 13 =>
flags ++ Seq(
"-Wconf:any:error",
"-Ymacro-annotations",
"-Xlint:-byname-implicit"
)
case _ =>
flags ++ Seq(
"-Xfuture",
"-Xlint:by-name-right-associative",
"-Xlint:unsound-match",
"-Yno-adapted-args",
"-Ypartial-unification",
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit"
)
}
lazy val commonSettings = Seq(
organization := "io.laserdisc",
scalaVersion := scala_213,
crossScalaVersions := Seq(scala_212, scala_213),
homepage := Some(url("https://github.com/laserdisc-io/tamer")),
licenses += "MIT" -> url("http://opensource.org/licenses/MIT"),
developers += Developer("sirocchj", "Julien Sirocchi", "julien.sirocchi@gmail.com", url("https://github.com/sirocchj")),
scalacOptions ++= versionDependent(scalaVersion.value),
resolvers ++= Seq("confluent" at "https://packages.confluent.io/maven/")
)
lazy val tamer = project
.in(file("core"))
.settings(commonSettings)
.settings(
name := "tamer-core",
libraryDependencies ++= (D.cats ++ D.config ++ D.kafka ++ D.logs ++ D.refined ++ D.serialization ++ D.silencer ++ D.tests ++ D.zio)
.map(_.withSources)
.map(_.withJavadoc),
libraryDependencies ++= D.avro,
addCompilerPlugin("com.github.ghik" %% "silencer-plugin" % V.silencer cross CrossVersion.full),
Compile / console / scalacOptions --= Seq("-Ywarn-unused:imports", "-Xfatal-warnings"),
Test / console / scalacOptions := (Compile / console / scalacOptions).value
)
lazy val doobie = project
.in(file("doobie"))
.dependsOn(tamer)
.settings(commonSettings)
.settings(
name := "tamer-doobie",
libraryDependencies ++= D.doobie
)
lazy val example = project
.in(file("example"))
.enablePlugins(JavaAppPackaging)
.dependsOn(tamer, doobie)
.settings(commonSettings)
.settings(
libraryDependencies ++= D.postgres,
publish / skip := true
)
lazy val root = project
.in(file("."))
.aggregate(tamer, example, doobie)
.settings(commonSettings)
.settings(
publish / skip := true,
addCommandAlias("fmtCheck", ";scalafmtCheckAll;scalafmtSbtCheck"),
addCommandAlias("fmt", ";test:scalafmtAll;scalafmtAll;scalafmtSbt;test:scalafmtAll"),
addCommandAlias("fullTest", ";clean;test"),
addCommandAlias(
"setReleaseOptions",
"set scalacOptions ++= Seq(\"-opt:l:method\", \"-opt:l:inline\", \"-opt-inline-from:laserdisc.**\", \"-opt-inline-from:<sources>\")"
),
addCommandAlias("releaseIt", ";clean;setReleaseOptions;session list;compile;ci-release")
)