forked from circe/circe-jackson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
215 lines (197 loc) · 6.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
organization in ThisBuild := "io.circe"
val compilerOptions = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-unchecked",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen"
)
val circeVersion = "0.13.0"
val previousCirceJacksonVersion = "0.12.0"
def priorTo2_13(scalaVersion: String): Boolean =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, minor)) if minor < 13 => true
case _ => false
}
val baseSettings = Seq(
scalacOptions ++= compilerOptions,
scalacOptions ++= (
if (priorTo2_13(scalaVersion.value))
Seq(
"-Xfuture",
"-Yno-adapted-args",
"-Ywarn-unused-import"
)
else
Seq(
"-Ywarn-unused:imports"
)
),
scalacOptions in (Compile, console) ~= {
_.filterNot(Set("-Ywarn-unused-import"))
},
scalacOptions in (Test, console) ~= {
_.filterNot(Set("-Ywarn-unused-import"))
},
resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
),
coverageHighlighting := true,
(scalastyleSources in Compile) ++= (unmanagedSourceDirectories in Compile).value,
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-jawn" % circeVersion % Test,
"io.circe" %% "circe-testing" % circeVersion % Test,
"org.scalatest" %% "scalatest" % "3.1.1" % Test,
"org.scalatestplus" %% "scalacheck-1-14" % "3.1.1.1" % Test,
"org.typelevel" %% "discipline-scalatest" % "1.0.1" % Test
),
unmanagedSourceDirectories in Compile += (baseDirectory in ThisBuild).value / "shared/src/main",
unmanagedSourceDirectories in Test += (baseDirectory in ThisBuild).value / "shared/src/test",
unmanagedResourceDirectories in Test += (baseDirectory in ThisBuild).value / "shared/src/test/resources",
Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.AllLibraryJars
)
val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs")
def jacksonDependencies(version: String, databindVersion: Option[String] = None) =
Seq(
"com.fasterxml.jackson.core" % "jackson-core" % version,
"com.fasterxml.jackson.core" % "jackson-databind" % databindVersion.getOrElse(version)
)
val allSettings = baseSettings ++ publishSettings
val root = project
.in(file("."))
.settings(allSettings ++ noPublishSettings)
.aggregate(jackson25, jackson26, jackson27, jackson28, jackson29, jackson210, benchmark)
.dependsOn(jackson210)
lazy val jackson25 = project
.in(file("25"))
.settings(allSettings)
.settings(
moduleName := "circe-jackson25",
libraryDependencies ++= jacksonDependencies("2.5.5"),
mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson25" % previousCirceJacksonVersion)
)
lazy val jackson26 = project
.in(file("26"))
.settings(allSettings)
.settings(
moduleName := "circe-jackson26",
libraryDependencies ++= jacksonDependencies("2.6.7", Some("2.6.7.3")),
unmanagedSourceDirectories in Compile += (baseDirectory in ThisBuild).value / "27",
mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson26" % previousCirceJacksonVersion)
)
lazy val jackson27 = project
.in(file("27"))
.settings(allSettings)
.settings(
moduleName := "circe-jackson27",
libraryDependencies ++= jacksonDependencies("2.7.9", Some("2.7.9.7")),
mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson27" % previousCirceJacksonVersion)
)
lazy val jackson28 = project
.in(file("28"))
.enablePlugins(GhpagesPlugin)
.settings(allSettings)
.settings(
moduleName := "circe-jackson28",
libraryDependencies ++= jacksonDependencies("2.8.11", Some("2.8.11.6")),
docMappingsApiDir := "api",
addMappingsToSiteDir(mappings in (Compile, packageDoc), docMappingsApiDir),
ghpagesNoJekyll := true,
scalacOptions in (Compile, doc) ++= Seq(
"-groups",
"-implicits",
"-doc-source-url",
scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",
"-sourcepath",
baseDirectory.in(LocalRootProject).value.getAbsolutePath
),
git.remoteRepo := "git@github.com:circe/circe-jackson.git",
autoAPIMappings := true,
apiURL := Some(url("https://circe.github.io/circe-jackson/api/")),
mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson28" % previousCirceJacksonVersion)
)
lazy val jackson29 = project
.in(file("29"))
.settings(allSettings)
.settings(
moduleName := "circe-jackson29",
libraryDependencies ++= jacksonDependencies("2.9.10", Some("2.9.10.4")),
unmanagedSourceDirectories in Compile += (baseDirectory in ThisBuild).value / "28",
mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson29" % previousCirceJacksonVersion)
)
lazy val jackson210 = project
.in(file("210"))
.settings(allSettings)
.settings(
moduleName := "circe-jackson210",
libraryDependencies ++= jacksonDependencies("2.10.2"),
unmanagedSourceDirectories in Compile += (baseDirectory in ThisBuild).value / "210"
)
lazy val benchmark = project
.in(file("benchmark"))
.settings(allSettings)
.settings(noPublishSettings)
.settings(
crossScalaVersions := crossScalaVersions.value.init,
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-jawn" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion % Test
)
)
.enablePlugins(JmhPlugin)
.dependsOn(jackson210)
lazy val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false
)
lazy val publishSettings = Seq(
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseVcsSign := true,
homepage := Some(url("https://github.com/circe/circe-jackson")),
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
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"))
},
scmInfo := Some(
ScmInfo(
url("https://github.com/circe/circe-jackson"),
"scm:git:git@github.com:circe/circe-jackson.git"
)
),
developers := List(
Developer(
"travisbrown",
"Travis Brown",
"travisrobertbrown@gmail.com",
url("https://twitter.com/travisbrown")
)
)
)
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