This repository has been archived by the owner on Apr 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
145 lines (138 loc) · 4.21 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
import sbtrelease._
import ReleaseStateTransformations._
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
ThisBuild / onChangedBuildSource := ReloadOnSourceChanges
def gitHash(): String = sys.process.Process("git rev-parse HEAD").lineStream_!.head
val tagName = Def.setting {
s"v${if (releaseUseGlobalVersion.value) (ThisBuild / version).value
else version.value}"
}
val tagOrHash = Def.setting {
if (isSnapshot.value) gitHash() else tagName.value
}
val Scala212 = "2.12.13"
val Scala213 = "2.13.5"
lazy val commonSettings = nocomma {
scalaVersion := Scala212
crossScalaVersions := Seq(Scala212, Scala213)
organization := "com.github.xuwei-k"
homepage := Some(url("https://github.com/xuwei-k/scalaz-magnolia"))
licenses := Seq("MIT License" -> url("https://opensource.org/licenses/mit-license"))
pomExtra :=
<developers>
<developer>
<id>xuwei-k</id>
<name>Kenji Yoshida</name>
<url>https://github.com/xuwei-k</url>
</developer>
</developers>
<scm>
<url>git@github.com:xuwei-k/scalaz-magnolia.git</url>
<connection>scm:git:git@github.com:xuwei-k/scalaz-magnolia.git</connection>
<tag>{tagOrHash.value}</tag>
</scm>
publishTo := sonatypePublishToBundle.value
releaseTagName := tagName.value
releaseCrossBuild := true
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
UpdateReadme.updateReadmeProcess,
tagRelease,
ReleaseStep(
action = { state =>
val extracted = Project extract state
extracted.runAggregated(extracted.get(thisProjectRef) / (Global / PgpKeys.publishSigned), state)
},
enableCrossBuild = true
),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
UpdateReadme.updateReadmeProcess,
pushChanges
)
}
lazy val scalazMagnolia = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("."))
.settings(
commonSettings,
scalapropsCoreSettings
)
.settings(nocomma {
name := UpdateReadme.scalazMagnoliaName
description := "generate scalaz instances with magnolia"
scalacOptions ++= Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:experimental.macros",
"-unchecked",
"-Xlint:infer-any",
"-Xlint:missing-interpolator",
"-Xlint:nullary-unit",
"-Xlint:private-shadow",
"-Xlint:stars-align",
"-Xlint:type-parameter-shadow",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
)
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, v)) if v <= 12 =>
Seq(
"-Yno-adapted-args",
"-Xlint:unsound-match",
"-Xfuture",
)
case _ =>
Nil
}
}
scalapropsVersion := "0.8.2"
libraryDependencies ++= Seq(
"com.propensive" %%% "magnolia" % "0.14.5",
"org.scalaz" %%% "scalaz-core" % "7.3.3",
"com.github.scalaprops" %%% "scalaprops-scalaz" % scalapropsVersion.value % "test",
"com.github.scalaprops" %%% "scalaprops" % scalapropsVersion.value % "test",
"com.github.scalaprops" %%% "scalaprops-magnolia" % "0.7.0" % "test"
)
(Compile / doc / scalacOptions) ++= {
val tag = tagOrHash.value
Seq(
"-sourcepath",
(LocalRootProject / baseDirectory).value.getAbsolutePath,
"-doc-source-url",
s"https://github.com/xuwei-k/scalaz-magnolia/tree/${tag}€{FILE_PATH}.scala"
)
}
})
.jsSettings(
scalacOptions += {
val a = (LocalRootProject / baseDirectory).value.toURI.toString
val g = "https://raw.githubusercontent.com/xuwei-k/scalaz-magnolia/" + tagOrHash.value
s"-P:scalajs:mapSourceURI:$a->$g/"
}
)
lazy val notPublish = nocomma {
publishArtifact := false
publish := {}
publishLocal := {}
PgpKeys.publishSigned := {}
PgpKeys.publishLocalSigned := {}
}
commonSettings
notPublish
name := "root"
Compile / sources := Nil
Test / sources := Nil