-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sbt
132 lines (127 loc) · 3.96 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
import sbtrelease._
import ReleaseStateTransformations._
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.20"
val Scala213 = "2.13.16"
val unusedWarnings = Seq("-Ywarn-unused")
lazy val commonSettings = nocomma {
scalaVersion := Scala212
crossScalaVersions := Seq(Scala212, Scala213)
organization := "com.github.scalaprops"
homepage := Some(url("https://github.com/scalaprops/scalaprops-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>[email protected]:scalaprops/scalaprops-magnolia.git</url>
<connection>scm:git:[email protected]:scalaprops/scalaprops-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 scalapropsMagnolia = project
.in(file("."))
.settings(
scalapropsCoreSettings,
commonSettings,
Seq(Compile, Test).flatMap(c => c / console / scalacOptions --= unusedWarnings)
)
.settings(nocomma {
name := UpdateReadme.scalapropsMagnoliaName
description := "Generation of arbitrary case classes / ADTs instances with Scalaprops and Magnolia"
scalacOptions ++= unusedWarnings
scalacOptions += {
scalaBinaryVersion.value match {
case "2.13" =>
"-Xsource:3-cross"
case "2.12" =>
"-Xsource:3"
}
}
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.9.1"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
"com.softwaremill.magnolia1_2" %% "magnolia" % "1.1.10",
"com.github.scalaprops" %% "scalaprops-gen" % scalapropsVersion.value,
"com.github.scalaprops" %% "scalaprops" % scalapropsVersion.value % "test"
)
(Compile / doc / scalacOptions) ++= {
val tag = tagOrHash.value
Seq(
"-sourcepath",
(LocalRootProject / baseDirectory).value.getAbsolutePath,
"-doc-source-url",
s"https://github.com/scalaprops/scalaprops-magnolia/tree/${tag}€{FILE_PATH}.scala"
)
}
})