forked from rallyhealth/scalacheck-ops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
114 lines (94 loc) · 3.9 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
import Dependencies._
// Aggregate root project settings only
name := "scalacheck-ops-root"
ThisBuild / gitVersioningSnapshotLowerBound := "2.5.0"
ThisBuild / organization := "com.rallyhealth"
ThisBuild / organizationName := "Rally Health"
ThisBuild / scalaVersion := Scala_2_11
ThisBuild / licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT"))
ThisBuild / bintrayOrganization := Some("rallyhealth")
ThisBuild / bintrayRepository := "maven"
ThisBuild / resolvers += Resolver.bintrayRepo("rallyhealth", "maven")
// don't publish the aggregate root project
publish := {}
publishLocal := {}
def commonProject(id: String, artifact: String, path: String): Project = {
Project(id, file(path)).settings(
name := artifact,
scalacOptions := Seq(
// "-Xfatal-warnings", // some methods in Scala 2.13 are deprecated, but I don't want to maintain to copies of source
"-deprecation:false",
"-feature",
"-Xlint",
"-Ywarn-dead-code",
"-encoding", "UTF-8"
),
// show full stack traces in test failures ()
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oF"),
// disable compilation of ScalaDocs, since this always breaks on links and isn't as helpful as source
Compile / doc / sources := Seq.empty,
// disable publishing empty ScalaDocs
Compile / packageDoc / publishArtifact := false
).enablePlugins(GitVersioningPlugin, SemVerPlugin)
}
def scSuffix(scalaCheckVersion: String): String = scalaCheckVersion match {
case ScalaCheck_1_12 => "_1-12"
case ScalaCheck_1_13 => "_1-13"
case ScalaCheck_1_14 => "_1-14"
}
def scalaVersions(scalaCheckVersion: String): Seq[String] = scalaCheckVersion match {
case ScalaCheck_1_12 => Seq(Scala_2_11)
case ScalaCheck_1_13 => Seq(Scala_2_11, Scala_2_12)
case ScalaCheck_1_14 => Seq(Scala_2_11, Scala_2_12, Scala_2_13)
}
def coreProject(srcPath: File, scalaCheckVersion: String): Project = {
val suffix = scSuffix(scalaCheckVersion)
val targetPath = s"core$suffix"
commonProject(targetPath, s"scalacheck-ops$suffix", targetPath).settings(
scalaVersion := crossScalaVersions.value.head,
crossScalaVersions := scalaVersions(scalaCheckVersion),
sourceDirectory := (srcPath / "src").getAbsoluteFile,
Compile / sourceDirectory := (srcPath / "src" / "main").getAbsoluteFile,
Test / sourceDirectory := (srcPath / "src" / "test").getAbsoluteFile,
libraryDependencies ++= Seq(
scalaCheck(scalaCheckVersion),
tagging
) ++ Seq(
// Test-only dependencies
scalaTest(scalaCheckVersion)
).map(_ % Test)
)
}
lazy val `core_1-12` = coreProject(file("core_1-12"), ScalaCheck_1_12)
.settings(
semVerEnforceAfterVersion := Some("2.5.1"),
)
lazy val `core_1-13` = coreProject(file("core"), ScalaCheck_1_13)
lazy val `core_1-14` = coreProject(file("core"), ScalaCheck_1_14)
def jodaProject(scalaCheckVersion: String): Project = {
val projectPath = "joda"
val suffix = scSuffix(scalaCheckVersion)
commonProject(s"joda$suffix", s"scalacheck-ops-joda$suffix", s"$projectPath$suffix").settings(
scalaVersion := crossScalaVersions.value.head,
crossScalaVersions := scalaVersions(scalaCheckVersion),
sourceDirectory := file(s"$projectPath/src").getAbsoluteFile,
Compile / sourceDirectory := file(s"$projectPath/src/main").getAbsoluteFile,
Test / sourceDirectory := file(s"$projectPath/src/test").getAbsoluteFile,
libraryDependencies ++= Seq(
scalaCheck(scalaCheckVersion),
jodaTime
) ++ Seq(
// Test-only dependencies
scalaTest(scalaCheckVersion)
).map(_ % Test)
).dependsOn(
(scalaCheckVersion match {
case ScalaCheck_1_12 => `core_1-12`
case ScalaCheck_1_13 => `core_1-13`
case ScalaCheck_1_14 => `core_1-14`
}) % "compile;test->test"
)
}
lazy val `joda_1-12` = jodaProject(ScalaCheck_1_12)
lazy val `joda_1-13` = jodaProject(ScalaCheck_1_13)
lazy val `joda_1-14` = jodaProject(ScalaCheck_1_14)