This repository has been archived by the owner on Sep 25, 2020. It is now read-only.
forked from rallyhealth/scalacheck-ops
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sbt
102 lines (84 loc) · 3.56 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
// Aggregate root project settings only
name := "scalacheck-ops-root"
// don't publish the aggregate root project
publish := {}
publishLocal := {}
organization in ThisBuild := "com.rallyhealth"
semVerLimit in ThisBuild := "2.0.999"
scalaVersion in ThisBuild := "2.11.11"
licenses in ThisBuild += ("Apache-2.0", url("http://opensource.org/licenses/apache-2.0"))
/**
* Choose one value or another based on the version of scalacheck.
*/
def basedOnVersion[T](version: String, old: T, latest: T): T = {
if (version startsWith "1.12.") old else latest
}
def commonProject(id: String, artifact: String, path: String): Project = {
Project(id, file(path)).settings(
name := artifact,
scalacOptions := Seq(
"-Xfatal-warnings",
"-deprecation:false",
"-feature",
"-Xlint",
"-Ywarn-dead-code",
"-encoding", "UTF-8"
),
// show full stack traces in test failures ()
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oF"),
// force scala version
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
// disable compilation of ScalaDocs, since this always breaks on links and isn't as helpful as source
sources in(Compile, doc) := Seq.empty,
// disable publishing empty ScalaDocs
publishArtifact in (Compile, packageDoc) := false
).enablePlugins(GitVersioningPlugin, SemVerPlugin)
}
def suffixFor(scalaCheckVersion: String): String = scalaCheckVersion match {
case Dependencies.scalaCheck12Version => "_1-12"
case Dependencies.scalaCheck13Version => "_1-13"
case Dependencies.scalaCheck14Version => "_1-14"
}
def coreProject(scalaCheckVersion: String): Project = {
val projectPath = "core"
val suffix = suffixFor(scalaCheckVersion)
commonProject(s"core$suffix", s"scalacheck-ops$suffix", s"$projectPath$suffix").settings(
sourceDirectory := file(s"$projectPath/src").getAbsoluteFile,
(sourceDirectory in Compile) := file(s"$projectPath/src/main").getAbsoluteFile,
(sourceDirectory in Test) := file(s"$projectPath/src/test").getAbsoluteFile,
libraryDependencies ++= Seq(
Dependencies.scalaCheck(scalaCheckVersion)
) ++ Seq(
// Test-only dependencies
Dependencies.scalaTest(scalaCheckVersion)
).map(_ % Test)
)
}
lazy val `core_1-12` = coreProject(Dependencies.scalaCheck12Version)
lazy val `core_1-13` = coreProject(Dependencies.scalaCheck13Version)
lazy val `core_1-14` = coreProject(Dependencies.scalaCheck14Version)
def jodaProject(scalaCheckVersion: String): Project = {
val projectPath = "joda"
val suffix = suffixFor(scalaCheckVersion)
commonProject(s"joda$suffix", s"scalacheck-ops-joda$suffix", s"$projectPath$suffix").settings(
sourceDirectory := file(s"$projectPath/src").getAbsoluteFile,
(sourceDirectory in Compile) := file(s"$projectPath/src/main").getAbsoluteFile,
(sourceDirectory in Test) := file(s"$projectPath/src/test").getAbsoluteFile,
libraryDependencies ++= Seq(
Dependencies.scalaCheck(scalaCheckVersion),
Dependencies.jodaTime
) ++ Seq(
// Test-only dependencies
Dependencies.scalaTest(scalaCheckVersion)
).map(_ % Test)
).dependsOn(
(scalaCheckVersion match {
case Dependencies.scalaCheck12Version => `core_1-12`
case Dependencies.scalaCheck13Version => `core_1-13`
case Dependencies.scalaCheck14Version => `core_1-14`
}) % "compile;test->test"
)
}
lazy val `joda_1-12` = jodaProject(Dependencies.scalaCheck12Version)
lazy val `joda_1-13` = jodaProject(Dependencies.scalaCheck13Version)
lazy val `joda_1-14` = jodaProject(Dependencies.scalaCheck14Version)