-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
330 lines (322 loc) · 11.1 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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
import sbt.Keys.crossScalaVersions
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
lazy val Scala2_13 = "2.13.10"
lazy val Scala3_0 = "3.0.2"
lazy val Scala3_1 = "3.1.3"
lazy val Scala3_2 = "3.2.2"
lazy val Scala3_3 = "3.3.0"
scalaVersion in Scope.Global := Scala3_3
releaseCrossBuild in Scope.Global := true
crossScalaVersions in Scope.Global := Seq(Scala2_13, Scala3_0, Scala3_1, Scala3_2, Scala3_3)
val isScala3 = Def.setting(
CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)
)
val isScala3_0 = Def.setting(
CrossVersion.partialVersion(scalaVersion.value).contains((3, 0))
)
lazy val akkaVersion = "2.6.13"
lazy val akkaHttpVersion = "10.2.4"
lazy val pac4jVersion = "4.1.0"
lazy val pureconfigVersion = "0.14.0"
lazy val scalacheckVersion = "1.15.2"
lazy val scalamockVersion = "5.1.0"
lazy val scalaLoggingVersion = "3.9.2"
lazy val typesafeConfigVersion = "1.4.1"
lazy val scala3PartialBuild = Def.settings(
crossScalaVersions := Seq(Scala2_13, Scala3_0, Scala3_1),
libraryDependencies ++= Seq("org.scalatest" %% "scalatest" % "3.2.9" % Test) ++ {
CrossVersion
.partialVersion(scalaVersion.value) match {
case Some((2, y)) if y >= 13 =>
Seq(
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.0"
)
case _ => Nil
}
}
)
val noPublish = Seq(
publishArtifact := false,
publish := {},
publishLocal := {},
// Explicitely skip the doc task because protobuf related Java files causes no type found error
Compile / doc / sources := Seq.empty,
Compile / packageDoc / publishArtifact := false
)
lazy val asemble = Seq(
ThisProject / sonatypeBundleDirectory := (ThisProject / baseDirectory).value / target.value.getName / "sonatype-staging" / s"${version.value}",
ThisProject / publishTo := sonatypePublishToBundle.value,
organization := "com.phylage",
Test / scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-feature",
"-Xlint",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-language:higherKinds",
// "-Ymacro-debug-verbose",
"-language:implicitConversions"
),
licenses += ("Apache-2.0", url(
"https://www.apache.org/licenses/LICENSE-2.0.html"
)),
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
ReleaseStep(
action = Command.process("sonatypeBundleRelease", _),
enableCrossBuild = true
)
)
)
lazy val root = project
.in(file("."))
.settings(noPublish)
.settings(
ThisProject / releaseProcess := Nil,
ThisProject / publishLocal := {},
ThisProject / publishArtifact := false,
Compile / resourceDirectories += {
(ThisProject / baseDirectory).value / "project" / "resources"
}
)
.aggregate(
`containerMacro`,
container,
util,
jsonMacro,
json,
cipher,
// http,
// auth,
// oauth,
// root_interfaces,
// interfaces_impl,
// call_interfaces
)
lazy val `containerMacro` = (project in file("refuel-container-macro"))
.settings(asemble, scala3PartialBuild)
.settings(
name := "refuel-container-macro",
description := "Lightweight DI container Macro for Scala3.",
Def.settings(
Compile / unmanagedSourceDirectories ++= {
if (isScala3_0.value) {
Seq((ThisProject / baseDirectory).value / "src" / "main" / "scala-3.0")
} else if (isScala3.value) {
Seq((ThisProject / baseDirectory).value / "src" / "main" / "scala-3.x")
} else Nil
},
libraryDependencies ++= {
if (isScala3.value) {
Seq(
"com.typesafe" % "config" % typesafeConfigVersion,
"org.scala-lang" %% "scala3-compiler" % scalaVersion.value,
"org.scala-lang" %% "scala3-staging" % scalaVersion.value
)
} else {
Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.typesafe" % "config" % typesafeConfigVersion
)
}
},
scalacOptions ++= {
if (!isScala3.value) {
Seq("-language:experimental.macros")
} else Nil
} ++ {
if (isScala3_0.value) {
Seq("-language:experimental")
} else Nil
}
)
)
lazy val `jsonMacro` = (project in file("refuel-json-macro"))
.dependsOn(container)
.settings(asemble, scala3PartialBuild)
.settings(
name := "refuel-json-macro",
description := "Refuel Json Macro for Scala3.",
Def.settings(
libraryDependencies ++= {
if (isScala3.value) {
Seq(
"com.typesafe" % "config" % typesafeConfigVersion,
"org.scala-lang" %% "scala3-compiler" % scalaVersion.value,
)
} else {
Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.typesafe" % "config" % typesafeConfigVersion
)
}
},
scalacOptions ++= {
if (!isScala3.value) {
Seq("-language:experimental.macros")
} else Nil
}
)
)
lazy val container = (project in file("refuel-container"))
.dependsOn(`containerMacro`)
.settings(asemble, scala3PartialBuild)
.settings(
name := "refuel-container",
description := "Lightweight DI container for Scala.",
Test / parallelExecution := false,
Def.settings(
libraryDependencies ++= {
if (isScala3.value) {
Seq(
"org.scala-lang" %% "scala3-staging" % scalaVersion.value
)
} else {
Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion
)
}
},
Global / scalacOptions ++= {
if (!isScala3.value) {
Seq(
"-language:experimental.macros"
)
} else Nil
}
),
Compile / unmanagedClasspath ++= (Compile / unmanagedResources).value
)
lazy val util = (project in file("refuel-util"))
.dependsOn(container)
.settings(asemble, scala3PartialBuild)
.settings(
name := "refuel-util"
)
lazy val json = (project in file("refuel-json"))
.dependsOn(jsonMacro, util)
.settings(asemble, scala3PartialBuild)
.settings(
name := "refuel-json",
description := "Various classes serializer / deserializer",
scalacOptions ++= Seq(
"-Xlog-implicits"
),
Jmh / resourceDirectory := (Compile / resourceDirectory).value,
)
lazy val cipher = (project in file("refuel-cipher"))
.dependsOn(json)
.settings(asemble, scala3PartialBuild)
.settings(
name := "refuel-cipher",
description := "Cipher module for Scala.",
Test / unmanagedClasspath ++= (Compile / unmanagedResources).value
)
.enablePlugins(JavaAppPackaging)
//lazy val http = (project in file("refuel-http"))
// .dependsOn(json)
// .settings(asemble)
// .settings(
// Test / aggregate := false,
// name := "refuel-http",
// description := "Http client for Scala.",
// libraryDependencies ++= Seq(
// "com.typesafe.akka" %% "akka-stream" % akkaVersion % Provided,
// "com.typesafe.akka" %% "akka-http" % akkaHttpVersion % Provided
// ),
// Test / unmanagedClasspath ++= (Compile / unmanagedResources).value,
// Test / testOptions ++= Seq(
// Tests.Setup { _ =>
// import scala.sys.process._
//
// Process("sh sh/setup-testing-http-server.sh").run
//
// Http.connect("http://localhost:3289/success")
// },
// Tests.Cleanup { _ =>
// import scala.sys.process._
// println(s"Shutdown exit ${Process("sh sh/shutdown-testing-http-server.sh").!}")
// println("Shutdown completed.")
// }
// )
// )
// .enablePlugins(JavaAppPackaging)
//lazy val auth = (project in file("refuel-auth-provider"))
// .dependsOn(http)
// .settings(asemble)
// .settings(
// ThisBuild / resolvers += ("Shibboleth Repository" at "https://build.shibboleth.net/nexus/content/repositories/releases/"),
// name := "refuel-auth-provider",
// description := "Auth provider.",
// libraryDependencies ++= Seq(
// "com.typesafe.akka" %% "akka-stream" % akkaVersion,
// "com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
// "org.pac4j" % "pac4j-saml" % pac4jVersion,
// "com.github.pureconfig" %% "pureconfig" % pureconfigVersion,
// "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
// "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % Test,
// "com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test
// )
// )
//lazy val oauth = (project in file("refuel-oauth-provider"))
// .dependsOn(cipher)
// .settings(asemble)
// .settings(
// name := "refuel-oauth-provider",
// description := "OAuth 2.0 provider.",
// libraryDependencies ++= Seq(
// "com.typesafe.akka" %% "akka-stream" % akkaVersion,
// "com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
// "com.github.pureconfig" %% "pureconfig" % pureconfigVersion,
// "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
// "org.scalamock" %% "scalamock" % scalamockVersion % Test,
// "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % Test,
// "com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test
// )
// )
//lazy val `test` = (project in file("refuel-test"))
// .dependsOn(json)
// .settings(name := "refuel-test", description := "DI testing framework.")
// .enablePlugins(JavaAppPackaging)
//lazy val root_interfaces =
// (project in file("test-across-module/root_interfaces"))
// .dependsOn(http)
// .settings(
// Keys.`package` := file(""),
// ThisProject / publishArtifact := false,
// ThisProject / releaseProcess := Nil,
// ThisProject / publish := {},
// ThisProject / publishLocal := {},
// ThisProject / publishTo := Some(Opts.resolver.mavenLocalFile)
// )
// .enablePlugins(JmhPlugin)
//lazy val interfaces_impl =
// (project in file("test-across-module/interfaces_impl"))
// .dependsOn(root_interfaces)
// .settings(
// Keys.`package` := file(""),
// ThisProject / publishArtifact := false,
// ThisProject / releaseProcess := Nil,
// ThisProject / publish := {},
// ThisProject / publishLocal := {},
// ThisProject / publishTo := Some(Opts.resolver.mavenLocalFile)
// )
//lazy val call_interfaces =
// (project in file("test-across-module/call_interfaces"))
// .dependsOn(interfaces_impl)
// .settings(
// Keys.`package` := file(""),
// ThisProject / publishArtifact := false,
// ThisProject / releaseProcess := Nil,
// ThisProject / publish := {},
// ThisProject / publishLocal := {},
// ThisProject / publishTo := Some(Opts.resolver.mavenLocalFile)
// )