-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.sbt
238 lines (224 loc) · 8.32 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
import Dependencies._
import com.typesafe.tools.mima.core.{ProblemFilters, ReversedMissingMethodProblem}
import sbt.Test
// Aggregate root project settings only
name := "scalacheck-ops-root"
// Set the default version for Scala projects
// This is used by the sbt-ci-release plugin when picking the version of Scala to publish with
ThisBuild / scalaVersion := Scala_2_13
ThisBuild / organization := "com.rallyhealth"
ThisBuild / organizationName := "Rally Health"
ThisBuild / scmInfo := Some(
ScmInfo(url("https://github.com/rallyhealth/scalacheck-ops"), "scm:git:[email protected]:rallyhealth/scalacheck-ops.git")
)
ThisBuild / homepage := Some(url("https://github.com/rallyhealth/scalacheck-ops"))
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))
// reload sbt when the build files change
Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / developers := List(
Developer(id = "jeffmay", name = "Jeff May", email = "[email protected]", url = url("https://github.com/jeffmay"))
)
// don't look for previous versions of the root project, they don't exist
mimaFailOnNoPrevious := false
// don't publish the aggregate root project
publish / skip := true
// SBT CI Release Plugin
inThisBuild(
Seq(
githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"), JavaSpec.temurin("17")),
githubWorkflowScalaVersions := Seq(Scala_2_12, Scala_2_13, Scala_3),
githubWorkflowTargetTags ++= Seq("v*"),
githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v"))),
githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
List("ci-release"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"
)
)
),
// Remove the ++ from the preambles since we use sbt-projectmatrix
githubWorkflowBuildSbtStepPreamble := Seq(),
)
)
def commonSettings(subProject: Option[String]): Seq[Setting[_]] = {
val artifact = ScalaCheckAxis.current(_.artifact(subProject))
val mimaPreviousVersion = scalaBinaryVersion(v => if (v == "3") "2.8.0" else "2.6.0")
Seq(
name := artifact.value,
mimaPreviousArtifacts := {
val scVersion = ScalaCheckAxis.current.value.scalaCheckVersion
CrossVersion.partialVersion(scVersion) match {
case Some((1, x)) if x > 15 => Set.empty
case _ =>
Set(organization.value %% artifact.value % mimaPreviousVersion.value)
}
},
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[ReversedMissingMethodProblem](
"org.scalacheck.ops.time.ImplicitJavaTimeGenerators.arbOffsetDateTime"
)
),
scalacOptions ++= Seq(
// "-Xfatal-warnings", // some methods in Scala 2.13 are deprecated, but I don't want to maintain to copies of source
"-deprecation:false",
"-feature",
"-encoding",
"UTF-8"
) ++ {
if (scalaBinaryVersion.value == "3") Nil
else {
val scVersion = scalaVersion.value
Seq(
"-Xlint",
"-Ywarn-dead-code"
) ++ {
scVersion match {
case Scala_2_13 =>
Seq(
"-Ymacro-annotations",
)
case _ => Nil
}
}
}
},
// Allow publishing ScalaDoc by disabling link warnings
Compile / doc / scalacOptions += "-no-link-warnings",
Test / doc / scalacOptions += "-no-link-warnings",
// show full stack traces in test failures
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oF"),
)
}
lazy val core = projectMatrix
.settings(commonSettings(subProject = None))
.settings(
// default locations, overridden in custom rows where needed
Compile / sourceDirectory := (file("core") / "src" / "main").getAbsoluteFile,
Test / sourceDirectory := (file("core") / "src" / "test").getAbsoluteFile,
libraryDependencies ++= Seq(
izumiReflect,
tagging,
ScalaCheckAxis.current.value.scalaCheck,
newtype, // Test-only
ScalaCheckAxis.current.value.scalaTest // Test-only
) ++ (scalaVersion.value match {
case CrossVersion.PartialVersion("2", "12", _*) =>
Seq(
compilerPlugin(("org.scalamacros" % "paradise" % "2.1.1").cross(CrossVersion.full))
)
case _ => Nil
})
)
.customRow(
scalaVersions = ScalaCheckAxis.v1_13.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1_13, VirtualAxis.jvm),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1_13.scalaVersions,
Test / sourceDirectory := (file("core-1-13-test") / "src" / "test").getAbsoluteFile
)
)
.customRow(
scalaVersions = ScalaCheckAxis.v1_14.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1_14, VirtualAxis.jvm),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1_14.scalaVersions,
libraryDependencies +=
ScalaCheckAxis.current.value.scalaTestPlusScalaCheck(scalaVersion.value)
)
)
.customRow(
scalaVersions = ScalaCheckAxis.v1_15.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1_15, VirtualAxis.jvm),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1_15.scalaVersions,
libraryDependencies +=
ScalaCheckAxis.current.value.scalaTestPlusScalaCheck(scalaVersion.value)
)
)
.customRow(
scalaVersions = ScalaCheckAxis.v1.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1, VirtualAxis.jvm),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1.scalaVersions,
libraryDependencies +=
ScalaCheckAxis.current.value.scalaTestPlusScalaCheck(scalaVersion.value)
)
)
.jsPlatform(
scalaVersions = ScalaCheckAxis.v1_15.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1_15),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1_15.scalaVersions,
libraryDependencies +=
ScalaCheckAxis.current.value.scalaTestPlusScalaCheck(scalaVersion.value)
)
)
.jsPlatform(
scalaVersions = ScalaCheckAxis.v1.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1.scalaVersions,
libraryDependencies +=
ScalaCheckAxis.current.value.scalaTestPlusScalaCheck(scalaVersion.value)
)
)
.nativePlatform(
scalaVersions = ScalaCheckAxis.v1_15.scalaVersions.filterNot(_ == Scala_2_12),
axisValues = Seq(ScalaCheckAxis.v1_15),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1_15.scalaVersions.filterNot(_ == Scala_2_12),
libraryDependencies +=
ScalaCheckAxis.current.value.scalaTestPlusScalaCheck(scalaVersion.value)
)
)
.nativePlatform(
scalaVersions = ScalaCheckAxis.v1.scalaVersions.filterNot(_ == Scala_2_12),
axisValues = Seq(ScalaCheckAxis.v1),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1.scalaVersions.filterNot(_ == Scala_2_12),
libraryDependencies +=
ScalaCheckAxis.current.value.scalaTestPlusScalaCheck(scalaVersion.value)
)
)
lazy val joda = projectMatrix
.settings(commonSettings(subProject = Some("joda")))
.dependsOn(core % "compile;test->test")
.settings(
Compile / sourceDirectory := file(s"joda/src/main").getAbsoluteFile,
Test / sourceDirectory := file(s"joda/src/test").getAbsoluteFile,
// don't include dependencies that come from scalacheck-ops core project
libraryDependencies += jodaTime
)
.customRow(
scalaVersions = ScalaCheckAxis.v1_13.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1_13, VirtualAxis.jvm),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1_13.scalaVersions
)
)
.customRow(
scalaVersions = ScalaCheckAxis.v1_14.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1_14, VirtualAxis.jvm),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1_14.scalaVersions
)
)
.customRow(
scalaVersions = ScalaCheckAxis.v1_15.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1_15, VirtualAxis.jvm),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1_15.scalaVersions
)
)
.customRow(
scalaVersions = ScalaCheckAxis.v1.scalaVersions,
axisValues = Seq(ScalaCheckAxis.v1, VirtualAxis.jvm),
settings = Seq(
crossScalaVersions := ScalaCheckAxis.v1.scalaVersions
)
)