-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.sbt
129 lines (117 loc) · 3.81 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
import org.scalajs.linker.interface.{CheckedBehavior, ESVersion}
import scala.util._
import scala.sys.process._
lazy val oldVersion = Try("git describe --abbrev=0".!!.trim.replaceAll("^v", "")).getOrElse("0.2.4")
lazy val commonSettings = Seq(
name := "dijon",
description := "Boiler-free JSON wrangling using Scala dynamic types",
licenses += ("MIT", url("http://opensource.org/licenses/MIT")),
organization := "me.vican.jorge",
homepage := Some(url("https://github.com/jvican/dijon")),
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
scmInfo := Some(
ScmInfo(
url("https://github.com/jvican/dijon"),
"scm:git:[email protected]:jvican/dijon.git"
)
),
developers := List(
Developer(
"pathikrit",
"Pathikrit Bhowmick",
new URL(s"http://github.com/pathikrit")
),
Developer(
"jvican",
"Jorge Vicente Cantero",
url("https://jvican.github.io/")
)
),
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-feature",
"-language:existentials",
"-language:dynamics,higherKinds"
),
publishTo := sonatypePublishToBundle.value,
releaseEarlyWith := SonatypePublisher
)
lazy val publishSettings = Seq(
packageOptions += Package.ManifestAttributes("Automatic-Module-Name" -> moduleName.value),
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 noPublishSettings = Seq(
mimaPreviousArtifacts := Set(),
publish / skip := true
)
lazy val root = project
.in(file("."))
.settings(commonSettings)
.settings(noPublishSettings)
.aggregate(dijonJVM, dijonJS)
lazy val dijonJVM = dijon.jvm
lazy val dijonJS = dijon.js
lazy val dijonNative = dijon.native
lazy val dijon = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(commonSettings)
.settings(publishSettings)
.settings(
scalaVersion := "2.13.6", // Update .github/workflows/ci.yml when changing this
libraryDependencies ++= Seq(
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-core" % "2.13.3",
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.12.0",
"org.scalatest" %%% "scalatest" % "3.2.16" % Test
)
)
.jvmSettings(
crossScalaVersions := Seq(
"2.11.12",
"2.12.13",
"2.13.6"
) // Update .github/workflows/ci.yml when changing this
)
.jsSettings(
crossScalaVersions := Seq(
"2.11.12",
"2.12.13",
"2.13.6"
), // Update .github/workflows/ci.yml when changing this
scalaJSLinkerConfig ~= {
_.withSemantics({
_.optimized
.withProductionMode(true)
.withAsInstanceOfs(CheckedBehavior.Unchecked)
.withArrayIndexOutOfBounds(CheckedBehavior.Unchecked)
}).withClosureCompiler(true)
.withESFeatures(_.withESVersion(ESVersion.ES2015))
.withModuleKind(ModuleKind.CommonJSModule)
},
coverageEnabled := false // FIXME: No support for Scala.js 1.0 yet, see https://github.com/scoverage/scalac-scoverage-plugin/pull/287
)
.nativeSettings(
crossScalaVersions := Seq(
"2.12.13",
"2.13.6"
) // Update .github/workflows/ci.yml when changing this
)