forked from circe/circe-jackson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
177 lines (162 loc) · 5.77 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
organization in ThisBuild := "io.circe"
val compilerOptions = Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-unchecked",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Xfuture"
)
val circeVersion = "0.8.0"
val previousCirceJacksonVersion = "0.7.1"
val baseSettings = Seq(
scalacOptions ++= compilerOptions ++ (
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, minor)) if minor >= 11 => Seq("-Ywarn-unused-import")
case _ => Nil
}
),
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 := (
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) => false
case _ => true
}
),
coverageScalacPluginVersion := "1.3.0",
(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
),
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"
)
val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs")
def jacksonDependencies(version: String) = Seq(
"com.fasterxml.jackson.core" % "jackson-core",
"com.fasterxml.jackson.core" % "jackson-databind"
).map(_ % version)
val allSettings = baseSettings ++ publishSettings
val root = project.in(file("."))
.settings(allSettings ++ noPublishSettings)
.aggregate(jackson25, jackson26, jackson27, jackson28, benchmark)
.dependsOn(jackson28)
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"),
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"),
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.8"),
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 benchmark = project.in(file("benchmark"))
.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,
"org.scalatest" %% "scalatest" % "3.0.3" % Test,
compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" % Test cross CrossVersion.full)
)
)
.enablePlugins(JmhPlugin)
.dependsOn(jackson25, jackson26, jackson27, jackson28)
lazy val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)
lazy val publishSettings = Seq(
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
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