forked from gnieh/diffson
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
147 lines (137 loc) · 5.35 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
import scalariform.formatter.preferences._
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
val scala212 = "2.12.10"
val scala213 = "2.13.1"
lazy val publishSettings: Seq[Setting[_]] = Seq(
publishTo := Some(Resolver.url("upstartcommerce", url("https://upstartcommerce.jfrog.io/artifactory/generic"))(Resolver.ivyStylePatterns)),
credentials += Credentials(Path.userHome / ".sbt" / ".credentials"),
publishMavenStyle := false)
lazy val notPublishSettings = Seq(
publishArtifact := false,
skip in publish := true,
publishLocal := {},
publish := {}
)
lazy val commonSettings = Seq(
organization := "com.upstartcommerce",
scalaVersion := scala212,
version := "4.0.3",
description := "Json diff/patch library",
licenses ++= Seq("The Apache Software License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/gnieh/diffson")),
parallelExecution := false,
scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)) {
case Some((2, n)) if n >= 13 =>
Seq(
"-Ymacro-annotations"
)
}.toList.flatten,
libraryDependencies ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, v)) if v <= 12 =>
Seq(
compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
)
case _ =>
// if scala 2.13.0 or later, macro annotations merged into scala-reflect
Nil
}),
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.10.3" cross CrossVersion.binary),
scalariformAutoformat := true,
scalariformPreferences := {
scalariformPreferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentConstructorArguments, true)
.setPreference(MultilineScaladocCommentsStartOnFirstLine, true)
},
coverageExcludedPackages := "<empty>;.*Test.*",
scalacOptions in (Compile,doc) ++= Seq("-groups", "-implicits"),
autoAPIMappings := true,
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked")) ++ Seq(
scalariformPreferences := {
scalariformPreferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentConstructorArguments, true)
.setPreference(MultilineScaladocCommentsStartOnFirstLine, true)
.setPreference(DanglingCloseParenthesis, Prevent)
})
lazy val diffson = project.in(file("."))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.settings(notPublishSettings: _*)
.settings(
name := "diffson",
packagedArtifacts := Map(),
)
.aggregate(core.jvm, core.js, sprayJson, circe.jvm, circe.js, playJson.jvm, playJson.js, testkit.jvm, testkit.js)
lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure).in(file("core"))
.enablePlugins(ScoverageSbtPlugin, ScalaUnidocPlugin)
.settings(commonSettings: _*)
.settings(publishSettings)
.settings(
name := "diffson-core",
crossScalaVersions := Seq(scala212, scala213),
libraryDependencies ++= Seq(
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.1.4",
"org.typelevel" %%% "cats-core" % "2.1.1",
"io.estatico" %%% "newtype" % "0.4.3",
"org.scalatest" %%% "scalatest" % "3.1.1" % Test,
"org.scalacheck" %%% "scalacheck" % "1.14.3" % Test
),
)
.jsSettings(coverageEnabled := false)
lazy val testkit = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full).in(file("testkit"))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.settings(notPublishSettings: _*)
.settings(
name := "diffson-testkit",
crossScalaVersions := Seq(scala212, scala213),
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.1.1",
"org.scalacheck" %%% "scalacheck" % "1.14.3")
)
.jsSettings(coverageEnabled := false)
.dependsOn(core)
lazy val sprayJson = project.in(file("sprayJson"))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.settings(notPublishSettings: _*)
.settings(
name := "diffson-spray-json",
crossScalaVersions := Seq(scala212, scala213),
libraryDependencies += "io.spray" %% "spray-json" % "1.3.5")
.dependsOn(core.jvm, testkit.jvm % Test)
lazy val playJson = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full).in(file("playJson"))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.settings(publishSettings)
.settings(
name := "diffson-play-json",
libraryDependencies += "com.typesafe.play" %%% "play-json" % "2.8.1",
crossScalaVersions := Seq(scala212, scala213),
)
.jsSettings(coverageEnabled := false)
.dependsOn(core, testkit % Test)
val circeVersion = "0.13.0"
lazy val circe = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full).in(file("circe"))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.settings(notPublishSettings: _*)
.settings(
name := "diffson-circe",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion,
"io.circe" %%% "circe-generic" % circeVersion % Test
),
crossScalaVersions := Seq(scala212, scala213))
.jsSettings(
coverageEnabled := false,
libraryDependencies += "io.circe" %%% "not-java-time" % "0.2.0"
)
.dependsOn(core, testkit % Test)