-
Notifications
You must be signed in to change notification settings - Fork 101
/
build.sc
282 lines (231 loc) · 9.15 KB
/
build.sc
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
import mill._
import mill.scalalib._
import mill.scalalib.publish._
val ScalaVersions = Seq("2.12.20", "2.13.14")
object library {
object Version {
val circe = "0.14.10"
val circeGenericExtras = "0.14.4"
val cats = "2.12.0"
val catsEffect = "2.5.5"
val catsEffect3 = "3.5.4"
val zio = "2.1.11"
val zhttp = "2.0.0-RC10"
val zioInteropCats = "23.1.0.3"
val sttp = "3.10.0"
val scalaTest = "3.2.19"
val scalaMockScalaTest = "6.0.0"
val scalaLogging = "3.9.5"
val logback = "1.5.12"
val scalajHttp = "2.4.2"
val akkaVersion = "2.6.20"
val akkaActor = akkaVersion
val akkaStream = akkaVersion
val akkaHttp = "10.5.2"
val akkaTestkit = akkaVersion
val akkaHttpCors = "1.2.0"
val hammock = "0.11.3"
val monix = "3.4.1"
val sbtTesting = "1.0"
}
val akkaHttp = ivy"com.typesafe.akka::akka-http::${Version.akkaHttp}"
val akkaHttpTestkit = ivy"com.typesafe.akka::akka-http-testkit::${Version.akkaHttp}"
val akkaTestkit = ivy"com.typesafe.akka::akka-testkit::${Version.akkaTestkit}"
val akkaActor = ivy"com.typesafe.akka::akka-actor::${Version.akkaActor}"
val akkaStream = ivy"com.typesafe.akka::akka-stream::${Version.akkaStream}"
val asyncHttpClientBackendCats =
ivy"com.softwaremill.sttp.client3::async-http-client-backend-cats-ce2::${Version.sttp}"
val asyncHttpClientBackendCats3 =
ivy"com.softwaremill.sttp.client3::async-http-client-backend-cats::${Version.sttp}"
val asyncHttpClientBackendZio =
ivy"com.softwaremill.sttp.client3::async-http-client-backend-zio::${Version.sttp}"
val asyncHttpClientBackendMonix = ivy"com.softwaremill.sttp.client3::async-http-client-backend-monix::${Version.sttp}"
val scalajHttp = ivy"org.scalaj::scalaj-http::${Version.scalajHttp}"
val scalaLogging = ivy"com.typesafe.scala-logging::scala-logging::${Version.scalaLogging}"
val scalaMockScalaTest = ivy"org.scalamock::scalamock::${Version.scalaMockScalaTest}"
val akkaHttpCors = ivy"ch.megard::akka-http-cors::${Version.akkaHttpCors}"
val scalaTest = ivy"org.scalatest::scalatest::${Version.scalaTest}"
val sbtTesting = ivy"org.scala-sbt:test-interface:${Version.sbtTesting}"
val logback = ivy"ch.qos.logback:logback-classic::${Version.logback}"
val circeCore = ivy"io.circe::circe-core::${Version.circe}"
val circeGeneric = ivy"io.circe::circe-generic::${Version.circe}"
val circeGenericExtras = ivy"io.circe::circe-generic-extras::${Version.circeGenericExtras}"
val circeParser = ivy"io.circe::circe-parser::${Version.circe}"
val circeLiteral = ivy"io.circe::circe-literal::${Version.circe}"
val catsCore = ivy"org.typelevel::cats-core::${Version.cats}"
val catsFree = ivy"org.typelevel::cats-free::${Version.cats}"
val catsEffect = ivy"org.typelevel::cats-effect::${Version.catsEffect}"
val catsEffect3 = ivy"org.typelevel::cats-effect::${Version.catsEffect3}"
val monix = ivy"io.monix::monix::${Version.monix}"
val sttpCore = ivy"com.softwaremill.sttp.client3::core::${Version.sttp}"
val sttpCirce = ivy"com.softwaremill.sttp.client3::circe::${Version.sttp}"
val sttpOkHttp = ivy"com.softwaremill.sttp.client3::okhttp-backend::${Version.sttp}"
val hammock = ivy"com.pepegar::hammock-core::${Version.hammock}"
val zio = ivy"dev.zio::zio::${Version.zio}"
val zhttp = ivy"io.d11::zhttp::${Version.zhttp}"
val zioInteropCats = ivy"dev.zio::zio-interop-cats::${Version.zioInteropCats}"
}
trait Bot4sTelegramModule extends CrossScalaModule {
override def scalacOptions = Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-Xlint:_",
// circe raises a lot of those warnings in the CirceEncoders file
"-Wconf:cat=lint-byname-implicit:s",
"-Ywarn-dead-code"
)
override def ivyDeps = T {
Agg(
library.circeCore,
library.circeGeneric,
library.circeGenericExtras,
library.circeParser,
library.circeLiteral,
library.catsCore,
library.catsFree,
library.sttpCore,
library.scalaLogging
)
}
trait Tests extends ScalaTests with TestModule.ScalaTest {
override def ivyDeps = T {
super.ivyDeps() ++ Agg(
library.scalaTest,
library.scalaMockScalaTest,
library.sbtTesting
)
}
}
}
trait Bot4sTelegramCrossPlatform extends Bot4sTelegramModule {
val platformSegment: String
val location: String
def millSourcePath = build.millSourcePath / location
override def sources = T.sources(
millSourcePath / "src",
millSourcePath / s"src-$platformSegment"
)
def crossScalaVersion: String
override def artifactName = s"telegram-$location"
}
trait Publishable extends PublishModule {
override def publishVersion = "5.8.3"
def pomSettings = PomSettings(
description = "Telegram Bot API wrapper for Scala",
organization = "com.bot4s",
url = "https://github.com/bot4s/telegram",
licenses = Seq(License.Common.Apache2),
versionControl = VersionControl.github("bot4s", "telegram"),
developers = Seq(
Developer("mukel", "Alfonso² Peterssen", "https://github.com/mukel")
)
)
}
object core extends Module {
object jvm extends Cross[CoreJvmModule](ScalaVersions)
trait CoreJvmModule extends Bot4sTelegramCrossPlatform with Publishable {
override val platformSegment: String = "jvm"
override val location: String = "core"
override def ivyDeps = T {
super.ivyDeps() ++ Agg(
library.scalajHttp
)
}
object test extends Tests
}
}
object akka extends Module {
object jvm extends Cross[AkkaModule](ScalaVersions)
trait AkkaModule extends Bot4sTelegramCrossPlatform with Publishable {
override val platformSegment: String = "jvm"
override val location: String = "akka"
override def artifactName = "telegram-akka"
override def ivyDeps = super.ivyDeps() ++ Agg(
library.akkaActor,
library.akkaHttp,
library.akkaStream
)
override def moduleDeps = Seq(core.jvm())
object test extends Tests {
override def moduleDeps = super.moduleDeps ++ Seq(core.jvm().test)
override def ivyDeps = T {
super.ivyDeps() ++ Agg(
library.akkaTestkit,
library.akkaHttpTestkit
)
}
}
}
}
object examples extends Module {
trait ExamplesJvmCommon extends Bot4sTelegramCrossPlatform {
override val platformSegment: String = "jvm"
override def ivyDeps = super.ivyDeps() ++ Agg(
library.logback
)
}
object jvm extends Cross[ExamplesJvmModule](ScalaVersions)
trait ExamplesJvmModule extends ExamplesJvmCommon {
override val location: String = "examples"
override def ivyDeps = super.ivyDeps() ++ Agg(
library.scalajHttp,
library.akkaHttpCors,
library.sttpOkHttp
)
override def moduleDeps = super.moduleDeps ++ Seq(core.jvm(), akka.jvm())
}
object catsjvm extends Cross[ExamplesCatsModule](ScalaVersions)
trait ExamplesCatsModule extends ExamplesJvmCommon {
override val location: String = "cats"
override def ivyDeps = super.ivyDeps() ++ Agg(
library.asyncHttpClientBackendCats,
library.catsEffect
)
override def moduleDeps = super.moduleDeps ++ Seq(core.jvm())
override def sources = T.sources(build.millSourcePath / "examples" / "src-cats")
}
object cats3jvm extends Cross[ExamplesCats3Module](ScalaVersions)
trait ExamplesCats3Module extends ExamplesJvmCommon {
override val location: String = "cats"
override def ivyDeps = T {
super.ivyDeps() ++ Agg(
library.asyncHttpClientBackendCats3,
library.catsEffect3
)
}
override def moduleDeps = super.moduleDeps ++ Seq(core.jvm())
override def sources = T.sources(build.millSourcePath / "examples" / "src-cats3")
}
object ziojvm extends Cross[ExamplesZIOModule](ScalaVersions)
trait ExamplesZIOModule extends ExamplesJvmCommon {
override val location: String = "zio"
override def ivyDeps = T {
super.ivyDeps() ++ Agg(
library.asyncHttpClientBackendZio,
library.zio,
library.zhttp,
library.zioInteropCats,
library.catsEffect3
)
}
override def moduleDeps = super.moduleDeps ++ Seq(core.jvm())
override def sources = T.sources(build.millSourcePath / "examples" / "src-zio")
}
object monixjvm extends Cross[ExamplesMonixModule](ScalaVersions)
trait ExamplesMonixModule extends ExamplesJvmCommon {
override val location: String = "monix"
override def ivyDeps = T {
super.ivyDeps() ++ Agg(
library.asyncHttpClientBackendMonix,
library.monix
)
}
override def moduleDeps = super.moduleDeps ++ Seq(core.jvm())
override def sources = T.sources(build.millSourcePath / "examples" / "src-monix")
}
}