-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
199 lines (180 loc) · 6.3 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
import sbt.Keys.{libraryDependencies, scalacOptions, _}
import Common._
import Dependencies._
// shadow sbt-scalajs' crossProject and CrossType until Scala.js 1.0.0 is released
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import ReleaseTransformations._
organization in ThisBuild := "pl.msitko"
lazy val ast = (crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Pure) in file("ast"))
.commonSettings
.settings(
name := "xml-lens-ast"
)
.settings(publishSettings)
.jsSettings(
coverageEnabled := false
)
lazy val astJVM = ast.jvm
lazy val astJS = ast.js
lazy val testsCommon = (crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Pure) in file("tests-common"))
.commonSettings
.settings(
name := "xml-lens-tests-common",
libraryDependencies ++= Seq(scalacheck.value, scalaTest.value)
)
.dependsOn(ast)
lazy val testsCommonJVM = testsCommon.jvm
lazy val testsCommonJS = testsCommon.js
lazy val io = (crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Full) in file("io"))
.commonSettings
.settings(
name := "xml-lens-io"
)
.settings(publishSettings)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.jsSettings(
npmDependencies in Compile ++= Seq(
"@msitko/sax" -> "1.2.5-4"
),
// with `-Ywarn-dead-code` enabled `var onerror: js.Function1[js.Any, Unit] = js.native` fails
scalacOptions -= "-Ywarn-dead-code",
libraryDependencies += "com.lihaoyi" %%% "fastparse" % "2.0.4",
coverageEnabled := false
)
.dependsOn(ast, testsCommon % "test-internal->test")
lazy val ioJVM = io.jvm
lazy val ioJS = io.js
lazy val optics = (crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Full) in file("optics"))
.commonSettings
.settings(
name := "xml-lens-optics",
libraryDependencies ++= Seq(monocleCore.value, monocleLaw.value)
)
.settings(publishSettings)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.jsSettings(
coverageEnabled := false
)
.dependsOn(ast, testsCommon % "test-internal->test", io % "test-internal->test")
lazy val opticsJVM = optics.jvm
lazy val opticsJS = optics.js
lazy val bench = (project in file("bench"))
.commonSettings
.settings(
name := "xml-lens-bench",
libraryDependencies ++= Seq(scalaXml, scalaTest.value),
scalacOptions += "-Xlint:_,-missing-interpolator"
)
.settings(noPublishSettings)
.enablePlugins(JmhPlugin)
.dependsOn(opticsJVM, ioJVM)
lazy val examples = (project in file("examples"))
.commonSettings
.settings(
name := "xml-lens-examples",
libraryDependencies ++= Seq(scalaXml, scalaTest.value),
scalacOptions += "-Xlint:_,-missing-interpolator"
)
.settings(noPublishSettings)
.enablePlugins(JmhPlugin)
.dependsOn(opticsJVM, ioJVM)
lazy val docSettings = Seq(
micrositeName := "xml-lens",
micrositeDescription := "XML Optics library for Scala",
micrositeHomepage := "http://note.github.io/xml-lens",
micrositeBaseUrl := "/xml-lens",
micrositeDocumentationUrl := "/xml-lens/api",
micrositeGithubOwner := "note",
micrositeGithubRepo := "xml-lens",
micrositeGitterChannel := false,
autoAPIMappings := true,
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(astJVM, opticsJVM),
siteSubdirName in ScalaUnidoc := "api",
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc),
ghpagesNoJekyll := false,
fork in tut := true,
fork in (ScalaUnidoc, unidoc) := true,
git.remoteRepo := "git@github.com:note/xml-lens.git",
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md" | "*.svg",
micrositeDataDirectory := (resourceDirectory in Compile).value / "microsite" / "data",
micrositePushSiteWith := GitHub4s,
micrositeGithubToken := sys.env.get("GITHUB_TOKEN")
)
lazy val docs = (project in file("docs"))
.commonSettings
.settings(
name := "xml-lens-docs"
)
.settings(docSettings)
.settings(noPublishSettings)
.settings(scalacOptions in Tut := (scalacOptions in Tut).value.filterNot(Set("-Ywarn-unused-import", "-Xfatal-warnings", "-Xlint")))
.enablePlugins(GhpagesPlugin)
.enablePlugins(MicrositesPlugin)
.enablePlugins(ScalaUnidocPlugin)
.dependsOn(astJVM, ioJVM, opticsJVM)
lazy val root = (project in file("."))
.commonSettings
.settings(
name := "xml-lens"
)
.settings(noPublishSettings)
.aggregate(astJVM, astJS, ioJVM, ioJS, opticsJVM, opticsJS)
lazy val publishSettings = Seq(
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
homepage := Some(url("https://github.com/note/xml-lens")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
scmInfo := Some(ScmInfo(url("https://github.com/note/xml-lens"), "scm:git:git@github.com:note/xml-lens.git")),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
useGpg := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("Snapshots" at nexus + "content/repositories/snapshots")
else
Some("Releases" at nexus + "service/local/staging/deploy/maven2")
},
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommand("sonatypeReleaseAll"),
pushChanges
),
pomExtra := (
<developers>
<developer>
<id>note</id>
<name>Michał Sitko</name>
<url>https://github.com/note/</url>
</developer>
</developers>
)
) ++ credentialSettings
lazy val credentialSettings = Seq(
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
)
lazy val noPublishSettings = Seq(
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("Snapshots" at nexus + "content/repositories/snapshots")
else
Some("Releases" at nexus + "service/local/staging/deploy/maven2")
},
publish := {},
publishLocal := {},
publishArtifact := false
)