forked from typelevel/cats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
195 lines (174 loc) · 6.71 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
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
import com.typesafe.sbt.SbtSite.SiteKeys._
import com.typesafe.sbt.SbtGhPages.GhPagesKeys._
import pl.project13.scala.sbt.SbtJmh._
import sbtunidoc.Plugin.UnidocKeys._
import ScoverageSbtPlugin._
lazy val scoverageSettings = Seq(
ScoverageKeys.coverageMinimum := 60,
ScoverageKeys.coverageFailOnMinimum := false,
ScoverageKeys.coverageHighlighting := scalaBinaryVersion.value != "2.10",
ScoverageKeys.coverageExcludedPackages := "cats\\.bench\\..*"
)
lazy val buildSettings = Seq(
organization := "org.spire-math",
scalaVersion := "2.11.7",
crossScalaVersions := Seq("2.10.5", "2.11.7")
)
lazy val commonSettings = Seq(
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:experimental.macros",
"-unchecked",
"-Xfatal-warnings",
"-Xlint",
"-Yinline-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfuture"
) ++ (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 11)) => Seq("-Ywarn-unused-import")
case _ => Seq.empty
}),
scalacOptions in (Compile, console) ~= (_ filterNot (_ == "-Ywarn-unused-import")),
scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value,
resolvers ++= Seq(
"bintray/non" at "http://dl.bintray.com/non/maven",
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
),
libraryDependencies ++= Seq(
"com.github.mpilquist" %% "simulacrum" % "0.3.0",
"org.spire-math" %% "algebra" % "0.2.1",
"org.typelevel" %% "machinist" % "0.3.0",
compilerPlugin("org.scalamacros" % "paradise" % "2.1.0-M5" cross CrossVersion.full),
compilerPlugin("org.spire-math" %% "kind-projector" % "0.5.4")
),
scmInfo := Some(ScmInfo(url("https://github.com/non/cats"),
"scm:git:git@github.com:non/cats.git"))
)
lazy val catsSettings = buildSettings ++ commonSettings ++ publishSettings ++ scoverageSettings
lazy val disciplineDependencies = Seq(
"org.scalacheck" %% "scalacheck" % "1.12.4",
"org.typelevel" %% "discipline" % "0.3"
)
lazy val docSettings = Seq(
autoAPIMappings := true,
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(core, free, std, state),
site.addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), "api"),
site.addMappingsToSiteDir(tut, "_tut"),
ghpagesNoJekyll := false,
siteMappings += file("CONTRIBUTING.md") -> "contributing.md",
scalacOptions in (ScalaUnidoc, unidoc) ++= Seq(
"-doc-source-url", scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",
"-sourcepath", baseDirectory.in(LocalRootProject).value.getAbsolutePath
),
git.remoteRepo := "git@github.com:non/cats.git",
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md"
)
lazy val docs = project
.settings(moduleName := "cats-docs")
.settings(catsSettings)
.settings(noPublishSettings)
.settings(unidocSettings)
.settings(site.settings)
.settings(ghpages.settings)
.settings(docSettings)
.settings(tutSettings)
.settings(tutScalacOptions ~= (_.filterNot(_ == "-Ywarn-unused-import")))
.dependsOn(core, std, free, state)
lazy val cats = project.in(file("."))
.settings(moduleName := "cats")
.settings(catsSettings)
.aggregate(macros, core, laws, free, std, state, tests, docs, bench)
.dependsOn(macros, core, laws, free, std, state % "compile;test-internal -> test",
tests % "test-internal -> test", bench % "compile-internal;test-internal -> test")
lazy val macros = project
.settings(moduleName := "cats-macros")
.settings(catsSettings)
lazy val core = project.dependsOn(macros)
.settings(moduleName := "cats-core")
.settings(catsSettings)
.settings(
sourceGenerators in Compile <+= (sourceManaged in Compile).map(Boilerplate.gen)
)
lazy val laws = project.dependsOn(macros, core, std)
.settings(moduleName := "cats-laws")
.settings(catsSettings)
.settings(
libraryDependencies ++= disciplineDependencies ++ Seq(
"org.spire-math" %% "algebra-laws" % "0.2.1"
)
)
lazy val std = project.dependsOn(macros, core)
.settings(moduleName := "cats-std")
.settings(catsSettings)
.settings(
libraryDependencies += "org.spire-math" %% "algebra-std" % "0.2.1"
)
lazy val tests = project.dependsOn(macros, core, std, laws)
.settings(moduleName := "cats-tests")
.settings(catsSettings)
.settings(noPublishSettings)
.settings(
libraryDependencies ++= disciplineDependencies ++ Seq(
"org.scalatest" %% "scalatest" % "2.2.5" % "test"
)
)
lazy val bench = project.dependsOn(macros, core, free, std, laws)
.settings(moduleName := "cats-bench")
.settings(catsSettings)
.settings(noPublishSettings)
.settings(jmhSettings)
lazy val free = project.dependsOn(macros, core, tests % "test-internal -> test")
.settings(moduleName := "cats-free")
.settings(catsSettings)
lazy val state = project.dependsOn(macros, core, free, tests % "test-internal -> test")
.settings(moduleName := "cats-state")
.settings(catsSettings)
lazy val publishSettings = Seq(
homepage := Some(url("https://github.com/non/cats")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
autoAPIMappings := true,
apiURL := Some(url("https://non.github.io/cats/api/")),
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
publishTo <<= version { (v: String) =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pomExtra := (
<developers>
<developer>
<id>non</id>
<name>Erik Osheim</name>
<url>http://github.com/non/</url>
</developer>
</developers>
)
)
lazy val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)
addCommandAlias("validate", ";compile;test;scalastyle;test:scalastyle;unidoc;tut")
addCommandAlias("gitSnapshots", ";set version in ThisBuild := git.gitDescribedVersion.value.get + \"-SNAPSHOT\"")
// For Travis CI - see http://www.cakesolutions.net/teamblogs/publishing-artefacts-to-oss-sonatype-nexus-using-sbt-and-travis-ci
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq