-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.sbt
304 lines (274 loc) · 10.5 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
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
import Owner._
import de.heikoseeberger.sbtheader.License
import sbt.Keys.{libraryDependencies, name}
import xerial.sbt.Sonatype._
ThisBuild / scalaVersion := "2.13.4"
ThisBuild / organization := "com.github.fsanaulla"
ThisBuild / description := "Scala toolchain for InfluxDB "
ThisBuild / homepage := Some(url(s"${Owner.github}/${Owner.projectName}"))
ThisBuild / developers += Developer(
id = Owner.id,
name = Owner.name,
email = Owner.email,
url = url(Owner.github)
)
// publish
ThisBuild / scmInfo := Some(
ScmInfo(
url(s"${Owner.github}/${Owner.projectName}"),
s"scm:[email protected]:${Owner.id}/${Owner.projectName}.git"
)
)
ThisBuild / publishTo := sonatypePublishToBundle.value
ThisBuild / sonatypeBundleDirectory := (ThisBuild / baseDirectory).value / "target" / "sonatype-staging" / s"${version.value}"
ThisBuild / sonatypeProjectHosting := Some(
GitHubHosting(Owner.github, Owner.projectName, Owner.email)
)
ThisBuild / licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray)
ThisBuild / publishMavenStyle := true
ThisBuild / headerLicense := Some(License.ALv2("2017-2021", Owner.name))
val scala213 = "2.13.8"
val scala212 = "2.12.15"
val scala211 = "2.11.12"
lazy val chronicler = project
.in(file("."))
.settings(publish / skip := true)
.configure(license)
.aggregate(
Seq(
coreIO,
coreManagement,
coreShared,
ahcIO,
ahcManagement,
ahcShared,
akkaIO,
akkaManagement,
akkaShared,
urlIO,
urlManagement,
urlShared,
macros,
udp
).flatMap(_.projectRefs): _*
)
.enablePlugins(ScalafmtPlugin)
//////////////////////////////////////////////////////
//////////////////// CORE MODULES ////////////////////
//////////////////////////////////////////////////////
lazy val coreIO = projectMatrix
.in(file("modules/core/io"))
.settings(
name := s"$projectName-core-io"
)
.dependsOn(coreShared)
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
lazy val coreManagement = projectMatrix
.in(file("modules/core/management"))
.settings(
name := s"$projectName-core-management"
)
.dependsOn(coreShared)
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
lazy val coreShared = projectMatrix
.in(file("modules/core/shared"))
.settings(
name := s"$projectName-core-shared",
libraryDependencies ++= List(
"com.beachape" %% "enumeratum" % "1.7.0",
Library.jawnAst(scalaVersion.value)
) ++ (Library.scalaCheck :: Library.scalaTest).map(_ % Test)
)
.settings(Settings.propertyTestSettings: _*)
.configs(Settings.PropertyTest)
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
//////////////////////////////////////////////////////
////////////////// URL HTTP MODULES //////////////////
//////////////////////////////////////////////////////
lazy val urlManagement = projectMatrix
.in(file("modules/sync/management"))
.settings(name := s"$projectName-url-management")
.configure(defaultSettingsWithIt)
.dependsOn(coreManagement, urlShared)
.dependsOn(testing % "it,test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
lazy val urlIO = projectMatrix
.in(file("modules/sync/io"))
.settings(name := s"$projectName-url-io")
.configure(defaultSettingsWithIt)
.dependsOn(coreIO, urlShared)
.dependsOn(urlManagement % "it,test")
.dependsOn(macros % "it,test")
.dependsOn(testing % "it,test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
lazy val urlShared = projectMatrix
.in(file("modules/sync/shared"))
.settings(
name := s"$projectName-url-shared",
libraryDependencies ++=
"com.softwaremill.sttp.client3" %% "core" % "3.5.2"
:: Library.scalaTest.map(_ % Test)
)
.dependsOn(coreShared)
.dependsOn(testing % "test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
//////////////////////////////////////////////////////
////////////////// AKKA HTTP MODULES /////////////////
//////////////////////////////////////////////////////
lazy val akkaManagement = projectMatrix
.in(file("modules/akka/management"))
.settings(
name := s"$projectName-akka-management",
libraryDependencies += Library.akkaTestKit % "test,it"
)
.configure(defaultSettingsWithIt)
.dependsOn(coreManagement, akkaShared)
.dependsOn(testing % "test,it")
.jvmPlatform(scalaVersions = Seq(scala213, scala212))
lazy val akkaIO = projectMatrix
.in(file("modules/akka/io"))
.settings(
name := s"$projectName-akka-io",
libraryDependencies += Library.akkaTestKit % "test,it"
)
.configure(defaultSettingsWithIt)
.dependsOn(coreIO, akkaShared)
.dependsOn(akkaManagement % "test,it")
.dependsOn(testing % "test,it")
.dependsOn(macros % "test,it")
.jvmPlatform(scalaVersions = Seq(scala213, scala212))
lazy val akkaShared = projectMatrix
.in(file("modules/akka/shared"))
.settings(
name := s"$projectName-akka-shared",
libraryDependencies ++=
Library.akkaDep ++ Library.scalaTest.map(_ % Test)
)
.dependsOn(coreShared)
.dependsOn(testing % "test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212))
//////////////////////////////////////////////////////
///////////////// ASYNC HTTP MODULES /////////////////
//////////////////////////////////////////////////////
lazy val ahcManagement = projectMatrix
.in(file("modules/async/management"))
.settings(name := s"$projectName-ahc-management")
.configure(defaultSettingsWithIt)
.dependsOn(coreManagement, ahcShared)
.dependsOn(testing % "it,test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212))
lazy val ahcIO = projectMatrix
.in(file("modules/async/io"))
.settings(name := s"$projectName-ahc-io")
.configure(defaultSettingsWithIt)
.dependsOn(coreIO, ahcShared)
.dependsOn(ahcManagement % "it,test")
.dependsOn(testing % "it,test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212))
lazy val ahcShared = projectMatrix
.in(file("modules/async/shared"))
.settings(
name := s"$projectName-ahc-shared",
libraryDependencies ++=
Library.asyncDeps ++ Library.scalaTest.map(_ % Test)
)
.dependsOn(coreShared)
.dependsOn(testing % "test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212))
//////////////////////////////////////////////////////
///////////////////// UPD MODULE /////////////////////
//////////////////////////////////////////////////////
lazy val udp = projectMatrix
.in(file("modules/udp"))
.settings(
name := s"$projectName-udp"
)
.configure(defaultSettingsWithIt)
.dependsOn(coreShared)
.dependsOn(testing % "it,test")
.dependsOn(urlIO % "it,test")
.dependsOn(urlManagement % "it,test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
//////////////////////////////////////////////////////
///////////////////// MACRO MODULE ///////////////////
//////////////////////////////////////////////////////
lazy val macros = projectMatrix
.in(file("modules/macros"))
.settings(
name := s"$projectName-macros",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value
) ++ (Library.scalaCheck :: Library.scalaTest).map(_ % Test)
)
.settings(Settings.propertyTestSettings: _*)
.configs(Settings.PropertyTest)
.dependsOn(coreShared)
.dependsOn(testing % "test")
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
//////////////////////////////////////////////////////
/////////////////// TESTING MODULES //////////////////
//////////////////////////////////////////////////////
lazy val testing = projectMatrix
.in(file("modules/testing"))
.settings(
name := s"$projectName-testing",
libraryDependencies ++= Library.testingDeps
)
.dependsOn(coreShared)
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
//////////////////////////////////////////////////////
////////////////////// EXAMPLES //////////////////////
//////////////////////////////////////////////////////
lazy val akkaIOExample =
exampleModule("akka-io-example", "akka/io", akkaIO.jvm(scala213), macros.jvm(scala213))
lazy val akkaManagementExample =
exampleModule("akka-management-example", "akka/management", akkaManagement.jvm(scala213))
lazy val ahcIOExample =
exampleModule("ahc-io-example", "async/io", ahcIO.jvm(scala213), macros.jvm(scala213))
lazy val ahcManagementExample =
exampleModule("ahc-management-example", "async/management", ahcManagement.jvm(scala213))
lazy val urlIOExample =
exampleModule("url-io-example", "url/io", urlIO.jvm(scala213), macros.jvm(scala213))
lazy val urlManagementExample =
exampleModule("url-management-example", "url/management", urlManagement.jvm(scala213))
lazy val udpExample =
exampleModule("udp-example", "udp", udp.jvm(scala213), macros.jvm(scala213))
//////////////////////////////////////////////////////
///////////////////// BENCHMARKS /////////////////////
//////////////////////////////////////////////////////
lazy val benchmark = project
.in(file("benchmark"))
.settings(name := s"$projectName-benchmark")
.settings(
Jmh / sourceDirectory := (Test / sourceDirectory).value,
Jmh / classDirectory := (Test / classDirectory).value,
Jmh / dependencyClasspath := (Test / dependencyClasspath).value,
// rewire tasks, so that 'jmh:run' automatically invokes 'jmh:compile' (otherwise a clean 'jmh:run' would fail)
Jmh / compile := (Jmh / compile).dependsOn(Test / compile).value,
Jmh / run := (Jmh / run).dependsOn(Jmh / compile).evaluated,
libraryDependencies += "org.openjdk.jmh" % "jmh-generator-annprocess" % "1.21" % Test
)
.dependsOn(macros.jvm(scala213) % "test->test")
.dependsOn(coreShared.jvm(scala213))
.enablePlugins(JmhPlugin)
//////////////////////////////////////////////////////
////////////////////// UTILS /////////////////////////
//////////////////////////////////////////////////////
def license: Project => Project =
_.settings(
startYear := Some(2017),
headerLicense := Some(HeaderLicense.ALv2("2021", Owner.name))
).enablePlugins(AutomateHeaderPlugin)
def defaultSettingsWithIt: Project => Project =
_.settings(Defaults.itSettings)
.configs(IntegrationTest)
def exampleModule(
moduleName: String,
moduleDir: String,
dependsOn: sbt.ClasspathDep[sbt.ProjectReference]*
): Project =
Project(
s"$projectName-$moduleName",
file(s"examples/$moduleDir")
).dependsOn(dependsOn: _*)