-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
281 lines (257 loc) · 8.22 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
// import sbtcrossproject.CrossProject
// import com.jsuereth.sbtpgp.PgpKeys._ // for publishSigned
lazy val scala212 = "2.12.16"
lazy val scala213 = "2.13.8"
lazy val scala3 = "3.1.3"
lazy val supportedScalaVersions = List(
scala3,
scala213,
scala212
)
// Dependency versions
lazy val catsVersion = "2.8.0"
lazy val catsEffectVersion = "3.3.13"
lazy val circeVersion = "0.14.2"
lazy val fs2Version = "3.2.8"
lazy val munitVersion = "0.7.29"
lazy val munitEffectVersion = "1.0.7"
lazy val pprintVersion = "0.7.3"
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
lazy val catsKernel = "org.typelevel" %% "cats-kernel" % catsVersion
lazy val catsEffect = "org.typelevel" %% "cats-effect" % catsEffectVersion
lazy val circeCore = "io.circe" %% "circe-core" % circeVersion
lazy val circeGeneric = "io.circe" %% "circe-generic" % circeVersion
lazy val circeParser = "io.circe" %% "circe-parser" % circeVersion
lazy val fs2 = "co.fs2" %% "fs2-core" % fs2Version
lazy val fs2io = "co.fs2" %% "fs2-io" % fs2Version
lazy val munit = "org.scalameta" %% "munit" % munitVersion
lazy val munitEffects = "org.typelevel" %% "munit-cats-effect-3" % munitEffectVersion
lazy val pprint = "com.lihaoyi" %% "pprint" % pprintVersion
def priorTo2_13(scalaVersion: String): Boolean =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, minor)) if minor < 13 => true
case _ => false
}
val Java11 = JavaSpec.temurin("11")
ThisBuild / githubWorkflowJavaVersions := Seq(Java11)
lazy val utilsRoot =
project
// crossProject(JVMPlatform)
// .crossType(CrossType.Pure)
.in(file("."))
.settings(commonSettings)
.aggregate(typing, validating, utilsTest, utils, testsuite, docs)
.settings(
ThisBuild / turbo := true,
crossScalaVersions := Nil,
publish / skip := true,
// publishSigned / skip := true,
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(
List(
"clean",
// "coverage",
"test"
// "coverageReport",
// "scalafmtCheckAll"
),
id = None,
name = Some("Test")
)
/* WorkflowStep.Use(
UseRef.Public("codecov", "codecov-action", "e156083f13aff6830c92fc5faa23505779fbf649"), // v1.2.1
name = Some("Upload code coverage")
) */
)
)
lazy val typing =
project
// crossProject(JVMPlatform)
// .crossType(CrossType.Pure)
.in(file("modules/typing"))
.dependsOn(utils)
.settings(commonSettings)
.settings(
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= Seq(
catsCore,
catsKernel,
pprint
)
)
lazy val testsuite =
project
// crossProject(JVMPlatform)
// .crossType(CrossType.Pure)
.in(file("modules/testsuite"))
.dependsOn(utils)
.settings(commonSettings)
.settings(
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= Seq(
catsCore,
catsKernel,
catsEffect,
pprint
)
)
lazy val utilsTest =
project
// crossProject(JVMPlatform)
// .crossType(CrossType.Pure)
.in(file("modules/utilsTest"))
.settings(commonSettings)
.settings(
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= Seq(
circeCore,
circeGeneric,
circeParser,
catsCore,
catsKernel
// diffsonCirce,
// xercesImpl,
// commonsText,
// scalaTest
)
)
lazy val validating =
project
// crossProject(JVMPlatform)
// .crossType(CrossType.Pure)
.in(file("modules/validating"))
.dependsOn(utils % "test -> test; compile -> compile")
.settings(commonSettings)
.settings(
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= Seq(
catsCore,
catsKernel
)
)
lazy val utils =
project
// crossProject(JVMPlatform)
// .withoutSuffixFor(JVMPlatform)
// .crossType(CrossType.Pure)
.in(file("modules/utils"))
.settings(commonSettings)
.settings(
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= Seq(
circeCore,
circeGeneric,
circeParser,
catsCore,
catsKernel,
catsEffect,
fs2,
fs2io,
fs2,
fs2io,
pprint
)
)
// lazy val utilsJvm = utils.jvm
// lazy val validatingJvm = validating.jvm
// lazy val utilsTestJvm = utilsTest.jvm
lazy val docs =
project
// crossProject(JVMPlatform)
// .crossType(CrossType.Pure)
.in(file("utils-docs"))
.settings(
noPublishSettings,
mdocSettings,
ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(noDocProjects: _*)
)
.dependsOn(typing, validating, utilsTest, utils, testsuite)
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)
lazy val mdocSettings = Seq(
mdocVariables := Map(
"VERSION" -> version.value
),
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(utils),
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
cleanFiles += (ScalaUnidoc / unidoc / target).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(Compile / unidoc).value,
docusaurusPublishGhpages :=
docusaurusPublishGhpages.dependsOn(Compile / unidoc).value,
ScalaUnidoc / unidoc / scalacOptions ++= Seq(
"-doc-source-url",
s"https://github.com/weso/utils/tree/v${(ThisBuild / version).value}€{FILE_PATH}.scala",
"-sourcepath",
(LocalRootProject / baseDirectory).value.getAbsolutePath,
"-doc-title",
"Utils",
"-doc-version",
s"v${(ThisBuild / version).value}"
)
)
lazy val ghPagesSettings = Seq(
git.remoteRepo := "[email protected]:weso/utils.git"
)
/* ********************************************************
******************** Grouped Settings ********************
**********************************************************/
lazy val noDocProjects = Seq[ProjectReference](
// validating
)
lazy val noPublishSettings = publish / skip := true
lazy val sharedDependencies = Seq(
libraryDependencies ++= Seq(
munit % Test,
munitEffects % Test
),
testFrameworks += new TestFramework("munit.Framework")
)
/* lazy val packagingSettings = Seq(
mainClass in Compile := None,
mainClass in assembly := None,
test in assembly := {},
assemblyJarName in assembly := "utils.jar",
packageSummary in Linux := name.value,
packageSummary in Windows := name.value,
packageDescription := name.value
) */
val compilerOptions = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-unchecked",
"-Ywarn-numeric-widen",
"-Xfuture",
"-Yno-predef",
"-Ywarn-unused-import"
)
lazy val compilationSettings = Seq(
scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding",
"utf-8", // Specify character encoding used by source files.
"-feature", // Emit warning and location for usages of features that should be imported explicitly. "-encoding", "UTF-8",
"-unchecked" // Enable additional warnings where generated code depends on assumptions.
)
// format: on
)
lazy val commonSettings = compilationSettings ++ sharedDependencies ++ Seq(
organization := "es.weso",
sonatypeProfileName := "es.weso",
homepage := Some(url("https://github.com/weso/utils")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
scmInfo := Some(ScmInfo(url("https://github.com/weso/utils"), "scm:git:[email protected]:weso/utils.git")),
autoAPIMappings := true,
apiURL := Some(url("http://weso.github.io/utils/latest/api/")),
autoAPIMappings := true,
developers := List(
Developer(
id = "labra",
name = "Jose Emilio Labra Gayo",
email = "[email protected]",
url = url("https://labra.weso.es")
)
)
)