-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
123 lines (100 loc) · 3.5 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
organization := "com.codecommit"
name := "cont-exp"
libraryDependencies += "org.scalaz" %% "scalaz-effect" % "7.2.10"
/*
* Compatibility version. Use this to declare what version with
* which `master` remains in compatibility. This is literally
* backwards from how -SNAPSHOT versioning works, but it avoids
* the need to pre-declare (before work is done) what kind of
* compatibility properties the next version will have (i.e. major
* or minor bump).
*
* As an example, the builds of a project might go something like
* this:
*
* - 0.1-hash1
* - 0.1-hash2
* - 0.1-hash3
* - 0.1
* - 0.1-hash1
* - 0.2-hash2
* - 0.2
* - 0.2-hash1
* - 0.2-hash2
* - 1.0-hash3
* - 1.0-hash4
* - 1.0
*
* The value of BaseVersion starts at 0.1 and remains there until
* compatibility with the 0.1 line is lost, which happens just
* prior to the release of 0.2. Then the base version again remains
* 0.2-compatible until that compatibility is broken, with the major
* version bump of 1.0. Again, this is all to avoid pre-committing
* to a major/minor bump before the work is done (see: Scala 2.8).
*/
val BaseVersion = "0.1"
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/"))
// bintrayVcsUrl := Some("...")
/***********************************************************************\
Boilerplate below these lines
\***********************************************************************/
coursierUseSbtCredentials := true
coursierChecksums := Nil // workaround for nexus sync bugs
credentials in bintray := {
if (isTravisBuild.value)
Nil
else
(credentials in bintray).value
}
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.3" cross CrossVersion.binary)
// Adapted from Rob Norris' post at https://tpolecat.github.io/2014/04/11/scalac-flags.html
scalacOptions ++= Seq(
"-language:_",
"-deprecation",
"-encoding", "UTF-8", // yes, this is 2 args
"-feature",
"-unchecked",
"-Xfatal-warnings",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-dead-code"
)
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, major)) if major >= 11 => Seq(
"-Ywarn-unused-import", // Not available in 2.10
"-Ywarn-numeric-widen" // In 2.10 this produces a some strange spurious error
)
case _ => Seq.empty
}
}
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, major)) if major >= 12 || scalaVersion.value == "2.11.9" =>
Seq("-Ypartial-unification")
case _ => Seq.empty
}
}
scalacOptions in Test += "-Yrangepos"
scalacOptions in (Compile, console) ~= (_ filterNot (Set("-Xfatal-warnings", "-Ywarn-unused-import").contains))
scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value
libraryDependencies ++= {
scalaVersion.value match {
case "2.11.8" => Seq(compilerPlugin("com.milessabin" % "si2712fix-plugin" % "1.2.0" cross CrossVersion.full))
case "2.10.6" => Seq(compilerPlugin("com.milessabin" % "si2712fix-plugin" % "1.2.0" cross CrossVersion.full))
case _ => Seq.empty
}
}
enablePlugins(GitVersioning)
val ReleaseTag = """^v([\d\.]+)$""".r
git.baseVersion := BaseVersion
git.gitTagToVersionNumber := {
case ReleaseTag(version) => Some(version)
case _ => None
}
git.formattedShaVersion := {
val suffix = git.makeUncommittedSignifierSuffix(git.gitUncommittedChanges.value, git.uncommittedSignifier.value)
git.gitHeadCommit.value map { _.substring(0, 7) } map { sha =>
git.baseVersion.value + "-" + sha + suffix
}
}