forked from gnieh/diffson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
160 lines (151 loc) · 5.66 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
import scalariform.formatter.preferences._
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
val scala212 = "2.12.12"
val scala213 = "2.13.3"
lazy val commonSettings = Seq(
organization := "org.gnieh",
scalaVersion := scala213,
version := "4.0.3",
description := "Json diff/patch library",
licenses += ("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)
}) ++ publishSettings
lazy val diffson = project.in(file("."))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.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(
name := "diffson-core",
crossScalaVersions := Seq(scala212, scala213),
libraryDependencies ++= Seq(
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.2.0",
"org.typelevel" %%% "cats-core" % "2.1.1",
"io.estatico" %%% "newtype" % "0.4.4",
"org.scalatest" %%% "scalatest" % "3.2.3" % Test,
"org.scalacheck" %%% "scalacheck" % "1.15.1" % Test
))
.jsSettings(coverageEnabled := false)
lazy val testkit = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full).in(file("testkit"))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.settings(
name := "diffson-testkit",
crossScalaVersions := Seq(scala212, scala213),
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.2.3",
"org.scalacheck" %%% "scalacheck" % "1.15.1"))
.jsSettings(coverageEnabled := false)
.dependsOn(core)
lazy val sprayJson = project.in(file("sprayJson"))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.settings(
name := "diffson-spray-json",
crossScalaVersions := Seq(scala212, scala213),
libraryDependencies += "io.spray" %% "spray-json" % "1.3.6")
.dependsOn(core.jvm, testkit.jvm % Test)
lazy val playJson = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full).in(file("playJson"))
.enablePlugins(ScoverageSbtPlugin)
.settings(commonSettings: _*)
.settings(
name := "diffson-play-json",
libraryDependencies += "com.typesafe.play" %%% "play-json" % "2.9.2",
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(
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
)
.dependsOn(core, testkit % Test)
lazy val publishSettings = Seq(
publishMavenStyle := true,
publishArtifact in Test := false,
// The Nexus repo we're publishing to.
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
),
pomIncludeRepository := { x => false },
pomExtra := (
<scm>
<url>https://github.com/gnieh/diffson</url>
<connection>scm:git:git://github.com/gnieh/diffson.git</connection>
<developerConnection>scm:git:[email protected]:gnieh/diffson.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>satabin</id>
<name>Lucas Satabin</name>
<email>[email protected]</email>
</developer>
</developers>
<ciManagement>
<system>travis</system>
<url>https://travis-ci.org/#!/gnieh/diffson</url>
</ciManagement>
<issueManagement>
<system>github</system>
<url>https://github.com/gnieh/diffson/issues</url>
</issueManagement>
)
)