-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.sbt
194 lines (179 loc) · 5.93 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
import ReleaseTransformations._
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
lazy val buildSettings = Seq(
organization := "io.circe",
scalaVersion := "2.12.12",
crossScalaVersions := List("2.12.12", "2.13.4")
)
lazy val magnoliaVersion = "1.1.3"
lazy val circeVersion = "0.14.3"
lazy val circeGenericExtrasVersion = "0.14.3"
lazy val shapelessVersion = "2.3.10"
lazy val scalatestVersion = "3.2.2"
lazy val scalacheckVersion = "1.14.3"
lazy val scalatestplusVersion = "3.2.2.0"
lazy val compilerSettings = Seq(
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "utf-8",
"-explaintypes",
"-feature",
"-language:existentials",
"-language:experimental.macros",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Xcheckinit",
"-Xfatal-warnings",
"-Xlint:adapted-args",
"-Xlint:delayedinit-select",
"-Xlint:doc-detached",
"-Xlint:inaccessible",
"-Xlint:infer-any",
"-Xlint:missing-interpolator",
"-Xlint:nullary-override",
"-Xlint:nullary-unit",
"-Xlint:option-implicit",
"-Xlint:package-object-classes",
"-Xlint:poly-implicit-overload",
"-Xlint:private-shadow",
"-Xlint:stars-align",
"-Xlint:type-parameter-shadow",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xlint:constant",
"-Ywarn-macros:after",
"-Ywarn-extra-implicit",
"-Ywarn-unused:implicits",
"-Ywarn-unused:imports",
"-Ywarn-unused:locals",
"-Ywarn-unused:params",
"-Ywarn-unused:patvars",
"-Ywarn-unused:privates"),
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, y)) if y == 12 => Seq(
"-Xfuture",
"-Xlint:by-name-right-associative",
"-Xlint:unsound-match",
"-Yno-adapted-args",
"-Ypartial-unification",
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit",
)
case Some((2, y)) if y == 13 => Seq("-Ymacro-annotations")
case _ => Seq.empty[String]
}
},
Compile / console / scalacOptions --= Seq("-Ywarn-unused:imports", "-Xfatal-warnings")
)
lazy val allSettings = buildSettings ++ compilerSettings ++ publishSettings
lazy val coreDependencies = libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % circeVersion,
"com.softwaremill.magnolia1_2" %%% "magnolia" % magnoliaVersion,
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
)
lazy val testDependencies = libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % shapelessVersion,
"io.circe" %%% "circe-parser" % circeVersion,
"io.circe" %%% "circe-generic" % circeVersion,
"io.circe" %%% "circe-generic-extras" % circeGenericExtrasVersion,
"io.circe" %%% "circe-testing" % circeVersion,
"org.scalacheck" %%% "scalacheck" % scalacheckVersion,
"org.scalatest" %%% "scalatest" % scalatestVersion,
"org.scalatestplus" %%% "scalacheck-1-14" % scalatestplusVersion
)
lazy val circeMagnolia = project.in(file("."))
.settings(name := "circe-magnolia")
.settings(allSettings: _*)
.settings(noPublishSettings: _*)
.aggregate(derivationJVM, derivationJS, testsJS, testsJVM)
.dependsOn(derivationJVM, derivationJS, testsJS, testsJVM)
lazy val derivation = crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Pure)
.in(file("derivation"))
.settings(
description := "Magnolia-based derivation for Circe codecs",
moduleName := "circe-magnolia-derivation",
name := "derivation"
)
.settings(allSettings: _*)
.settings(coreDependencies)
lazy val derivationJVM = derivation.jvm
lazy val derivationJS = derivation.js
lazy val tests = crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Pure)
.in(file("tests"))
.settings(
description := "Circe-magnolia tests",
moduleName := "circe-magnolia-tests",
name := "tests"
)
.settings(allSettings: _*)
.settings(noPublishSettings: _*)
.settings(coreDependencies)
.settings(testDependencies)
.settings(
// Coverage disabled due to https://github.com/scoverage/scalac-scoverage-plugin/issues/269
// coverageExcludedPackages :=".*"
)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.dependsOn(derivation)
lazy val testsJVM = tests.jvm
lazy val testsJS = tests.js
lazy val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false
)
lazy val publishSettings = Seq(
releaseIgnoreUntrackedFiles := true,
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
homepage := Some(url("https://github.com/circe/circe-magnolia")),
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
publishMavenStyle := true,
Test / publishArtifact := 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")
},
autoAPIMappings := true,
apiURL := Some(url("https://vpavkin.github.io/circe-magnolia/api/")),
scmInfo := Some(
ScmInfo(
url("https://github.com/circe/circe-magnolia"),
"scm:git:git@github.com:circe/circe-magnolia.git"
)
),
pomExtra :=
<developers>
<developer>
<id>vpavkin</id>
<name>Vladimir Pavkin</name>
<url>http://pavkin.ru</url>
</developer>
</developers>
)
lazy val sharedReleaseProcess = Seq(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining(command = "+publishSigned"),
setNextVersion,
commitNextVersion,
ReleaseStep(action = releaseStepCommand("sonatypeReleaseAll")),
pushChanges
)
)
addCommandAlias("validate", ";compile;testsJVM/test;testsJS/test")