forked from monix/monix-bio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
254 lines (231 loc) · 8.11 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
import sbtcrossproject.CrossPlugin.autoImport.crossProject
addCommandAlias("ci-js", s";clean ;coreJS/test")
addCommandAlias("ci-jvm", s";clean ;benchmarks/compile ;coreJVM/test")
val monixVersion = "3.1.0"
val minitestVersion = "2.7.0"
val catsVersion = "2.0.0"
val catsEffectVersion = "2.0.0"
lazy val `monix-bio` = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(releaseSettings, skipOnPublishSettings)
.aggregate(coreJVM, coreJS)
lazy val core = crossProject(JSPlatform, JVMPlatform)
.in(file("core"))
.settings(crossSettings ++ crossVersionSharedSources ++ releaseSettings)
.settings(Seq(name := "monix-bio"))
.enablePlugins(AutomateHeaderPlugin)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val benchmarks = project.in(file("benchmarks"))
.dependsOn(coreJVM)
.enablePlugins(JmhPlugin)
.settings(doNotPublishArtifact)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "1.0.0-RC17",
"io.monix" %% "monix-eval" % "3.1.0"
))
lazy val contributors = Seq(
"Avasil" -> "Piotr Gawrys"
)
lazy val doNotPublishArtifact = Seq(
publishArtifact := false,
publishArtifact in (Compile, packageDoc) := false,
publishArtifact in (Compile, packageSrc) := false,
publishArtifact in (Compile, packageBin) := false
)
def priorTo2_13(scalaVersion: String): Boolean =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, minor)) if minor < 13 => true
case _ => false
}
// General Settings
lazy val sharedSettings = Seq(
organization := "io.monix",
scalaVersion := "2.13.1",
crossScalaVersions := Seq("2.12.10", "2.13.1"),
scalacOptions ++= compilerOptions,
scalacOptions ++= (
if (priorTo2_13(scalaVersion.value))
Seq(
"-Xfuture",
"-Yno-adapted-args",
"-Ywarn-unused-import"
)
else
Seq(
"-Ywarn-unused:imports"
)
),
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.11.0" cross CrossVersion.full),
testFrameworks := Seq(new TestFramework("minitest.runner.Framework")),
libraryDependencies ++= Seq(
"io.monix" %%% "monix-catnap" % monixVersion,
"io.monix" %%% "minitest" % minitestVersion % Test,
"io.monix" %%% "minitest-laws" % minitestVersion % Test,
"org.typelevel" %%% "cats-effect-laws" % catsEffectVersion % Test
),
headerLicense := Some(HeaderLicense.Custom(
"""|Copyright (c) 2019-2019 by The Monix Project Developers.
|See the project homepage at: https://monix.io
|
|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."""
.stripMargin))
)
val compilerOptions = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-unchecked",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-language:implicitConversions",
"-language:experimental.macros"
)
lazy val crossSettings = sharedSettings ++ Seq(
unmanagedSourceDirectories in Compile += {
baseDirectory.value.getParentFile / "shared" / "src" / "main" / "scala"
},
unmanagedSourceDirectories in Test += {
baseDirectory.value.getParentFile / "shared" / "src" / "test" / "scala"
}
)
def scalaPartV = Def setting (CrossVersion partialVersion scalaVersion.value)
lazy val crossVersionSharedSources: Seq[Setting[_]] =
Seq(Compile, Test).map { sc =>
(unmanagedSourceDirectories in sc) ++= {
(unmanagedSourceDirectories in sc).value.flatMap { dir =>
Seq(
scalaPartV.value match {
case Some((2, y)) if y == 11 => new File(dir.getPath + "_2.11")
case Some((2, y)) if y == 12 => new File(dir.getPath + "_2.12")
case Some((2, y)) if y >= 13 => new File(dir.getPath + "_2.13")
},
scalaPartV.value match {
case Some((2, n)) if n >= 12 => new File(dir.getPath + "_2.12+")
case _ => new File(dir.getPath + "_2.12-")
},
scalaPartV.value match {
case Some((2, n)) if n >= 13 => new File(dir.getPath + "_2.13+")
case _ => new File(dir.getPath + "_2.13-")
},
)
}
}
}
lazy val scalaJSSettings = Seq(
// Use globally accessible (rather than local) source paths in JS source maps
scalacOptions += {
val tagOrHash =
if (isSnapshot.value) git.gitHeadCommit.value.get
else s"v${git.baseVersion.value}"
val l = (baseDirectory in LocalRootProject).value.toURI.toString
val g = s"https://raw.githubusercontent.com/monix/monix-bio/$tagOrHash/"
s"-P:scalajs:mapSourceURI:$l->$g"
}
)
lazy val releaseSettings = {
import ReleaseTransformations._
Seq(
releaseCrossBuild := true,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
// For non cross-build projects, use releaseStepCommand("publishSigned")
releaseStepCommandAndRemaining("+publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommand("sonatypeReleaseAll"),
pushChanges
),
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")
},
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,
publishArtifact in Test := false,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
scmInfo := Some(
ScmInfo(
url("https://github.com/monix/monix-bio"),
"[email protected]:monix/monix-bio.git"
)
),
homepage := Some(url("https://github.com/monix/monix-bio")),
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
publishMavenStyle := true,
pomIncludeRepository := { _ =>
false
},
pomExtra := {
<developers>
{for ((username, name) <- contributors) yield
<developer>
<id>{username}</id>
<name>{name}</name>
<url>http://github.com/{username}</url>
</developer>
}
</developers>
},
headerLicense := Some(HeaderLicense.Custom(
"""|Copyright (c) 2019-2019 by The Monix Project Developers.
|See the project homepage at: https://monix.io
|
|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."""
.stripMargin)),
)
}
lazy val skipOnPublishSettings = Seq(
skip in publish := true,
publish := (()),
publishLocal := (()),
publishArtifact := false,
publishTo := None
)
/* The BaseVersion setting represents the in-development (upcoming) version,
* as an alternative to SNAPSHOTS.
*/
git.baseVersion := (version in ThisBuild).value