-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.sbt
231 lines (202 loc) · 5.6 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
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
val ReleaseTag = """^release/([\d\.]+a?)$""".r
lazy val contributors = Seq(
"pchlupacek" -> "Pavel Chlupáček"
, "mrauilm" -> "Milan Raulim"
, "eikek" -> "Eike Kettner"
, "d6y" -> "Richard Dallaway"
)
lazy val commonSettings = Seq(
organization := "com.spinoco",
scalaVersion := "2.12.1",
crossScalaVersions := Seq("2.11.8", "2.12.1"),
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)),
libraryDependencies ++= Seq(
"org.scodec" %% "scodec-bits" % "1.1.5"
, "org.scodec" %% "scodec-core" % "1.10.3"
, "org.scalatest" %% "scalatest" % "3.0.0" % "test"
, "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
),
scmInfo := Some(ScmInfo(url("https://github.com/Spinoco/protocol"), "[email protected]:Spinoco/protocol.git")),
homepage := None,
licenses += ("MIT", url("http://opensource.org/licenses/MIT")),
initialCommands := s"""
"""
) ++ testSettings ++ scaladocSettings ++ publishingSettings ++ releaseSettings
lazy val testSettings = Seq(
parallelExecution in Test := false,
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),
publishArtifact in Test := true
)
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(
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 := {
<url>https://github.com/Spinoco/protocol</url>
<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 noPublish = Seq(
publish := (),
publishLocal := (),
publishSigned := (),
publishArtifact := false
)
lazy val common =
project.in(file("common"))
.settings(commonSettings)
.settings(
name := "protocol-common"
)
lazy val mime =
project.in(file("mime"))
.settings(commonSettings)
.settings(
name := "protocol-mime"
)
.dependsOn(common)
lazy val mail =
project.in(file("mail"))
.settings(commonSettings)
.settings(
name := "protocol-mail"
)
.dependsOn(common, mime)
lazy val rtp =
project.in(file("rtp"))
.settings(commonSettings)
.settings(
name := "protocol-rtp"
)
.dependsOn(common)
lazy val stun =
project.in(file("stun"))
.settings(commonSettings)
.settings(
name := "protocol-stun"
)
.dependsOn(common)
lazy val webSocket =
project.in(file("websocket"))
.settings(commonSettings)
.settings(
name := "protocol-websocket"
)
.dependsOn(common)
lazy val http =
project.in(file("http"))
.settings(commonSettings)
.settings(
name := "protocol-http"
)
.dependsOn(common, mime)
lazy val sdp =
project.in(file("sdp"))
.settings(commonSettings)
.settings(
name := "protocol-sdp"
).dependsOn(common)
lazy val mgcp =
project.in(file("mgcp"))
.settings(commonSettings)
.settings(
name := "protocol-mgcp"
).dependsOn(common, sdp)
lazy val kafka =
project.in(file("kafka"))
.settings(commonSettings)
.settings(
name := "protocol-kafka"
, libraryDependencies ++= Seq(
"org.xerial.snappy" % "snappy-java" % "1.1.2.1" // for supporting a Snappy compression of message sets
, "org.apache.kafka" %% "kafka" % "0.10.2.0" % "test"
)
).dependsOn(
common
, common % "test->test"
)
lazy val asn1 =
project.in(file("asn1"))
.settings(commonSettings)
.settings(
name := "protocol-asn1"
).dependsOn(common)
lazy val ldap =
project.in(file("ldap"))
.settings(commonSettings)
.settings(
name := "protocol-ldap"
).dependsOn(common, asn1)
lazy val allProtocols =
project.in(file("."))
.settings(commonSettings)
.settings(noPublish)
.aggregate(
common
, mime
, mail
, stun
, webSocket, http
, rtp
, sdp
, mgcp
, kafka
, asn1
, ldap
)