forked from Spinoco/fs2-cassandra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
163 lines (147 loc) · 5.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
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
import sbt.Tests.{Group, SubProcess}
val ReleaseTag = """^release/([\d\.]+a?)$""".r
lazy val contributors = Seq(
"pchlupacek" -> "Pavel Chlupáček"
)
lazy val commonSettings = Seq(
organization := "com.spinoco",
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.11.8"),
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)),
scmInfo := Some(ScmInfo(url("https://github.com/Spinoco/fs2-cassandra"), "[email protected]:Spinoco/fs2-cassandra.git")),
homepage := None,
licenses += ("MIT", url("http://opensource.org/licenses/MIT")),
initialCommands := s"""
import fs2._
import fs2.util._
import spinoco.fs2.cassandra._
"""
, libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % "0.9.0-M6"
, "co.fs2" %% "fs2-io" % "0.9.0-M6"
, "com.datastax.cassandra" % "cassandra-driver-core" % "3.0.1"
, "com.chuusai" %% "shapeless" % "2.3.1"
// as per https://github.com/google/guava/issues/1095
, "com.google.code.findbugs" % "jsr305" % "3.0.1" % "compile"
)
) ++ testSettings ++ scaladocSettings ++ publishingSettings ++ releaseSettings
lazy val testSettings = Seq(
parallelExecution in Test := false,
fork in Test := true,
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),
testGrouping in Test <<= definedTests in Test map { tests =>
// group tests individually to fork them in JVM.
// essentially any CassandraIntegration_* id having its own group, all others share a group
// this is necessary hence JavaDriver seems to share some sort of global state preventing to switch
// different cluster versions correctly in single JVM
tests.groupBy { td =>
if (td.name.contains(".CassandraIntegration")) {
td.name
} else "default_group"
}.map { case (groupName, tests) =>
new Group(
name = groupName
, tests = tests
, runPolicy = Tests.SubProcess(ForkOptions())
)
}.toSeq
}
)
lazy val scaladocSettings = Seq(
scalacOptions in (Compile, doc) ++= Seq(
"-doc-source-url", scmInfo.value.get.browseUrl + "/tree/master€{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(
publishArtifact in Test := false
, 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 ++= Seq(Credentials(Path.userHome / ".ivy2" / ".credentials.sonatype")) ++ (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 := {
<url>https://github.com/Spinoco/fs2-cassandra.git</url>
<scm>
<url>[email protected]:Spinoco/fs2-cassandra.git</url>
<connection>scm:git:[email protected]:Spinoco/fs2-cassandra.git</connection>
</scm>
<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 core =
project.in(file("core"))
.settings(commonSettings)
.settings(
name := "fs2.cassandra"
)
lazy val testSupport =
project.in(file("test-support"))
.settings(commonSettings)
.settings(
name := "fs2.cassandra-test-support"
, libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.0-M16-SNAP4"
, "org.scalacheck" %% "scalacheck" % "1.13.1"
//, "org.slf4j" % "slf4j-simple" % "1.6.1" // uncomment this for logs when testing
)
)
.dependsOn(core)
lazy val coreTest =
project.in(file("test"))
.settings(commonSettings)
.settings(
name := "fs2.cassandra-test"
)
.dependsOn(
core
, testSupport % "test"
)