This repository has been archived by the owner on Jun 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.sbt
151 lines (138 loc) · 4.95 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
import sbtrelease.Version
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
lazy val contributors = Seq(
"pchiusano" -> "Paul Chiusano",
"pchlupacek" -> "Pavel Chlupáček",
"alissapajer" -> "Alissa Pajer",
"djspiewak" -> "Daniel Spiewak",
"fthomas" -> "Frank Thomas",
"runarorama" -> "Rúnar Ó. Bjarnason",
"jedws" -> "Jed Wesley-Smith",
"wookietreiber" -> "Christian Krause",
"mpilquist" -> "Michael Pilquist",
"guersam" -> "Jisoo Park"
)
val catsVersion = "1.0.0-RC1"
def scmBranch(v: String): String = {
val Some(ver) = Version(v)
s"v${ver.string}"
}
lazy val commonSettings = Seq(
name := "fs2-cats",
organization := "co.fs2",
scalaVersion := "2.11.11",
crossScalaVersions := Seq("2.11.11", "2.12.4"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-language:implicitConversions",
"-language:higherKinds",
"-language:existentials",
"-language:postfixOps",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-value-discard",
"-Ywarn-unused-import"
),
scalacOptions in (Compile, console) ~= {_.filterNot("-Ywarn-unused-import" == _)},
scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value,
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-core" % "0.9.7",
"org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "cats-laws" % catsVersion % "test",
"org.typelevel" %%% "cats-effect" % "0.5"
),
scmInfo := Some(ScmInfo(url("https://github.com/functional-streams-for-scala/fs2-cats"), "[email protected]:functional-streams-for-scala/fs2-cats.git")),
homepage := Some(url("https://github.com/functional-streams-for-scala/fs2")),
licenses += ("MIT", url("http://opensource.org/licenses/MIT")),
initialCommands := s"""
import fs2._
import fs2.interop.cats._
import cats._
import cats.implicits._
""",
resolvers += "Sonatype Public" at "https://oss.sonatype.org/content/groups/public/",
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.3" cross CrossVersion.binary)
) ++ testSettings ++ scaladocSettings ++ publishingSettings ++ releaseSettings
lazy val testSettings = Seq(
parallelExecution in Test := false,
logBuffered in Test := false,
testOptions in Test += Tests.Argument("-verbosity", "2"),
testOptions in Test += Tests.Argument("-minSuccessfulTests", "500"),
publishArtifact in Test := true
)
lazy val scaladocSettings = Seq(
scalacOptions in (Compile, doc) ++= Seq(
"-doc-source-url", s"${scmInfo.value.get.browseUrl}/tree/${scmBranch(version.value)}€{FILE_PATH}.scala",
"-sourcepath", baseDirectory.in(LocalRootProject).value.getAbsolutePath,
"-implicits",
"-implicits-show-all"
),
scalacOptions in (Compile, doc) ~= (_.filterNot(_ == "-Xfatal-warnings")),
autoAPIMappings := true
)
lazy val publishingSettings = Seq(
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT"))
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,
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>
},
pomPostProcess := { node =>
import scala.xml._
import scala.xml.transform._
def stripIf(f: Node => Boolean) = new RewriteRule {
override def transform(n: Node) =
if (f(n)) NodeSeq.Empty else n
}
val stripTestScope = stripIf { n => n.label == "dependency" && (n \ "scope").text == "test" }
new RuleTransformer(stripTestScope).transform(node)(0)
}
)
lazy val releaseSettings = Seq(
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value
)
lazy val commonJsSettings = Seq(
requiresDOM := false,
scalaJSStage in Test := FastOptStage,
jsEnv in Test := new org.scalajs.jsenv.nodejs.NodeJSEnv(),
scalacOptions in Compile += {
val dir = project.base.toURI.toString.replaceFirst("[^/]+/?$", "")
val url = s"https://raw.githubusercontent.com/functional-streams-for-scala/fs2-cats"
s"-P:scalajs:mapSourceURI:$dir->$url/${scmBranch(version.value)}/"
}
)
lazy val noPublish = Seq(
publish := (),
publishLocal := (),
publishSigned := (),
publishArtifact := false
)
lazy val root = project.in(file(".")).
settings(commonSettings).
settings(noPublish).
aggregate(fs2CatsJVM, fs2CatsJS)
lazy val fs2Cats = crossProject.in(file(".")).
settings(commonSettings: _*).
jsSettings(commonJsSettings: _*)
lazy val fs2CatsJVM = fs2Cats.jvm
lazy val fs2CatsJS = fs2Cats.js