forked from jwt-scala/jwt-scala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
349 lines (305 loc) · 11.8 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
import sbt._
import Keys._
import Tests._
import play.sbt.Play.autoImport._
import PlayKeys._
import Dependencies._
val previousVersion = "0.13.0"
val buildVersion = "0.14.0"
val projects = Seq("coreCommon", "playJson", "json4sNative", "json4sJackson", "circe", "upickle", "play")
val crossProjects = projects.map(p => Seq(p + "Legacy", p + "Edge")).flatten
addCommandAlias("testAll", crossProjects.map(p => p + "/test").mkString(";", ";", ""))
addCommandAlias("scaladoc", ";coreEdge/doc;playJsonEdge/doc;json4sNativeEdge/doc;circeEdge/doc;upickleEdge/doc;playEdge/doc;scaladocScript;cleanScript")
addCommandAlias("publish-doc", ";docs/makeSite;docs/tut;docs/ghpagesPushSite")
addCommandAlias("publishCore", ";coreCommonEdge/publishSigned;coreCommonLegacy/publishSigned");
addCommandAlias("publishPlayJson", ";playJsonEdge/publishSigned;playJsonLegacy/publishSigned");
addCommandAlias("publishJson4Native", ";json4sNativeEdge/publishSigned;json4sNativeLegacy/publishSigned");
addCommandAlias("publishJson4Jackson", ";json4sJacksonEdge/publishSigned;json4sJacksonLegacy/publishSigned");
addCommandAlias("publishCirce", ";circeEdge/publishSigned;circeLegacy/publishSigned");
addCommandAlias("publishUpickle", ";upickleEdge/publishSigned;upickleLegacy/publishSigned")
addCommandAlias("publishPlay", ";playEdge/publishSigned;playLegacy/publishSigned");
addCommandAlias("publishAll", ";+publishPlayJson;+publishJson4Native;+publishJson4Jackson;+publishCirce;+publishUpickle;+publishPlay")
addCommandAlias("releaseAll", ";bumpScript;scaladoc;publish-doc;publishAll;sonatypeRelease;pushScript")
lazy val scaladocScript = taskKey[Unit]("Generate scaladoc and copy it to docs site")
scaladocScript := {
"./scripts/scaladoc.sh "+buildVersion !
}
lazy val bumpScript = taskKey[Unit]("Bump the new version all around")
bumpScript := {
"./scripts/bump.sh "+previousVersion+" "+buildVersion !
}
lazy val pushScript = taskKey[Unit]("Push to GitHub")
pushScript := {
"./scripts/pu.sh "+buildVersion !
}
lazy val cleanScript = taskKey[Unit]("Clean tmp files")
cleanScript := {
"./scripts/clean.sh" !
}
val baseSettings = Seq(
organization := "com.pauldijou",
version := buildVersion,
scalaVersion in ThisBuild := "2.12.1",
crossScalaVersions := Seq("2.12.1", "2.11.8"),
crossVersion := CrossVersion.binary,
autoAPIMappings := true,
resolvers ++= Seq(
"Typesafe repository releases" at "http://repo.typesafe.com/typesafe/releases/"
),
libraryDependencies ++= Seq(Libs.scalatest, Libs.jmockit),
scalacOptions in (Compile, doc) ++= Seq("-unchecked", "-deprecation"),
aggregate in test := false,
fork in test := true,
parallelExecution in test := false
)
val publishSettings = Seq(
homepage := Some(url("http://pauldijou.fr/jwt-scala/")),
organizationHomepage := Some(url("http://pauldijou.github.io/")),
apiURL := Some(url("http://pauldijou.fr/jwt-scala/api/")),
publishMavenStyle := true,
publishArtifact in Test := false,
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")),
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")
},
pomIncludeRepository := { _ => false },
pomExtra := (
<scm>
<url>[email protected]:pauldijou/jwt-scala.git</url>
<connection>scm:git:[email protected]:pauldijou/jwt-scala.git</connection>
</scm>
<developers>
<developer>
<id>pdi</id>
<name>Paul Dijou</name>
<url>http://pauldijou.fr</url>
</developer>
</developers>)
)
val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)
// Normal published settings
val releaseSettings = baseSettings ++ publishSettings
// Local non-published projects
val localSettings = baseSettings ++ noPublishSettings
val docSettings = Seq(
git.remoteRepo := "[email protected]:pauldijou/jwt-scala.git",
sourceDirectory in Preprocess := tutTargetDirectory.value,
ghpagesNoJekyll := false,
git.remoteRepo := "[email protected]:pauldijou/jwt-scala.git",
mappings in makeSite ++= Seq(
file("README.md") -> "_includes/README.md"
),
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md" | "*.scss"
)
lazy val jwtScala = project.in(file("."))
.settings(localSettings)
.settings(
name := "jwt-scala"
)
.aggregate(json4sNativeLegacy, json4sNativeEdge, json4sJacksonLegacy, json4sJacksonEdge, circeLegacy, circeEdge, upickleLegacy, upickleEdge, playLegacy, playEdge)
.dependsOn(json4sNativeLegacy, json4sNativeEdge, json4sJacksonLegacy, json4sJacksonEdge, circeLegacy, circeEdge, upickleLegacy, upickleEdge, playLegacy, playEdge)
lazy val docs = project.in(file("docs"))
.enablePlugins(PreprocessPlugin)
.enablePlugins(GhpagesPlugin)
.settings(name := "jwt-docs")
.settings(localSettings)
.settings(tutSettings)
.settings(docSettings)
.settings(
libraryDependencies ++= Seq(Libs.playJson, Libs.play, Libs.playTestProvided, Libs.json4sNative, Libs.circeCore, Libs.circeGeneric, Libs.circeParse, Libs.upickle)
)
.dependsOn(playEdge, json4sNativeEdge, circeEdge, upickleEdge)
lazy val coreLegacy = project.in(file("core/legacy"))
.settings(releaseSettings)
.settings(
name := "jwt-core-legacy-impl",
libraryDependencies ++= Seq(Libs.apacheCodec)
)
lazy val coreEdge = project.in(file("core/edge"))
.settings(releaseSettings)
.settings(
name := "jwt-core-impl"
)
lazy val coreCommonLegacy = project.in(file("core/common"))
.settings(releaseSettings)
.settings(
name := "jwt-core-legacy",
target := target(_ / "legacy").value,
libraryDependencies ++= Seq(Libs.bouncyCastle)
)
.aggregate(coreLegacy)
.dependsOn(coreLegacy % "compile->compile;test->test")
lazy val coreCommonEdge = project.in(file("core/common"))
.settings(releaseSettings)
.settings(
name := "jwt-core",
target := target(_ / "edge").value,
libraryDependencies ++= Seq(Libs.bouncyCastle)
)
.aggregate(coreEdge)
.dependsOn(coreEdge % "compile->compile;test->test")
lazy val jsonCommonLegacy = project.in(file("json/common"))
.settings(releaseSettings)
.settings(
name := "jwt-json-common-legacy",
target := target(_ / "legacy").value
)
.aggregate(coreCommonLegacy)
.dependsOn(coreCommonLegacy % "compile->compile;test->test")
lazy val jsonCommonEdge = project.in(file("json/common"))
.settings(releaseSettings)
.settings(
name := "jwt-json-common",
target := target(_ / "edge").value
)
.aggregate(coreCommonEdge)
.dependsOn(coreCommonEdge % "compile->compile;test->test")
lazy val playJsonLegacy = project.in(file("json/play-json"))
.settings(releaseSettings)
.settings(
name := "jwt-play-json-legacy",
target := target(_ / "legacy").value,
libraryDependencies ++= Seq(Libs.playJson)
)
.aggregate(jsonCommonLegacy)
.dependsOn(jsonCommonLegacy % "compile->compile;test->test")
lazy val playJsonEdge = project.in(file("json/play-json"))
.settings(releaseSettings)
.settings(
name := "jwt-play-json",
target := target(_ / "edge").value,
libraryDependencies ++= Seq(Libs.playJson)
)
.aggregate(jsonCommonEdge)
.dependsOn(jsonCommonEdge % "compile->compile;test->test")
lazy val circeLegacy = project.in(file("json/circe"))
.settings(releaseSettings)
.settings(
name := "jwt-circe-legacy",
target := target(_ / "legacy").value,
libraryDependencies ++= Seq(Libs.circeCore, Libs.circeGeneric, Libs.circeParse)
)
.aggregate(jsonCommonLegacy)
.dependsOn(jsonCommonLegacy % "compile->compile;test->test")
lazy val circeEdge = project.in(file("json/circe"))
.settings(releaseSettings)
.settings(
name := "jwt-circe",
target := target(_ / "edge").value,
libraryDependencies ++= Seq(Libs.circeCore, Libs.circeGeneric, Libs.circeParse)
)
.aggregate(jsonCommonEdge)
.dependsOn(jsonCommonEdge % "compile->compile;test->test")
lazy val upickleLegacy = project.in(file("json/upickle"))
.settings(releaseSettings)
.settings(
name := "jwt-upickle-legacy",
target := target(_ / "legacy").value,
libraryDependencies ++= Seq(Libs.upickle)
)
.aggregate(jsonCommonLegacy)
.dependsOn(jsonCommonLegacy % "compile->compile;test->test")
lazy val upickleEdge = project.in(file("json/upickle"))
.settings(releaseSettings)
.settings(
name := "jwt-upickle",
target := target(_ / "edge").value,
libraryDependencies ++= Seq(Libs.upickle)
)
.aggregate(jsonCommonEdge)
.dependsOn(jsonCommonEdge % "compile->compile;test->test")
lazy val json4sCommonLegacy = project.in(file("json/json4s-common"))
.settings(releaseSettings)
.settings(
name := "jwt-json4s-common-legacy",
target := target(_ / "legacy").value,
libraryDependencies ++= Seq(Libs.json4sCore)
)
.aggregate(jsonCommonLegacy)
.dependsOn(jsonCommonLegacy % "compile->compile;test->test")
lazy val json4sCommonEdge = project.in(file("json/json4s-common"))
.settings(releaseSettings)
.settings(
name := "jwt-json4s-common",
target := target(_ / "edge").value,
libraryDependencies ++= Seq(Libs.json4sCore)
)
.aggregate(jsonCommonEdge)
.dependsOn(jsonCommonEdge % "compile->compile;test->test")
lazy val json4sNativeLegacy = project.in(file("json/json4s-native"))
.settings(releaseSettings)
.settings(
name := "jwt-json4s-native-legacy",
target := target(_ / "legacy").value,
libraryDependencies ++= Seq(Libs.json4sNative)
)
.aggregate(json4sCommonLegacy)
.dependsOn(json4sCommonLegacy % "compile->compile;test->test")
lazy val json4sNativeEdge = project.in(file("json/json4s-native"))
.settings(releaseSettings)
.settings(
name := "jwt-json4s-native",
target := target(_ / "edge").value,
libraryDependencies ++= Seq(Libs.json4sNative)
)
.aggregate(json4sCommonEdge)
.dependsOn(json4sCommonEdge % "compile->compile;test->test")
lazy val json4sJacksonLegacy = project.in(file("json/json4s-jackson"))
.settings(releaseSettings)
.settings(
name := "jwt-json4s-jackson-legacy",
target := target(_ / "legacy").value,
libraryDependencies ++= Seq(Libs.json4sJackson)
)
.aggregate(json4sCommonLegacy)
.dependsOn(json4sCommonLegacy % "compile->compile;test->test")
lazy val json4sJacksonEdge = project.in(file("json/json4s-jackson"))
.settings(releaseSettings)
.settings(
name := "jwt-json4s-jackson",
target := target(_ / "edge").value,
libraryDependencies ++= Seq(Libs.json4sJackson)
)
.aggregate(json4sCommonEdge)
.dependsOn(json4sCommonEdge % "compile->compile;test->test")
def groupPlayTest(tests: Seq[TestDefinition]) = tests.map { t =>
new Group(t.name, Seq(t), new SubProcess(new ForkOptions()))
}
lazy val playLegacy = project.in(file("play"))
.settings(releaseSettings)
.settings(
name := "jwt-play",
target := target(_ / "legacy").value,
libraryDependencies ++= Seq(Libs.play, Libs.playTest, Libs.scalatestPlus, Libs.guice),
testGrouping in Test := (definedTests in Test map groupPlayTest).value
)
.aggregate(playJsonLegacy)
.dependsOn(playJsonLegacy % "compile->compile;test->test")
lazy val playEdge = project.in(file("play"))
.settings(releaseSettings)
.settings(
name := "jwt-play",
target := target(_ / "edge").value,
libraryDependencies ++= Seq(Libs.play, Libs.playTest, Libs.scalatestPlus, Libs.guice),
testGrouping in Test := (definedTests in Test map groupPlayTest).value
)
.aggregate(playJsonEdge)
.dependsOn(playJsonEdge % "compile->compile;test->test")
lazy val examplePlayAngularProject = project.in(file("examples/play-angular"))
.settings(localSettings)
.settings(
name := "playAngular",
libraryDependencies ++= Seq(guice),
routesGenerator := play.sbt.routes.RoutesKeys.InjectedRoutesGenerator
)
.enablePlugins(PlayScala)
.aggregate(playEdge)
.dependsOn(playEdge)