forked from plokhotnyuk/jsoniter-scala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
144 lines (133 loc) · 4.98 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
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import sbt.Keys.scalacOptions
import sbt._
import scala.sys.process._
lazy val oldVersion = "git describe --abbrev=0".!!.trim.replaceAll("^v", "")
def mimaSettings: Seq[Setting[_]] = mimaDefaultSettings ++ Seq(
mimaCheckDirection := {
def isPatch: Boolean = {
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: Boolean = {
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.8",
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("."))
.settings(commonSettings: _*)
.settings(noPublishSettings: _*)
.aggregate(`jsoniter-scala-core`, `jsoniter-scala-macros`, `jsoniter-scala-benchmark`)
lazy val `jsoniter-scala-core` = project
.settings(commonSettings: _*)
.settings(mimaSettings: _*)
.settings(publishSettings: _*)
.settings(
crossScalaVersions := Seq("2.13.0-M5", "2.12.8", "2.11.12"),
libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
"org.scalatest" %% "scalatest" % "3.0.6" % Test
)
)
lazy val `jsoniter-scala-macros` = project
.dependsOn(`jsoniter-scala-core`)
.settings(commonSettings: _*)
.settings(mimaSettings: _*)
.settings(publishSettings: _*)
.settings(
crossScalaVersions := Seq("2.13.0-M5", "2.12.8", "2.11.12"),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
"org.scalatest" %% "scalatest" % "3.0.6" % Test
)
)
lazy val `jsoniter-scala-benchmark` = project
.enablePlugins(JmhPlugin)
.dependsOn(`jsoniter-scala-macros`)
.settings(commonSettings: _*)
.settings(noPublishSettings: _*)
.settings(
libraryDependencies ++= Seq(
"com.avsystem.commons" %% "commons-core" % "1.34.9",
"com.lihaoyi" %% "upickle" % "0.7.1",
"com.dslplatform" %% "dsl-json-scala" % "1.8.5",
"com.jsoniter" % "jsoniter" % "0.9.23",
"org.javassist" % "javassist" % "3.24.1-GA", // required for Jsoniter Java
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.9.8",
"com.fasterxml.jackson.module" % "jackson-module-afterburner" % "2.9.8",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % "2.9.8",
"io.circe" %% "circe-generic" % "0.11.1",
"io.circe" %% "circe-generic-extras" % "0.11.1",
"io.circe" %% "circe-parser" % "0.11.1",
"io.circe" %% "circe-java8" % "0.11.1",
"com.typesafe.play" %% "play-json" % "2.7.1",
"org.julienrf" %% "play-json-derived-codecs" % "5.0.0",
"ai.x" %% "play-json-extensions" % "0.30.1",
"pl.project13.scala" % "sbt-jmh-extras" % "0.3.4",
"org.scalatest" %% "scalatest" % "3.0.6" % Test
)
)