-
Notifications
You must be signed in to change notification settings - Fork 511
/
build.sbt
194 lines (159 loc) · 5.95 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
/*
* Copyright 2017 Daniel Spiewak
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import de.heikoseeberger.sbtheader.license.Apache2_0
organization in ThisBuild := "org.typelevel"
val CatsVersion = "0.9.0"
val ScalaCheckVersion = "1.13.4"
val DisciplineVersion = "0.7.3"
val commonSettings = Seq(
scalacOptions in (Compile, console) ~= (_ filterNot (Set("-Xfatal-warnings", "-Ywarn-unused-import").contains)),
headers := Map(
"scala" -> Apache2_0("2017", "Daniel Spiewak"),
"java" -> Apache2_0("2017", "Daniel Spiewak")))
lazy val root = project.in(file("."))
.aggregate(coreJVM, coreJS, lawsJVM, lawsJS)
.settings(
publish := (),
publishLocal := (),
publishArtifact := false)
lazy val core = crossProject
.in(file("core"))
.settings(commonSettings: _*)
.settings(
name := "cats-effect",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % CatsVersion,
"com.github.mpilquist" %%% "simulacrum" % "0.10.0",
"org.typelevel" %%% "cats-laws" % CatsVersion % "test",
"org.scalatest" %%% "scalatest" % "3.0.1" % "test",
"org.scalacheck" %%% "scalacheck" % ScalaCheckVersion % "test",
"org.typelevel" %%% "discipline" % DisciplineVersion % "test"),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full))
.jvmConfigure(_.enablePlugins(AutomateHeaderPlugin))
.jsConfigure(_.enablePlugins(AutomateHeaderPlugin))
lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val laws = crossProject
.in(file("laws"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings: _*)
.settings(
name := "cats-effect-laws",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-laws" % CatsVersion,
"org.scalacheck" %%% "scalacheck" % ScalaCheckVersion,
"org.typelevel" %%% "discipline" % DisciplineVersion,
"org.scalatest" %%% "scalatest" % "3.0.1" % "test"))
.jvmConfigure(_.enablePlugins(AutomateHeaderPlugin))
.jsConfigure(_.enablePlugins(AutomateHeaderPlugin))
lazy val lawsJVM = laws.jvm
lazy val lawsJS = laws.js
/*
* 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 in ThisBuild += ("Apache-2.0", url("http://www.apache.org/licenses/"))
// bintrayVcsUrl := Some("...")
/***********************************************************************\
Boilerplate below these lines
\***********************************************************************/
coursierUseSbtCredentials in ThisBuild := true
coursierChecksums in ThisBuild := 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 in ThisBuild ++= Seq(
"-language:_",
"-deprecation",
"-encoding", "UTF-8", // yes, this is 2 args
"-feature",
"-unchecked",
"-Xfatal-warnings",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-dead-code"
)
scalacOptions in ThisBuild ++= {
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 in ThisBuild ++= {
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 (Test, console) := (scalacOptions in (Compile, console)).value
libraryDependencies in ThisBuild ++= {
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
}
}