-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.sbt
More file actions
273 lines (238 loc) · 7.66 KB
/
Copy pathbuild.sbt
File metadata and controls
273 lines (238 loc) · 7.66 KB
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
import Dependencies._
import ReleaseTransformations._
import spray.boilerplate.BoilerplatePlugin
ThisBuild / organization := "com.kevel"
ThisBuild / scalaVersion := Versions.Scala213
ThisBuild / crossScalaVersions := Nil
val javaVersion = "11"
// Workaround for incompatible scala-xml versions taken from https://github.com/scala/bug/issues/12632. scala-xml 1.x
// and scala-xml 2.x are "mostly" binary compatible.
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
def module(project: Project, moduleName: String, crossScala: List[String] = List(Versions.Scala213, Versions.Scala3)) =
(project in file(s"modules/$moduleName"))
.settings(name := s"apso-$moduleName")
.settings(commonSettings: _*)
.settings(crossScalaVersions := crossScala)
lazy val aws = module(project, "aws")
.dependsOn(core)
.settings(
libraryDependencies ++= Seq(
AwsSdkCrt,
AwsSdkS3,
AwsSdkS3Transfer,
ScalaLogging,
TypesafeConfig
)
)
lazy val gcp = module(project, "gcp")
.dependsOn(core)
.settings(
libraryDependencies ++= Seq(
ScalaLogging,
GoogleCloudStorage,
ScalaLogging,
TypesafeConfig
)
)
lazy val caching = module(project, "caching")
.enablePlugins(BoilerplatePlugin)
.settings(
libraryDependencies ++= Seq(
Scaffeine,
Specs2_4Core % Test
),
// NOTICE: This may not be needed anymore if https://github.com/blemale/scaffeine/pull/441 is merged.
apiMappings ++= {
val scaffeineJar = (Compile / dependencyClasspath).value.map(_.data).find(_.getName.contains("scaffeine")).get
val scaffeineModule = libraryDependencies.value.find(_.name == "scaffeine").get
val path = CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => "scaffeine_2.13"
case Some((3, _)) => "scaffeine_3"
case _ => throw new RuntimeException("Unsupported Scala version")
}
val scaffeineVersion = scaffeineModule.revision
Map(scaffeineJar -> url(s"https://www.javadoc.io/doc/com.github.blemale/$path/$scaffeineVersion/"))
}
)
lazy val circe = module(project, "circe")
.settings(
libraryDependencies ++= Seq(
CatsCore,
CirceCore,
CirceGeneric,
CirceParser,
JodaTime % Provided,
Squants % Provided,
TypesafeConfig % Provided,
CirceLiteral % Test,
Specs2_4Core % Test,
Specs2_4JUnit % Test
)
)
lazy val collections = module(project, "collections")
.settings(
libraryDependencies ++= Seq(
ScalaCheck % Test,
Specs2_4Core % Test,
Specs2_4ScalaCheck % Test
)
)
lazy val core = module(project, "core")
.settings(
libraryDependencies ++= Seq(
CirceCore,
ScalaLogging,
TypesafeConfig % Provided,
UnirestJava,
JUnit % Test,
ScalaCheck % Test,
Specs2_4Core % Test,
Specs2_4JUnit % Test,
Specs2_4ScalaCheck % Test
)
)
lazy val encryption = module(project, "encryption")
.settings(libraryDependencies ++= Seq(BouncyCastlePkix % Runtime, BouncyCastleProvider, CommonsCodec, ScalaLogging))
lazy val hashing = module(project, "hashing")
.settings(libraryDependencies ++= Seq(FastMd5))
lazy val io = module(project, "io")
.dependsOn(aws)
.dependsOn(gcp)
.settings(
libraryDependencies ++= Seq(
// FIX: Explicitly override transient bouncy castle versions from `sshj`: https://security.snyk.io/vuln/SNYK-JAVA-ORGBOUNCYCASTLE-6612984
// Remove once com.hierynomus:sshj releases a version with https://github.com/hierynomus/sshj/pull/938
BouncyCastlePkix,
BouncyCastleProvider,
GoogleCloudStorage,
ScalaLogging,
ScalaPool,
SshJ,
TypesafeConfig,
Specs2_4Core % Test
)
)
lazy val pekko = module(project, "pekko")
.settings(libraryDependencies ++= Seq(PekkoActor % Provided))
lazy val pekkoHttp = module(project, "pekko-http")
.dependsOn(core)
.settings(
libraryDependencies ++= Seq(
ScalaLogging,
PekkoActor % Provided,
PekkoHttp % Provided,
PekkoHttpCore % Provided,
PekkoStream % Provided,
ScalaLogging,
TypesafeConfig,
PekkoActorTestkitTyped % Test,
PekkoHttpTestkit % Test,
Specs2_4Core % Test
)
)
lazy val profiling = module(project, "profiling")
.settings(libraryDependencies ++= Seq(ScalaLogging, SimpleJmx))
lazy val time = module(project, "time")
.settings(libraryDependencies ++= Seq(JodaTime, Specs2_4Core % Test))
lazy val docs = (project in file("apso-docs"))
.dependsOn(
aws,
caching,
circe,
collections,
core,
encryption,
gcp,
hashing,
io,
pekko,
pekkoHttp,
profiling,
time
)
.settings(commonSettings: _*)
.settings(
// format: off
crossScalaVersions := List(Versions.Scala213),
mdocOut := (ThisBuild / baseDirectory).value,
mdocVariables := Map(
"VERSION" ->
// This is reading the most recent header from the CHANGELOG that looks like a version, assuming that's the most
// recent version to refer to in the docs.
IO.readLines(file("CHANGELOG.md")).flatMap("""^## \[([0-9.]+)\]""".r.findFirstMatchIn).head.group(1)
),
publish / skip := true
// format: on
)
.enablePlugins(MdocPlugin)
lazy val commonSettings = Seq(
// format: off
resolvers ++=
Seq(
Resolver.sonatypeCentralSnapshots,
Resolver.typesafeRepo("snapshots"),
"Spray Repository" at "https://repo.spray.io/",
"Bintray Scalaz Releases" at "https://dl.bintray.com/scalaz/releases",
"JCenter Repository" at "https://jcenter.bintray.com/"
),
scalafmtOnCompile := true,
scalacOptions ++= {
lazy val commonFlags = Seq(
"-encoding", "UTF-8",
"-language:higherKinds",
"-language:implicitConversions",
"-feature",
"-unchecked",
"-deprecation",
"-release", javaVersion,
"-Xfatal-warnings")
def withCommon(flags: String*) =
commonFlags ++ flags
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
withCommon("-Xsource:3", "-Ywarn-dead-code", "-Ywarn-unused:imports")
case Some((3, _)) =>
withCommon("-Wunused:imports")
case _ =>
throw new RuntimeException("Unsupported Scala version")
}
},
javacOptions ++= List(
"--release", javaVersion
),
autoAPIMappings := true,
publishTo := {
val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/"
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
else localStaging.value
},
publishMavenStyle := true,
Test / publishArtifact := false,
pomIncludeRepository := { _ => false },
licenses := Seq("Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
homepage := Some(url("https://github.com/adzerk/apso")),
scmInfo := Some(
ScmInfo(
url("https://github.com/adzerk/apso"),
"scm:git:ssh://git@github.com/adzerk/apso.git"
)
)
// format: on
)
releaseCrossBuild := true
releaseTagComment := s"Release ${(ThisBuild / version).value}"
releaseCommitMessage := s"Set version to ${(ThisBuild / version).value}"
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonaRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)