-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
322 lines (292 loc) · 10 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
ThisBuild / organization := "com.zengularity"
ThisBuild / scalaVersion := "2.12.19"
ThisBuild / crossScalaVersions := Seq(
"2.11.12",
scalaVersion.value,
"2.13.14",
"3.4.3"
)
lazy val core = project
.in(file("core"))
.settings(
name := "benji-core",
Compile / compile / scalacOptions ++= {
if (scalaBinaryVersion.value startsWith "3") {
Seq("-language:higherKinds")
} else {
Seq(
// Silencer
"-P:silencer:globalFilters=constructor\\ deprecatedName\\ in\\ class\\ deprecatedName\\ is\\ deprecated",
"-language:higherKinds"
)
}
},
Compile / compile / scalacOptions ++= {
if (scalaBinaryVersion.value == "2.13") {
Seq("-Wconf:cat=deprecation&msg=.*deprecatedName.*:s")
} else {
Seq.empty
}
},
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._, ProblemFilters.{ exclude => x }
Seq(
x[ReversedMissingMethodProblem](
"com.zengularity.benji.BucketRef#ListRequest.withPrefix"
),
x[ReversedMissingMethodProblem]("com.zengularity.benji.BucketVersioning#VersionedListRequest.withPrefix")
)
},
libraryDependencies ++= Seq(
"commons-codec" % "commons-codec" % "1.17.1",
Dependencies.slf4jApi % Provided
),
libraryDependencies ~= {
_.map(_.exclude("com.typesafe", "ssl-config-core"))
}
)
val scalaXmlVer = Def.setting[String] {
val sv = scalaBinaryVersion.value
if (sv startsWith "3") "2.0.1"
else if (sv == "2.13") "1.3.0"
else "1.0.6"
}
import Dependencies.Version.{ play => playVer, playJson => playJsonVer }
lazy val s3 = project
.in(file("s3"))
.settings(
name := "benji-s3",
libraryDependencies ++= Dependencies.playAhcWS.value ++ Seq(
Dependencies.playWSXml.value,
"org.scala-lang.modules" %% "scala-xml" % scalaXmlVer.value % Provided
),
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._, ProblemFilters.{ exclude => x }
val pkg = "com.zengularity.benji.s3"
val wasPrivate = Seq(
x[MissingClassProblem](s"${pkg}.SignatureCalculator"),
x[IncompatibleMethTypeProblem](
s"${pkg}.VirtualHostWSRequestBuilder.this"
),
x[IncompatibleMethTypeProblem](
s"${pkg}.PathStyleWSRequestBuilder.this"
),
x[IncompatibleMethTypeProblem](s"${pkg}.WSRequestBuilder.build"),
x[MissingTypesProblem](s"${pkg}.WSS3BucketRef$$ObjectVersions$$"),
x[IncompatibleResultTypeProblem](
s"${pkg}.WSS3BucketRef#ObjectVersions.<init>$$default$$2"
),
x[DirectMissingMethodProblem](
s"${pkg}.WSS3BucketRef#ObjectVersions.apply"
),
x[IncompatibleResultTypeProblem](
s"${pkg}.WSS3BucketRef#ObjectVersions.apply$$default$$2"
),
x[DirectMissingMethodProblem](s"${pkg}.WSS3BucketRef#Objects.copy"),
x[DirectMissingMethodProblem](s"${pkg}.WSS3BucketRef#Objects.this"),
x[IncompatibleResultTypeProblem](
s"${pkg}.WSS3BucketRef#ObjectVersions.copy$$default$$2"
),
x[DirectMissingMethodProblem](
s"${pkg}.WSS3BucketRef#ObjectVersions.copy"
),
x[DirectMissingMethodProblem](
s"${pkg}.WSS3BucketRef#ObjectVersions.this"
),
x[MissingTypesProblem](s"${pkg}.WSS3BucketRef$$Objects$$"),
x[DirectMissingMethodProblem](s"${pkg}.WSS3BucketRef#Objects.apply"),
x[IncompatibleSignatureProblem](
"com.zengularity.benji.s3.WSS3BucketRef#ObjectVersions.unapply"
),
x[IncompatibleSignatureProblem]("com.zengularity.benji.s3.WSS3BucketRef#ObjectVersions.apply$default$1"),
x[IncompatibleSignatureProblem]("com.zengularity.benji.s3.WSS3BucketRef#ObjectVersions.<init>$default$1"),
x[IncompatibleSignatureProblem](
"com.zengularity.benji.s3.WSS3BucketRef#Objects.copy$default$1"
),
x[IncompatibleSignatureProblem](
"com.zengularity.benji.s3.WSS3BucketRef#ObjectVersions.copy$default$1"
),
x[IncompatibleSignatureProblem](
"com.zengularity.benji.s3.WSS3BucketRef#Objects.unapply"
)
)
wasPrivate
}
)
.dependsOn(core % "test->test;compile->compile")
lazy val google = project
.in(file("google"))
.settings(
name := "benji-google",
mimaPreviousArtifacts := {
if (scalaBinaryVersion.value == "2.12") {
Set(organization.value %% moduleName.value % "2.1.0")
} else {
Set.empty[ModuleID]
}
},
libraryDependencies ++= Dependencies.playAhcWS.value ++ Seq(
"com.typesafe.play" %% "play-json" % Dependencies.Version.playJson.value,
Dependencies.playWSJson.value,
"com.google.auth" % "google-auth-library-oauth2-http" % "1.24.1",
"com.google.apis" % "google-api-services-storage" % "v1-rev20210127-1.31.0"
)
)
.dependsOn(core % "test->test;compile->compile")
lazy val vfs = project
.in(file("vfs"))
.settings(
name := "benji-vfs",
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._, ProblemFilters.{ exclude => x }
val pkg = "com.zengularity.benji.vfs"
val wasPrivate = Seq(
x[DirectMissingMethodProblem](s"$pkg.BenjiFileSelector.this"),
x[DirectMissingMethodProblem](s"$pkg.VFSBucketRef.objects")
)
wasPrivate ++ Seq(
x[MissingClassProblem](
f"com.zengularity.benji.vfs.VFSBucketRef$$objects$$"
),
x[MissingClassProblem](
f"com.zengularity.benji.vfs.VFSObjectRef$$RESTPutRequest"
)
)
},
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-vfs2" % "2.9.0",
"com.typesafe.play" %% "play-json" % playJsonVer.value,
Dependencies.slf4jApi,
"commons-io" % "commons-io" % "2.7" % Test
)
)
.dependsOn(core % "test->test;compile->compile")
lazy val playTest = Def.setting {
val ver = {
if (scalaBinaryVersion.value startsWith "3") {
"2.8.11"
} else {
playVer.value
}
}
("com.typesafe.play" %% "play-test" % ver)
.cross(CrossVersion.for3Use2_13) // TODO: Remove
.exclude("com.typesafe.play", "*")
.exclude("org.scala-lang.modules", "*")
.exclude("com.typesafe.akka", "*") % Test
}
lazy val play = project
.in(file("play"))
.settings(
name := "benji-play",
version := {
val ver = (ThisBuild / version).value
val playMajor = playVer.value.split("\\.").take(2).mkString
if (ver endsWith "-SNAPSHOT") {
s"${ver.dropRight(9)}-play${playMajor}-SNAPSHOT"
} else {
s"${ver}-play${playMajor}"
}
},
Test / sourceDirectory := {
if (scalaBinaryVersion.value startsWith "3") {
baseDirectory.value / "no-test" // TODO
} else {
(Test / sourceDirectory).value
}
},
Test / unmanagedSourceDirectories ++= {
if (scalaBinaryVersion.value startsWith "3") {
Seq.empty
} else {
val v = playVer.value.split("\\.").take(2).mkString(".")
Seq(baseDirectory.value / "src" / "test" / s"play-$v")
}
},
mimaPreviousArtifacts := {
val playMajor = playVer.value.split("\\.").take(2).mkString
if (scalaBinaryVersion.value == "2.12") {
Set(organization.value %% moduleName.value % s"2.0.5-play${playMajor}")
} else {
Set.empty[ModuleID]
}
},
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._, ProblemFilters.{ exclude => x }
Seq(
x[MissingClassProblem](f"play.modules.benji.BenjiModule$$ValidUri$$")
)
},
libraryDependencies ++= {
val exclude: ModuleID => ModuleID = {
if (scalaBinaryVersion.value startsWith "3") { (mid: ModuleID) =>
mid
.exclude("com.typesafe.akka", "*")
.exclude("org.scala-lang.modules", "*")
.exclude("com.typesafe.play", "play-json_2.13")
} else { (mid: ModuleID) =>
mid
.exclude("com.typesafe.akka", "*")
.exclude("org.scala-lang.modules", "*")
}
}
val playMain = exclude(
("com.typesafe.play" %% "play" % playVer.value)
.cross(CrossVersion.for3Use2_13)
) % Provided
val playDeps: Seq[ModuleID] = {
if (playVer.value startsWith "2.6") {
Seq(playMain)
} else {
Seq(
playMain,
"com.typesafe.play" % "play-exceptions" % playVer.value % Provided
)
}
}
Dependencies.playAhcWS.value ++ playDeps ++ Seq(
playTest.value,
("com.typesafe.play" %% "play-guice" % playVer.value)
.cross(CrossVersion.for3Use2_13)
.exclude("com.typesafe.play", "*") % Test,
"com.typesafe.akka" %% "akka-actor-typed" % Dependencies.Version.akka.value % Provided
)
},
Compile / doc / sources := {
val compiled = (Compile / sources).value
compiled.filter { _.getName endsWith "NamedStorage.java" }
}
)
.dependsOn(core % "test->test;compile->compile", vfs % "test->compile")
mimaPreviousArtifacts := Set.empty
lazy val benji = (project in file("."))
.enablePlugins(ScalaUnidocPlugin)
.settings(
Seq(
libraryDependencies ++= Dependencies.playAhcWS.value,
pomPostProcess := Common.transformPomDependencies { depSpec =>
// Filter in POM the dependencies only required to compile sample in doc
if ((depSpec \ "artifactId").text startsWith "benji-") {
Some(depSpec)
} else {
Option.empty
}
},
doc / excludeFilter := "play",
Compile / doc / scalacOptions ++= List(
"-skip-packages",
"highlightextractor"
),
ScalaUnidoc / unidoc / unidocAllSources ~= {
_.map(_.filterNot { f =>
val name = f.getName
name.startsWith("NamedStorage") ||
name.indexOf("-md-") != -1 ||
(name.startsWith("package") &&
f.getPath.indexOf("src_managed") != -1)
})
}
) ++ Publish.settings
)
.dependsOn(s3, google, vfs, play)
.aggregate(core, s3, google, vfs, play)