-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sbt
283 lines (254 loc) · 9.32 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
import commandmatrix.extra.*
val versions = new {
val scala2 = "2.13.14"
val scala3 = "3.3.3"
// Which versions should be cross-compiled for publishing
val scalas = List(scala2, scala3)
val platforms = List(VirtualAxis.jvm)
// Which version should be used in IntelliJ
val ideScala = scala3
val idePlatform = VirtualAxis.jvm
}
Global / excludeLintKeys += ideSkipProject
val only1VersionInIDE =
MatrixAction
.ForPlatform(versions.idePlatform)
.Configure(
_.settings(
ideSkipProject := (scalaVersion.value != versions.ideScala),
bspEnabled := (scalaVersion.value == versions.ideScala)
)
) +:
versions.platforms.filter(_ != versions.idePlatform).map { platform =>
MatrixAction
.ForPlatform(platform)
.Configure(_.settings(ideSkipProject := true, bspEnabled := false))
}
val commonSettings = Seq(
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % "1.0.1" % Test
),
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
compilerPlugin("org.typelevel" % "kind-projector" % "0.13.3" cross CrossVersion.full)
)
case _ => Seq.empty
}
},
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq("-no-indent", "-Ykind-projector:underscores")
case _ => Seq("-Xsource:3")
}
}
)
// all projects
lazy val root = project
.in(file("."))
.aggregate(testClasses.projectRefs *)
.aggregate(showGenericProgramming.projectRefs *)
.aggregate(showGenericProgrammingAuto.projectRefs *)
.aggregate(showGenericProgrammingSemi.projectRefs *)
.aggregate(showMagnolia.projectRefs *)
.aggregate(showMagnoliaAuto.projectRefs *)
.aggregate(showMagnoliaSemi.projectRefs *)
.aggregate(showMacros.projectRefs *)
.aggregate(showSanely.projectRefs *)
.aggregate(circeGenericAuto.projectRefs *)
.aggregate(circeGenericSemi.projectRefs *)
.aggregate(circeMagnolia.projectRefs *)
.aggregate(circeMagnoliaAuto.projectRefs *)
.aggregate(circeMagnoliaSemi.projectRefs *)
.aggregate(jsoniterScalaWrapper.projectRefs *)
.aggregate(jsoniterScalaSanely.projectRefs *)
.aggregate(jsoniterScalaSemi.projectRefs *)
// classes for which we will derive things
lazy val testClasses = projectMatrix
.in(file("test-classes"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
// Show-related experiments:
lazy val showGenericProgramming = projectMatrix
.in(file("show-generic-programming"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq() // Scala 3 has mirrors
case Some((2, _)) => Seq("com.chuusai" %% "shapeless" % "2.3.12")
case _ => ???
}
}
)
lazy val showGenericProgrammingAuto = projectMatrix
.in(file("show-generic-programming-auto"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq("-Xmax-inlines", "64")
case Some((2, _)) => Seq()
case _ => ???
}
}
)
.dependsOn(testClasses, showGenericProgramming)
lazy val showGenericProgrammingSemi = projectMatrix
.in(file("show-generic-programming-semi"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.dependsOn(testClasses, showGenericProgramming)
lazy val showMagnolia = projectMatrix
.in(file("show-magnolia"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq("com.softwaremill.magnolia1_3" %% "magnolia" % "1.3.7")
case Some((2, _)) => Seq("com.softwaremill.magnolia1_2" %% "magnolia" % "1.1.10")
case _ => ???
}
}
)
lazy val showMagnoliaAuto = projectMatrix
.in(file("show-magnolia-auto"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq("-Xmax-inlines", "64")
case Some((2, _)) => Seq()
case _ => ???
}
}
)
.dependsOn(testClasses, showMagnolia)
lazy val showMagnoliaSemi = projectMatrix
.in(file("show-magnolia-semi"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.dependsOn(testClasses, showMagnolia)
lazy val showMacros = projectMatrix
.in(file("show-macros"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
libraryDependencies += "io.scalaland" %% "chimney-macro-commons" % "1.4.0"
)
lazy val showSanely = projectMatrix
.in(file("show-sanely"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
// Uncomment to enable logging from FastShowPretty macros
//.settings(scalacOptions += "-Xmacro-settings:fastshowpretty.logging=true")
.dependsOn(testClasses, showMacros)
// Circe-related experiments
lazy val circeGenericAuto = projectMatrix
.in(file("circe-generic-auto"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
libraryDependencies += "io.circe" %%% "circe-generic" % "0.14.9",
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq("-Xmax-inlines", "64")
case Some((2, _)) => Seq()
case _ => ???
}
}
)
.dependsOn(testClasses)
lazy val circeGenericSemi = projectMatrix
.in(file("circe-generic-semi"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
libraryDependencies += "io.circe" %% "circe-generic" % "0.14.9"
)
.dependsOn(testClasses)
// apparently all Magnolia-based Circe integrations are outdated(?)
lazy val circeMagnolia = projectMatrix
.in(file("circe-magnolia"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
libraryDependencies += "io.circe" %%% "circe-core" % "0.14.9",
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq("com.softwaremill.magnolia1_3" %% "magnolia" % "1.3.7")
case Some((2, _)) => Seq("com.softwaremill.magnolia1_2" %% "magnolia" % "1.1.10")
case _ => ???
}
}
)
lazy val circeMagnoliaAuto = projectMatrix
.in(file("circe-magnolia-auto"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq("-Xmax-inlines", "64")
case Some((2, _)) => Seq()
case _ => ???
}
}
)
.dependsOn(testClasses, circeMagnolia)
lazy val circeMagnoliaSemi = projectMatrix
.in(file("circe-magnolia-semi"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.dependsOn(
testClasses,
circeMagnolia
)
// Jsoniter Scala-related experiments
lazy val jsoniterScalaWrapper = projectMatrix
.in(file("jsoniter-scala-wrapper"))
.someVariations(List(versions.scala3), versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
libraryDependencies += "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.30.9",
libraryDependencies += "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.9"
)
lazy val jsoniterScalaSanely = projectMatrix
.in(file("jsoniter-scala-sanely"))
.someVariations(List(versions.scala3), versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.dependsOn(testClasses, jsoniterScalaWrapper)
lazy val jsoniterScalaSemi = projectMatrix
.in(file("jsoniter-scala-semi"))
.someVariations(versions.scalas, versions.platforms)(only1VersionInIDE *)
.settings(commonSettings *)
.settings(
libraryDependencies += "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.30.9",
libraryDependencies += "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.9"
)
.dependsOn(testClasses)
lazy val benchmarks = projectMatrix
.in(file("benchmarks"))
.someVariations(versions.scalas, versions.platforms)(
(MatrixAction
.ForScala(_.isScala3)
.Configure(_.dependsOn(jsoniterScalaSanely.jvm(versions.scala3))) +: only1VersionInIDE).toSeq *
)
.dependsOn(
showGenericProgrammingAuto,
showGenericProgrammingSemi,
showMagnoliaAuto,
showMagnoliaSemi,
showSanely,
circeGenericAuto,
circeGenericSemi,
circeMagnoliaAuto,
circeMagnoliaSemi,
jsoniterScalaSemi
)
.enablePlugins(JmhPlugin)