forked from optics-dev/Monocle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
209 lines (185 loc) · 7.28 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import com.typesafe.sbt.SbtGhPages.GhPagesKeys._
import com.typesafe.sbt.SbtSite.SiteKeys._
import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
import sbt.Keys._
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
import sbtunidoc.Plugin.UnidocKeys._
lazy val buildSettings = Seq(
organization := "com.github.julien-truffaut",
scalaVersion := "2.11.7",
crossScalaVersions := Seq("2.10.6", "2.11.7"),
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-language:implicitConversions", "-language:higherKinds", "-language:postfixOps",
"-unchecked",
"-Xfatal-warnings",
"-Yinline-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-value-discard",
"-Xfuture"
),
resolvers ++= Seq(
"bintray/non" at "http://dl.bintray.com/non/maven",
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
),
scmInfo := Some(ScmInfo(url("https://github.com/julien-truffaut/Monocle"), "scm:git:[email protected]:julien-truffaut/Monocle.git"))
)
lazy val scalaz = "org.scalaz" %% "scalaz-core" % "7.1.4"
lazy val shapeless = "com.chuusai" %% "shapeless" % "2.2.5"
lazy val discpline = "org.typelevel" %% "discipline" % "0.3"
lazy val scalatest = "org.scalatest" %% "scalatest" % "2.2.4" % "test"
lazy val macroCompat = "org.typelevel" %% "macro-compat" % "1.0.6"
lazy val macroVersion = "2.1.0-M5"
lazy val paradisePlugin = compilerPlugin("org.scalamacros" % "paradise" % macroVersion cross CrossVersion.full)
def mimaSettings(module: String): Seq[Setting[_]] = mimaDefaultSettings ++ Seq(
previousArtifact := Some("com.github.julien-truffaut" % (s"monocle-${module}_2.11") % "1.1.0")
)
lazy val monocleSettings = buildSettings ++ publishSettings
lazy val monocle = project.in(file("."))
.settings(moduleName := "monocle")
.settings(monocleSettings)
.aggregate(core, generic, law, macros, state, test, example, docs, bench)
.dependsOn(core, generic, law, macros, state, test % "test-internal -> test", bench % "compile-internal;test-internal -> test")
lazy val core = project
.settings(moduleName := "monocle-core")
.settings(monocleSettings)
.settings(mimaSettings("core"))
.settings(libraryDependencies := Seq(scalaz))
lazy val generic = project.dependsOn(core)
.settings(moduleName := "monocle-generic")
.settings(monocleSettings)
.settings(mimaSettings("generic"))
.settings(libraryDependencies := Seq(scalaz, shapeless))
lazy val law = project.dependsOn(core)
.settings(moduleName := "monocle-law")
.settings(monocleSettings)
.settings(libraryDependencies := Seq(discpline))
lazy val macros = project.dependsOn(core)
.in(file("macro"))
.settings(moduleName := "monocle-macro")
.settings(monocleSettings)
.settings(Seq(
scalacOptions += "-language:experimental.macros",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "provided",
macroCompat
),
addCompilerPlugin(paradisePlugin),
libraryDependencies ++= CrossVersion partialVersion scalaVersion.value collect {
case (2, scalaMajor) if scalaMajor < 11 => Seq("org.scalamacros" %% "quasiquotes" % macroVersion)
} getOrElse Nil,
unmanagedSourceDirectories in Compile += (sourceDirectory in Compile).value / s"scala-${scalaBinaryVersion.value}"
))
lazy val state = project.dependsOn(core)
.settings(moduleName := "monocle-state")
.settings(monocleSettings)
.settings(libraryDependencies := Seq(scalaz))
lazy val test = project.dependsOn(core, generic, macros, law, state)
.settings(moduleName := "monocle-test")
.settings(monocleSettings)
.settings(noPublishSettings)
.settings(
libraryDependencies ++= Seq(scalaz, shapeless, scalatest, compilerPlugin(paradisePlugin))
)
lazy val bench = project.dependsOn(core, macros)
.settings(moduleName := "monocle-bench")
.settings(monocleSettings)
.settings(noPublishSettings)
.settings(libraryDependencies ++= Seq(
shapeless,
compilerPlugin(paradisePlugin)
)).enablePlugins(JmhPlugin)
lazy val example = project.dependsOn(core, generic, macros, state, test % "test->test")
.settings(moduleName := "monocle-example")
.settings(monocleSettings)
.settings(noPublishSettings)
.settings(
libraryDependencies ++= Seq(scalaz, shapeless, scalatest, compilerPlugin(paradisePlugin))
)
lazy val docs = project.dependsOn(core, example)
.settings(moduleName := "monocle-docs")
.settings(monocleSettings)
.settings(noPublishSettings)
.settings(unidocSettings)
.settings(site.settings)
.settings(ghpages.settings)
.settings(docSettings)
.settings(tutSettings)
.settings(
libraryDependencies ++= Seq(scalaz, shapeless, compilerPlugin(paradisePlugin))
)
lazy val docSettings = Seq(
autoAPIMappings := true,
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(core),
site.addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), "api"),
site.addMappingsToSiteDir(tut, "_tut"),
ghpagesNoJekyll := false,
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 := "[email protected]:julien-truffaut/Monocle.git",
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md"
)
lazy val publishSettings = Seq(
homepage := Some(url("https://github.com/julien-truffaut/Monocle")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
autoAPIMappings := true,
apiURL := Some(url("https://julien-truffaut.github.io/Monocle/api/")),
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>julien-truffaut</id>
<name>Julien Truffaut</name>
</developer>
<developer>
<id>NightRa</id>
<name>Ilan Godik</name>
</developer>
<developer>
<id>aoiroaoino</id>
<name>Naoki Aoyama</name>
</developer>
</developers>
),
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion,
pushChanges
)
)
lazy val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)
addCommandAlias("validate", ";compile;test;unidoc;tut")
// 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