forked from plokhotnyuk/jsoniter-scala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
158 lines (147 loc) · 5.36 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
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import sbt.Keys.scalacOptions
import sbt.url
import scala.sys.process._
lazy val oldVersion = "git describe --abbrev=0".!!.trim.replaceAll("^v", "")
def mimaSettings = mimaDefaultSettings ++ Seq(
mimaCheckDirection := {
def isPatch = {
val Array(newMajor, newMinor, _) = version.value.split('.')
val Array(oldMajor, oldMinor, _) = oldVersion.split('.')
newMajor == oldMajor && newMinor == oldMinor
}
if (isPatch) "both" else "backward"
},
mimaPreviousArtifacts := {
def isCheckingRequired = {
val Array(newMajor, newMinor, _) = version.value.split('.')
val Array(oldMajor, oldMinor, _) = oldVersion.split('.')
newMajor == oldMajor && (newMajor != "0" || newMinor == oldMinor)
}
if (isCheckingRequired) Set(organization.value %% moduleName.value % oldVersion)
else Set()
}
)
lazy val commonSettings = Seq(
organization := "com.github.plokhotnyuk.jsoniter-scala",
organizationHomepage := Some(url("https://github.com/plokhotnyuk")),
homepage := Some(url("https://github.com/plokhotnyuk/jsoniter-scala")),
licenses := Seq(("MIT License", url("https://opensource.org/licenses/mit-license.html"))),
startYear := Some(2017),
developers := List(
Developer(
id = "plokhotnyuk",
name = "Andriy Plokhotnyuk",
email = "[email protected]",
url = url("https://twitter.com/aplokhotnyuk")
)
),
resolvers += "Sonatype OSS Staging" at "https://oss.sonatype.org/content/repositories/staging",
scalaVersion := "2.12.6",
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-target:jvm-1.8",
"-feature",
"-unchecked",
"-Ywarn-dead-code",
"-Xfuture",
"-Xlint",
"-Xmacro-settings:print-codecs"
) ++ (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, x)) if x >= 12 => Seq("-opt:l:method")
case Some((2, x)) if x == 11 => Seq("-Ybackend:GenBCode", "-Ydelambdafy:inline")
case _ => Seq()
}),
testOptions in Test += Tests.Argument("-oDF")
)
lazy val noPublishSettings = Seq(
skip in publish := true,
publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeSnapshots else Opts.resolver.sonatypeStaging)
)
lazy val publishSettings = Seq(
publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeSnapshots else Opts.resolver.sonatypeStaging),
sonatypeProfileName := "com.github.plokhotnyuk",
scmInfo := Some(
ScmInfo(
url("https://github.com/plokhotnyuk/jsoniter-scala"),
"scm:[email protected]:plokhotnyuk/jsoniter-scala.git"
)
),
publishMavenStyle := true,
pomIncludeRepository := { _ => false }
)
lazy val `jsoniter-scala` = project.in(file("."))
.aggregate(core, macros, benchmark)
.settings(noPublishSettings: _*)
lazy val core = project
.settings(commonSettings: _*)
.settings(mimaSettings: _*)
.settings(publishSettings: _*)
.settings(
crossScalaVersions := Seq("2.13.0-M4", "2.13.0-M3", "2.11.12"),
libraryDependencies ++= {
val scalaV = scalaVersion.value
CrossVersion.partialVersion(scalaV) match {
case Some((2, v)) if v >= 13 && scalaV != "2.13.0-M3" =>
// TODO: scalatest for Scala 2.13.0-M4
Nil
case _ =>
Seq(
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
"org.scalatest" %% "scalatest" % "3.0.5-M1" % Test
)
}
}
)
lazy val macros = project
.dependsOn(core)
.settings(commonSettings: _*)
.settings(mimaSettings: _*)
.settings(publishSettings: _*)
.settings(
crossScalaVersions := Seq("2.13.0-M4", "2.13.0-M3", "2.11.12"),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value
),
libraryDependencies ++= {
val scalaV = scalaVersion.value
CrossVersion.partialVersion(scalaV) match {
case Some((2, v)) if v >= 13 && scalaV != "2.13.0-M3" =>
// TODO: scalatest for Scala 2.13.0-M4
Nil
case _ =>
Seq(
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
"org.scalatest" %% "scalatest" % "3.0.5-M1" % Test
)
}
}
)
lazy val benchmark = project
.enablePlugins(JmhPlugin)
.dependsOn(macros)
.settings(commonSettings: _*)
.settings(noPublishSettings: _*)
.settings(
crossScalaVersions := Seq("2.12.6", "2.11.12"),
libraryDependencies ++= Seq(
"com.lihaoyi" %% "upickle" % "0.6.6",
"com.dslplatform" %% "dsl-json-scala" % "1.7.4",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.9.5",
"com.fasterxml.jackson.module" % "jackson-module-afterburner" % "2.9.5",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % "2.9.5",
"com.fasterxml.jackson.core" % "jackson-core" % "2.9.5",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.9.5",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.5",
"io.circe" %% "circe-generic" % "0.10.0-M1",
"io.circe" %% "circe-generic-extras" % "0.10.0-M1",
"io.circe" %% "circe-parser" % "0.10.0-M1",
"io.circe" %% "circe-java8" % "0.10.0-M1",
"ai.x" %% "play-json-extensions" % "0.10.0",
"com.typesafe.play" %% "play-json" % "2.6.9",
"org.julienrf" %% "play-json-derived-codecs" % "4.0.0",
"pl.project13.scala" % "sbt-jmh-extras" % "0.3.4",
"org.scalatest" %% "scalatest" % "3.0.5-M1" % Test
)
)