-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.sbt
222 lines (192 loc) · 7.81 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
import scala.xml.Elem
import scala.xml.transform.{RewriteRule, RuleTransformer}
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import ReleaseTransformations._
import scalariform.formatter.preferences._
import sbt.addCommandAlias
import sbtrelease.{Version, versionFormatError}
addCommandAlias("release", ";+publishSigned ;sonatypeReleaseAll")
val monixVersion = "3.4.0"
val appSettings = Seq(
name := "monix-nio",
organization := "io.monix",
scalaVersion := "2.13.3",
crossScalaVersions := Seq("2.12.12", "2.13.3", "3.0.2"),
scalacOptions ++= Seq(
// warnings
"-unchecked", // able additional warnings where generated code depends on assumptions
"-deprecation", // emit warning for usages of deprecated APIs
"-feature", // emit warning usages of features that should be imported explicitly
// Features enabled by default
"-language:higherKinds",
"-language:implicitConversions",
"-language:experimental.macros",
),
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
Seq(
// possibly deprecated options
"-Ywarn-dead-code"
)
case _ =>
Seq.empty
}),
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
// Linter
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
Seq(
// Turns all warnings into errors ;-)
// "-Xfatal-warnings",
// Enables linter options
"-Xlint:adapted-args", // warn if an argument list is modified to match the receiver
"-Xlint:nullary-unit", // warn when nullary methods return Unit
"-Xlint:inaccessible", // warn about inaccessible types in method signatures
"-Xlint:infer-any", // warn when a type argument is inferred to be `Any`
"-Xlint:missing-interpolator", // a string literal appears to be missing an interpolator id
"-Xlint:doc-detached", // a ScalaDoc comment appears to be detached from its element
"-Xlint:private-shadow", // a private field (or class parameter) shadows a superclass field
"-Xlint:type-parameter-shadow", // a local type parameter shadows a type already in scope
"-Xlint:poly-implicit-overload", // parametrized overloaded implicit methods are not visible as view bounds
"-Xlint:option-implicit", // Option.apply used implicit view
"-Xlint:delayedinit-select", // Selecting member of DelayedInit
"-Xlint:package-object-classes" // Class or object defined in package object
)
case _ =>
Seq.empty
}),
// Turning off fatal warnings for ScalaDoc, otherwise we can't release.
Compile / doc / scalacOptions ~= (_ filterNot (_ == "-Xfatal-warnings")),
// ScalaDoc settings
autoAPIMappings := true,
ThisBuild / scalacOptions ++= Seq(
// Note, this is used by the doc-source-url feature to determine the
// relative path of a given source file. If it's not a prefix of a the
// absolute path of the source file, the absolute path of that file
// will be put into the FILE_SOURCE variable, which is
// definitely not what we want.
"-sourcepath", file(".").getAbsolutePath.replaceAll("[.]$", "")
),
Test / parallelExecution := false,
IntegrationTest / parallelExecution := false,
Test / testForkedParallel := false,
IntegrationTest / testForkedParallel := false,
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1),
resolvers ++= Seq(
"Typesafe Releases" at "https://repo.typesafe.com/typesafe/releases",
Resolver.sonatypeRepo("releases")
),
update / evictionWarningOptions :=
EvictionWarningOptions.default
.withWarnTransitiveEvictions(false)
.withWarnDirectEvictions(false)
.withWarnScalaVersionEviction(false),
libraryDependencies ++= Seq(
"io.monix" %% "monix-reactive" % monixVersion,
"io.monix" %% "minitest" % "2.9.6" % Test
),
testFrameworks := Seq(new TestFramework("minitest.runner.Framework")),
updateOptions := updateOptions.value.withGigahorse(false),
// -- Settings meant for deployment on oss.sonatype.org
usePgpKeyHex("2673B174C4071B0E"),
pgpPublicRing := baseDirectory.value / "project" / ".gnupg" / "pubring.gpg",
pgpSecretRing := baseDirectory.value / "project" / ".gnupg" / "secring.gpg",
pgpPassphrase := sys.env.get("PGP_PASS").map(_.toArray),
publishMavenStyle := true,
releaseCrossBuild := true,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies, // : ReleaseStep
inquireVersions, // : ReleaseStep
runClean, // : ReleaseStep
runTest, // : ReleaseStep
publishArtifacts, // : ReleaseStep, checks whether `publishTo` is properly set up
),
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseVersion := { ver => Version(ver).map(_.string).getOrElse(versionFormatError(ver)) },
releaseNextVersion := { ver => Version(ver).map(_.string).getOrElse(versionFormatError(ver)) },
credentials += Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
sys.env.getOrElse("SONATYPE_USER", ""),
sys.env.getOrElse("SONATYPE_PASS", "")
),
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")
},
Test / publishArtifact := false,
pomIncludeRepository := { _ => false }, // removes optional dependencies
// For evicting Scoverage out of the generated POM
// See: https://github.com/scoverage/sbt-scoverage/issues/153
pomPostProcess := { (node: xml.Node) =>
new RuleTransformer(new RewriteRule {
override def transform(node: xml.Node): Seq[xml.Node] = node match {
case e: Elem
if e.label == "dependency" && e.child.exists(child => child.label == "groupId" && child.text == "org.scoverage") => Nil
case _ => Seq(node)
}
}).transform(node).head
},
pomExtra :=
<url>https://monix.io/</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:monix/monix.git</url>
<connection>scm:git:[email protected]:monix/monix.git</connection>
</scm>
<developers>
<developer>
<id>creyer</id>
<name>Sorin Chiprian</name>
<url>https://github.com/creyer</url>
</developer>
<developer>
<id>alex_ndc</id>
<name>Alexandru Nedelcu</name>
<url>https://alexn.org</url>
</developer>
<developer>
<id>radusw</id>
<name>Radu Gancea</name>
<url>https://github.com/radusw</url>
</developer>
</developers>
)
lazy val cmdlineProfile =
sys.props.getOrElse("sbt.profile", default = "")
def profile: Project ⇒ Project = pr => cmdlineProfile match {
case "coverage" => pr
case _ => pr.disablePlugins(scoverage.ScoverageSbtPlugin)
}
val formattingSettings = Seq(
scalariformAutoformat := true,
ScalariformKeys.preferences := ScalariformKeys
.preferences
.value
.setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true)
)
val monixNio = Project(id = "monix-nio", base = file("."))
.configure(profile)
.settings(appSettings)
.settings(formattingSettings)
val benchmark = Project(id = "monix-nio-benchmarks", base = file("benchmarks"))
.configure(profile)
.dependsOn(monixNio)
.enablePlugins(JmhPlugin)
.settings(formattingSettings)
.settings(
scalaVersion := "2.13.3",
publishArtifact := false,
Compile / packageDoc / publishArtifact := false,
Compile / packageSrc / publishArtifact := false,
Compile / packageBin / publishArtifact := false
)