-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
279 lines (235 loc) · 9.03 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
Global / semanticdbEnabled := true
Global / cancelable := true
val commonSettings = Seq(
organization := "io.github.maxkar",
version := "0.0.1-SNAPSHOT",
Compile / scalaSource := baseDirectory.value / "src",
Test / scalaSource := baseDirectory.value / "test",
Test / fork := true,
scalaVersion := "3.5.2",
scalacOptions ++= Seq("-feature", "-deprecation"),
testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oS"),
)
val appSettings = Seq(
run / fork := true,
run / connectInput := true,
outputStrategy := Some(StdoutOutput),
)
val scalatest = "org.scalatest" %% "scalatest" % "3.2.9" % "test"
val jettyVersion = "9.4.49.v20220914"
val hsqldb = "org.hsqldb" % "hsqldb" % "2.7.1" % Test
val libFun = project.in(file("fun"))
.settings(commonSettings)
.settings(
name := "fun",
description :=
"""Very general functional programming definitions.""",
libraryDependencies += scalatest
)
val libText = project.in(file("text"))
.settings(commonSettings)
.settings(
name := "text",
description := "Generic text utilities (like text input/output, text location representation, etc...).",
libraryDependencies += scalatest,
).dependsOn(
libFun
)
val libJsonClassic = project.in(file("json/classic"))
.settings(commonSettings)
.settings(
name := "json-classic",
description :=
"""Easy to use and lightweight json parsing/generation library.
It provides javascript-like member access syntax and set of handy conversions.
The library is Scala 3 version of lib-json library in Scala 2.""",
libraryDependencies += scalatest
)
val libJsonParser = project.in(file("json/parser"))
.settings(commonSettings)
.settings(
name := "json-parser",
description :=
"""Generic JSON parser. Provides the syntactic rules for parsing
but abstracts from the rest of concepts like json model or input mechanism.""",
libraryDependencies += scalatest,
).dependsOn(
libFun,
libText,
)
val libJsonWriter = project.in(file("json/writer"))
.settings(commonSettings)
.settings(
name := "json-writer",
description := "Utilities for writing/outputting json (both ugly and pretty print)",
libraryDependencies += scalatest,
)
.dependsOn(
libFun, libText
)
val libJsonQuery = project.in(file("json/query"))
.settings(commonSettings)
.settings(
name := "json-query",
description :=
"""Json navigation and query library. It provides an ability to navigate abstract DOM and
| capture paths during that navigation. The paths may later be used to provide some good context
| (for example, in error messages).
|
|The library only defines generic tools (queries and query integration interfaces), the actual
| integration with Json Model is responsibility of that particular model.""".stripMargin,
libraryDependencies += scalatest
)
val libJsonSimple = project.in(file("json/simple"))
.settings(commonSettings)
.settings(
name := "json-simple",
description :=
"""Simple json model (natural JSON tree) with corresponding input,
|output and query facilities""".stripMargin,
libraryDependencies += scalatest
)
.dependsOn(libFun, libJsonParser, libJsonWriter, libJsonQuery)
val libJsonAttributed = project.in(file("json/attributed"))
.settings(commonSettings)
.settings(
name := "json-attributed-query",
description :=
"""Json object model with support for non-json model attributes.
| The attributes may define "auxilary" information like source location where element
| was defined.
|""".stripMargin,
libraryDependencies += scalatest
)
.dependsOn(libFun, libJsonParser, libJsonWriter, libJsonQuery)
val sampleJsonStreamingFormatter = project.in(file("json/samples/streaming-formatter"))
.settings(commonSettings)
.settings(appSettings)
.settings(
name := "json-streaming-formatter",
description :=
"""Sample JSON prettifier/compacter that relies on "asynchronous" (coroutine-based)
| input-output. This demonstrates how JSON modules could be used to process data without
| building in-memory tree. It also illustrates "heap-based" recursion (limited by memory and
| not stack size) and "coroutines". The app relies on synchronous readers/writers but the
| same approach could be used to integrate with non-blocking NIO input/output facilities.
""".stripMargin,
libraryDependencies += scalatest
)
.dependsOn(libJsonParser, libJsonWriter)
val libBackoff = project.in(file("backoff"))
.settings(commonSettings)
.settings(
name := "backoff",
description :=
"""Common traits for back-off logic and some common back-off strategies."""
)
val libSqlCore = project.in(file("sql/core"))
.settings(commonSettings)
.settings(
name := "sql-core",
description :=
"""A simple SQL query langaguage DSL. Provides a nice (and safe) SQL query syntax, result
| set parsing and general connection management. It also provides some common bindings
| for both input and output arguments.
""".stripMargin,
libraryDependencies ++= Seq(scalatest, hsqldb)
)
val libSqlDatabaseStatic = project.in(file("sql/database/static"))
.settings(commonSettings)
.settings(
name := "sql-database-static",
description :=
"""
|A fixed-size implementation of the Database access typeclass. This is an
| "inversion" of the regular pool pattern - resources are not provided from
| the pool but instead the tasks are provided to the database access.
|
| The implementation provided by this module maintains a fixed-size number
| of database connections (and corresponding I/O threads) that may handle the
| query tasks.
""".stripMargin,
libraryDependencies ++= Seq(scalatest, hsqldb)
)
.dependsOn(libSqlCore, libBackoff)
val httpHeaders = project.in(file("http/headers"))
.settings(commonSettings)
.settings(
name := "http-headers",
description :=
"""Common utilities for managing HTTP headers usable for both HTTP clients
| and servers. The module provides utilities for:
| * Dealing with collections of headers
| * Converting individual headers to and from domain model.
""",
libraryDependencies += scalatest
)
val httpServerApi = project.in(file("http/server/api"))
.settings(commonSettings)
.settings(
name := "http-server-api",
description :=
"""Server-related classes, typeclasses and utilites. This module defines a (server-agnostic)
| general-purpose API that could be leveraged by an HTTP server. For example, this includes:
| * Routing request based on the request-path.
| * Accessing request methods and headers
| * Returning HTTP response. This includes aborting processing early (for example, when
| user is not authorized to access the API).
| * Emiting some side-effects during processing like setting cookies or adding headers.
""".stripMargin
)
.dependsOn(libFun, httpHeaders)
val httpServerToolkit = project.in(file("http/server/toolkit"))
.settings(commonSettings)
.settings(
name := "http-server-toolkit",
description :=
"""Server toolkit - a set of clasess and utilties that makes writing server API
| implementations easy. These clasess do not form the client API (i.e. business logic
| is not expected to use them) but are very handy on the server side as they solve
| very common problems in the standard way.
""".stripMargin
)
.dependsOn(httpServerApi)
val httpServerJettyGateway = project.in(file("http/server/jetty/gateway"))
.settings(commonSettings)
.settings(
name := "jetty-server-gateway",
description :=
"""Jetty server main configuration point and very basic handlers.
| This module is rarely used alone. At least one another module
| (like jetty-server-qos) should be used for actual business logic
| implementation.
""",
libraryDependencies += "org.eclipse.jetty" % "jetty-server" % jettyVersion,
)
val httpServerJettyQoS = project.in(file("http/server/jetty/qos"))
.settings(commonSettings)
.settings(
name := "jetty-server-qos",
description := """Jetty handler with Quality-of-service support.""",
libraryDependencies ++= Seq(
"org.eclipse.jetty" % "jetty-server" % jettyVersion,
scalatest,
)
)
.dependsOn(libFun, httpServerToolkit, httpServerJettyGateway % Test)
val root = project.in(file("."))
.settings(commonSettings)
.settings(
name := "corelib",
description :=
"""An (opinionated) set of small modular (faceted) libraries for the most common tasks"""
)
.aggregate(
libFun,
libText,
libJsonClassic,
libJsonParser, libJsonWriter, libJsonQuery,
libJsonSimple, libJsonAttributed,
sampleJsonStreamingFormatter,
libBackoff,
libSqlCore, libSqlDatabaseStatic,
httpHeaders, httpServerApi, httpServerToolkit,
httpServerJettyGateway, httpServerJettyQoS,
)