forked from lloydmeta/enumeratum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
627 lines (585 loc) · 21.2 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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
import com.typesafe.sbt.SbtGit.{GitKeys => git}
lazy val theScalaVersion = "2.12.6"
lazy val scalaVersions = Seq("2.10.7", "2.11.12", "2.12.6")
lazy val scalaTestVersion = "3.0.5"
lazy val scalacheckVersion = "1.13.5"
// Library versions
lazy val reactiveMongoVersion = "0.13.0"
lazy val circeVersion = "0.9.3"
lazy val uPickleVersion = "0.4.4"
lazy val argonautVersion = "6.2.1"
lazy val json4sVersion = "3.5.3"
lazy val quillVersion = "2.3.3"
def thePlayVersion(scalaVersion: String) =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor)) if scalaMajor >= 11 => "2.6.12"
case Some((2, scalaMajor)) if scalaMajor == 10 => "2.4.11"
case _ =>
throw new IllegalArgumentException(s"Unsupported Scala version $scalaVersion")
}
def theSlickVersion(scalaVersion: String) =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor)) if scalaMajor >= 11 => "3.2.3"
case Some((2, scalaMajor)) if scalaMajor == 10 => "3.1.1"
case _ =>
throw new IllegalArgumentException(s"Unsupported Scala version $scalaVersion")
}
def thePlayJsonVersion(scalaVersion: String) =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor)) if scalaMajor >= 11 => "2.6.10"
case Some((2, scalaMajor)) if scalaMajor == 10 => "2.4.11"
case _ =>
throw new IllegalArgumentException(s"Unsupported Scala version $scalaVersion")
}
def scalaTestPlay(scalaVersion: String) = CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor)) if scalaMajor >= 11 =>
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
case Some((2, scalaMajor)) if scalaMajor == 10 =>
"org.scalatestplus" %% "play" % "1.4.0" % Test
case _ =>
throw new IllegalArgumentException(s"Unsupported Scala version $scalaVersion")
}
lazy val baseProjectRefs =
Seq(macrosJS, macrosJVM, coreJS, coreJVM, coreJVMTests).map(Project.projectToRef)
lazy val integrationProjectRefs = Seq(
enumeratumPlay,
enumeratumPlayJsonJs,
enumeratumPlayJsonJvm,
enumeratumUPickleJs,
enumeratumUPickleJvm,
enumeratumCirceJs,
enumeratumCirceJvm,
enumeratumReactiveMongoBson,
enumeratumArgonautJs,
enumeratumArgonautJvm,
enumeratumJson4s,
enumeratumScalacheckJs,
enumeratumScalacheckJvm,
enumeratumQuillJs,
enumeratumQuillJvm,
enumeratumSlick
).map(Project.projectToRef)
lazy val root =
Project(id = "enumeratum-root", base = file("."))
.settings(commonWithPublishSettings: _*)
.settings(
name := "enumeratum-root",
crossVersion := CrossVersion.binary,
git.gitRemoteRepo := "[email protected]:lloydmeta/enumeratum.git",
// Do not publish the root project (it just serves as an aggregate)
publishArtifact := false,
publishLocal := {},
aggregate in publish := false,
aggregate in PgpKeys.publishSigned := false
)
.aggregate(baseProjectRefs ++ integrationProjectRefs: _*)
lazy val macrosAggregate = aggregateProject("macros", macrosJS, macrosJVM)
lazy val macros = crossProject
.crossType(CrossType.Pure)
.in(file("macros"))
.settings(commonWithPublishSettings: _*)
.settings(
withCompatUnmanagedSources(jsJvmCrossProject = true,
include_210Dir = true,
includeTestSrcs = false): _*)
.settings(
name := "enumeratum-macros",
version := Versions.Macros.head,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value
)
)
.settings(testSettings: _*)
lazy val macrosJS = macros.js
lazy val macrosJVM = macros.jvm
// Aggregates core
lazy val coreAggregate = aggregateProject("core", coreJS, coreJVM)
lazy val core = crossProject
.crossType(CrossType.Pure)
.in(file("enumeratum-core"))
.settings(
name := "enumeratum",
version := Versions.Core.head,
libraryDependencies += "com.beachape" %% "enumeratum-macros" % Versions.Macros.stable
)
.settings(testSettings: _*)
.settings(commonWithPublishSettings: _*)
// .dependsOn(macros) // used for testing macros
lazy val coreJS = core.js
lazy val coreJVM = core.jvm
lazy val testsAggregate = aggregateProject("test", enumeratumTestJs, enumeratumTestJvm)
// Project models used in test for some subprojects
lazy val enumeratumTest = crossProject
.crossType(CrossType.Pure)
.in(file("enumeratum-test"))
.settings(testSettings: _*)
.settings(commonWithPublishSettings: _*)
.settings(
name := "enumeratum-test",
version := Versions.Core.stable,
libraryDependencies += {
import org.scalajs.sbtplugin._
val crossVersion =
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
ScalaJSCrossVersion.binary
else
CrossVersion.binary
impl.ScalaJSGroupID
.withCross("com.beachape", "enumeratum", crossVersion) % Versions.Core.stable
}
)
lazy val enumeratumTestJs = enumeratumTest.js
lazy val enumeratumTestJvm = enumeratumTest.jvm
lazy val coreJVMTests = Project(id = "coreJVMTests", base = file("enumeratum-core-jvm-tests"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
name := "coreJVMTests",
version := Versions.Core.head,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Test
),
publishArtifact := false
)
.dependsOn(coreJVM, macrosJVM)
lazy val enumeratumReactiveMongoBson =
Project(id = "enumeratum-reactivemongo-bson", base = file("enumeratum-reactivemongo-bson"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
version := "1.5.14-SNAPSHOT",
libraryDependencies ++= Seq(
"org.reactivemongo" %% "reactivemongo" % reactiveMongoVersion,
"com.beachape" %% "enumeratum" % Versions.Core.stable,
"com.beachape" %% "enumeratum-test" % Versions.Core.stable % Test
)
)
lazy val playJsonAggregate =
aggregateProject("play-json", enumeratumPlayJsonJs, enumeratumPlayJsonJvm).settings(
crossScalaVersions := {
val versions = {
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
post210Only(crossScalaVersions.value)
else
crossScalaVersions.value
}
versions
}
)
lazy val enumeratumPlayJson = crossProject
.crossType(CrossType.Pure)
.in(file("enumeratum-play-json"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
name := "enumeratum-play-json",
version := s"1.5.14",
crossScalaVersions := {
val versions = {
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
post210Only(crossScalaVersions.value)
else
crossScalaVersions.value
}
versions
},
libraryDependencies ++= {
import org.scalajs.sbtplugin._
val cross = {
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
ScalaJSCrossVersion.binary
else
CrossVersion.binary
}
Seq(
impl.ScalaJSGroupID.withCross("com.typesafe.play", "play-json", cross) % thePlayJsonVersion(
scalaVersion.value),
impl.ScalaJSGroupID.withCross("com.beachape", "enumeratum", cross) % Versions.Core.stable,
impl.ScalaJSGroupID
.withCross("com.beachape", "enumeratum-test", cross) % Versions.Core.stable % Test
)
}
)
lazy val enumeratumPlayJsonJs = enumeratumPlayJson.js
lazy val enumeratumPlayJsonJvm = enumeratumPlayJson.jvm
lazy val enumeratumPlay = Project(id = "enumeratum-play", base = file("enumeratum-play"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
version := s"1.5.15-SNAPSHOT",
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play" % thePlayVersion(scalaVersion.value),
"com.beachape" %% "enumeratum" % Versions.Core.stable,
"com.beachape" %% "enumeratum-test" % Versions.Core.stable % Test,
scalaTestPlay(scalaVersion.value)
)
)
.dependsOn(enumeratumPlayJsonJvm % "test->test;compile->compile")
lazy val uPickleAggregate = aggregateProject("upickle", enumeratumUPickleJs, enumeratumUPickleJvm)
lazy val enumeratumUPickle = crossProject
.crossType(CrossType.Pure)
.in(file("enumeratum-upickle"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
name := "enumeratum-upickle",
version := "1.5.13-SNAPSHOT",
libraryDependencies ++= {
import org.scalajs.sbtplugin._
val cross = {
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
ScalaJSCrossVersion.binary
else
CrossVersion.binary
}
Seq(
impl.ScalaJSGroupID.withCross("com.lihaoyi", "upickle", cross) % uPickleVersion,
impl.ScalaJSGroupID.withCross("com.beachape", "enumeratum", cross) % Versions.Core.stable
)
} ++ {
val additionalMacroDeps =
CrossVersion.partialVersion(scalaVersion.value) match {
// if scala 2.11+ is used, quasiquotes are merged into scala-reflect
case Some((2, scalaMajor)) if scalaMajor >= 11 =>
Nil
// in Scala 2.10, quasiquotes are provided by macro paradise
case Some((2, 10)) =>
Seq("org.scalamacros" %% "quasiquotes" % "2.0.1" cross CrossVersion.binary)
}
additionalMacroDeps
}
)
lazy val enumeratumUPickleJs = enumeratumUPickle.js
lazy val enumeratumUPickleJvm = enumeratumUPickle.jvm
lazy val circeAggregate = aggregateProject("circe", enumeratumCirceJs, enumeratumCirceJvm)
lazy val enumeratumCirce = crossProject
.crossType(CrossType.Pure)
.in(file("enumeratum-circe"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
name := "enumeratum-circe",
version := "1.5.18-SNAPSHOT",
libraryDependencies ++= {
import org.scalajs.sbtplugin._
val cross = {
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
ScalaJSCrossVersion.binary
else
CrossVersion.binary
}
Seq(
impl.ScalaJSGroupID.withCross("io.circe", "circe-core", cross) % circeVersion,
impl.ScalaJSGroupID.withCross("com.beachape", "enumeratum", cross) % Versions.Core.stable
)
}
)
lazy val enumeratumCirceJs = enumeratumCirce.js
lazy val enumeratumCirceJvm = enumeratumCirce.jvm
lazy val argonautAggregate =
aggregateProject("argonaut", enumeratumArgonautJs, enumeratumArgonautJvm)
lazy val enumeratumArgonaut = crossProject
.crossType(CrossType.Pure)
.in(file("enumeratum-argonaut"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
name := "enumeratum-argonaut",
version := "1.5.14-SNAPSHOT",
libraryDependencies ++= {
import org.scalajs.sbtplugin._
val cross = {
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
ScalaJSCrossVersion.binary
else
CrossVersion.binary
}
Seq(
impl.ScalaJSGroupID.withCross("io.argonaut", "argonaut", cross) % argonautVersion,
impl.ScalaJSGroupID.withCross("com.beachape", "enumeratum", cross) % Versions.Core.stable
)
}
)
lazy val enumeratumArgonautJs = enumeratumArgonaut.js
lazy val enumeratumArgonautJvm = enumeratumArgonaut.jvm
lazy val enumeratumJson4s =
Project(id = "enumeratum-json4s", base = file("enumeratum-json4s"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
version := "1.5.15-SNAPSHOT",
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-core" % json4sVersion,
"org.json4s" %% "json4s-native" % json4sVersion % Test,
"com.beachape" %% "enumeratum" % Versions.Core.stable
)
)
lazy val scalacheckAggregate =
aggregateProject("scalacheck", enumeratumScalacheckJs, enumeratumScalacheckJvm)
lazy val enumeratumScalacheck = crossProject
.crossType(CrossType.Pure)
.in(file("enumeratum-scalacheck"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
name := "enumeratum-scalacheck",
version := "1.5.16-SNAPSHOT",
libraryDependencies ++= {
import org.scalajs.sbtplugin._
val cross = {
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
ScalaJSCrossVersion.binary
else
CrossVersion.binary
}
Seq(
impl.ScalaJSGroupID.withCross("org.scalacheck", "scalacheck", cross) % scalacheckVersion,
impl.ScalaJSGroupID.withCross("com.beachape", "enumeratum", cross) % Versions.Core.stable,
impl.ScalaJSGroupID
.withCross("com.beachape", "enumeratum-test", cross) % Versions.Core.stable % Test
)
}
)
lazy val enumeratumScalacheckJs = enumeratumScalacheck.js
lazy val enumeratumScalacheckJvm = enumeratumScalacheck.jvm
lazy val quillAggregate = aggregateProject("quill", enumeratumQuillJs, enumeratumQuillJvm).settings(
crossScalaVersions := post210Only(crossScalaVersions.value)
)
lazy val enumeratumQuill = crossProject
.crossType(CrossType.Pure)
.in(file("enumeratum-quill"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
name := "enumeratum-quill",
version := "1.5.14-SNAPSHOT",
crossScalaVersions := post210Only(crossScalaVersions.value),
libraryDependencies ++= {
import org.scalajs.sbtplugin._
val cross = {
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
ScalaJSCrossVersion.binary
else
CrossVersion.binary
}
Seq(
impl.ScalaJSGroupID.withCross("io.getquill", "quill-core", cross) % quillVersion,
impl.ScalaJSGroupID.withCross("io.getquill", "quill-sql", cross) % quillVersion % Test,
impl.ScalaJSGroupID.withCross("com.beachape", "enumeratum", cross) % Versions.Core.stable
)
}
)
lazy val enumeratumQuillJs = enumeratumQuill.js
lazy val enumeratumQuillJvm = enumeratumQuill.jvm
lazy val enumeratumSlick =
Project(id = "enumeratum-slick", base = file("enumeratum-slick"))
.settings(commonWithPublishSettings: _*)
.settings(testSettings: _*)
.settings(
version := "1.5.16-SNAPSHOT",
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick" % theSlickVersion(scalaVersion.value),
"com.beachape" %% "enumeratum" % Versions.Core.stable,
"com.h2database" % "h2" % "1.4.197" % Test
)
)
lazy val commonSettings = Seq(
organization := "com.beachape",
scalafmtOnCompile := true,
scalaVersion := theScalaVersion,
crossScalaVersions := scalaVersions
) ++
compilerSettings ++
resolverSettings ++
ideSettings
lazy val commonSettingsWithTrimmings =
commonSettings ++
scoverageSettings
lazy val commonWithPublishSettings =
commonSettingsWithTrimmings ++
publishSettings
lazy val resolverSettings = Seq(
resolvers ++= Seq(
"Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/",
"Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases"
)
)
lazy val ideSettings = Seq(
// Faster "sbt gen-idea"
transitiveClassifiers in Global := Seq(Artifact.SourceClassifier)
)
lazy val compilerSettings = Seq(
scalaJSStage in ThisBuild := {
sys.props.get("sbt.scalajs.testOpt").orElse(sys.env.get("SCALAJS_TEST_OPT")) match {
case Some("full") => FullOptStage
case _ => FastOptStage
}
},
wartremoverErrors in (Compile, compile) ++= Warts.unsafe
.filterNot(_ == Wart.DefaultArguments) :+ Wart.ExplicitImplicitTypes,
scalacOptions in (Compile, compile) ++= {
val base = Seq(
"-Xlog-free-terms",
"-encoding",
"UTF-8", // yes, this is 2 args
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code", // N.B. doesn't work well with the ??? hole
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfuture"
)
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
base ++ Seq("-deprecation:false", "-Xlint:-unused,_") // unused-import breaks Circe Either shim
case Some((2, 11)) => base ++ Seq("-deprecation:false", "-Xlint", "-Ywarn-unused-import")
case _ => base ++ Seq("-Xlint")
}
}
)
lazy val scoverageSettings = Seq(
coverageExcludedPackages := """enumeratum\.EnumMacros;enumeratum\.ContextUtils;enumeratum\.ValueEnumMacros""",
coverageHighlighting := true
)
// Settings for publishing to Maven Central
lazy val publishSettings = Seq(
pomExtra :=
<url>https://github.com/lloydmeta/enumeratum</url>
<licenses>
<license>
<name>MIT</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>lloydmeta</id>
<name>Lloyd Chan</name>
<url>https://beachape.com</url>
</developer>
</developers>,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray),
publishMavenStyle := true,
publishArtifact in Test := false,
PgpKeys.pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray),
pomIncludeRepository := { _ =>
false
}
)
val testSettings = {
Seq(
libraryDependencies ++= {
import org.scalajs.sbtplugin._
val crossVersion =
if (ScalaJSPlugin.autoImport.jsDependencies.?.value.isDefined)
ScalaJSCrossVersion.binary
else
CrossVersion.binary
Seq(
impl.ScalaJSGroupID
.withCross("org.scalatest", "scalatest", crossVersion) % scalaTestVersion % Test,
impl.ScalaJSGroupID
.withCross("org.scalacheck", "scalacheck", crossVersion) % scalacheckVersion % Test force ()
)
},
doctestGenTests := {
val originalValue = doctestGenTests.value
if (isScalaJSProject.value)
Seq.empty
else
originalValue
},
doctestTestFramework := DoctestTestFramework.ScalaTest
)
}
lazy val benchmarking =
Project(id = "benchmarking", base = file("benchmarking"))
.settings(commonWithPublishSettings: _*)
.settings(
name := "benchmarking",
crossVersion := CrossVersion.binary,
// Do not publish
publishArtifact := false,
publishLocal := {}
)
.dependsOn((baseProjectRefs ++ integrationProjectRefs).map(ClasspathDependency(_, None)): _*)
.enablePlugins(JmhPlugin)
.settings(libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.7.21")
/**
* Helper function to add unmanaged source compat directories for different scala versions
*/
def withCompatUnmanagedSources(jsJvmCrossProject: Boolean,
include_210Dir: Boolean,
includeTestSrcs: Boolean): Seq[Setting[_]] = {
def compatDirs(projectbase: File, scalaVersion: String, isMain: Boolean) = {
val base = if (jsJvmCrossProject) projectbase / ".." else projectbase
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor)) if scalaMajor >= 11 =>
Seq(base / "compat" / "src" / (if (isMain) "main" else "test") / "scala-2.11")
.map(_.getCanonicalFile)
case Some((2, scalaMajor)) if scalaMajor == 10 && include_210Dir =>
Seq(base / "compat" / "src" / (if (isMain) "main" else "test") / "scala-2.10")
.map(_.getCanonicalFile)
case _ => Nil
}
}
val unmanagedMainDirsSetting = Seq(
unmanagedSourceDirectories in Compile ++= {
compatDirs(projectbase = baseDirectory.value,
scalaVersion = scalaVersion.value,
isMain = true)
}
)
if (includeTestSrcs) {
unmanagedMainDirsSetting ++ {
unmanagedSourceDirectories in Test ++= {
compatDirs(projectbase = baseDirectory.value,
scalaVersion = scalaVersion.value,
isMain = false)
}
}
} else {
unmanagedMainDirsSetting
}
}
/**
* Assumes that
*
* - a corresponding directory exists under ./aggregates.
* - publishing 2.10.x, 2.11.x, 2.12.x
*/
def aggregateProject(id: String, projects: ProjectReference*): Project =
Project(id = s"$id-aggregate", base = file(s"./aggregates/$id"))
.settings(commonWithPublishSettings: _*)
.settings(
crossScalaVersions := scalaVersions,
crossVersion := CrossVersion.binary,
// Do not publish the aggregate project (it just serves as an aggregate)
libraryDependencies += {
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
},
publishArtifact := false,
publishLocal := {}
)
.aggregate(projects: _*)
def post210Only(versions: Seq[String]): Seq[String] =
versions.filter { vString =>
CrossVersion.partialVersion(vString) match {
case Some((major, minor)) if major >= 2 && minor >= 11 => true
case _ => false
}
}