-
Notifications
You must be signed in to change notification settings - Fork 30
/
build.sbt
211 lines (191 loc) · 6.42 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
import ReleaseTransformations._
import xerial.sbt.Sonatype.sonatypeSettings
// Metadata
ThisBuild / organization := "io.cucumber"
ThisBuild / organizationName := "Cucumber"
ThisBuild / organizationHomepage := Some(url("https://github.com/cucumber"))
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/cucumber/cucumber-jvm-scala"),
"scm:[email protected]:cucumber/cucumber-jvm-scala.git"
)
)
ThisBuild / developers := List(
Developer(
"cucumber",
"Cucumber Developers",
url("https://github.com/cucumber")
)
)
ThisBuild / licenses := Seq(
"MIT License" -> url("http://www.opensource.org/licenses/mit-license")
)
ThisBuild / description := "Cucumber for Scala"
ThisBuild / homepage := Some(
url("https://github.com/cucumber/cucumber-jvm-scala")
)
// Scala versions
val scala212 = "2.12.18"
val scala213 = "2.13.15"
val scala3 = "3.3.1"
scalaVersion := scala213
// Library versions
val cucumberVersion = "7.20.1"
val jacksonVersion = "2.18.1"
val mockitoScalaVersion = "1.17.37"
val junitVersion = "4.13.2"
// Projects and settings
lazy val commonSettings = Seq(
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => ScalacOptions.scalacOptions212
case Some((2, 13)) => ScalacOptions.scalacOptions213
case Some((3, _)) => ScalacOptions.scalacOptions3
case _ => Seq()
}
}
)
lazy val root = (project in file("."))
.settings(commonSettings)
.settings(
publishArtifact := false
)
.aggregate(
cucumberScala.projectRefs ++
integrationTestsCommon.projectRefs ++
integrationTestsJackson.projectRefs ++
integrationTestsPicoContainer.projectRefs ++
examples.projectRefs: _*
)
// Main project
lazy val cucumberScala = (projectMatrix in file("cucumber-scala"))
.settings(commonSettings)
.settings(
name := "cucumber-scala",
libraryDependencies ++= Seq(
"io.cucumber" % "cucumber-core" % cucumberVersion,
// Users have to provide it (for JacksonDefaultDataTableTransformer)
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion % Provided,
"junit" % "junit" % junitVersion % Test,
("org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test)
.cross(CrossVersion.for3Use2_13)
),
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n == 12 =>
List("org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0")
case _ => Nil
}
},
Compile / unmanagedSourceDirectories ++= {
val sourceDir = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) =>
Seq(sourceDir / "scala-2")
case Some((3, 0)) =>
Seq(sourceDir / "scala-3")
case _ =>
Seq()
}
},
Test / unmanagedSourceDirectories ++= {
val testSourceDir = (Test / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
Seq(testSourceDir / "scala-2")
case Some((3, 0)) =>
Seq(testSourceDir / "scala-3")
case _ =>
Seq()
}
},
// Generate I18n traits
Compile / sourceGenerators += Def.task {
val file =
(Compile / sourceManaged).value / "io/cucumber/scala" / "I18n.scala"
IO.write(file, I18nGenerator.i18n)
Seq(file)
}.taskValue
)
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212))
// Integration tests
lazy val integrationTestsCommon =
(projectMatrix in file("integration-tests/common"))
.settings(commonSettings)
.settings(
name := "integration-tests-common",
libraryDependencies ++= Seq(
"junit" % "junit" % junitVersion % Test,
"io.cucumber" % "cucumber-junit" % cucumberVersion % Test
),
publishArtifact := false
)
.dependsOn(cucumberScala % Test)
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212))
lazy val integrationTestsJackson =
(projectMatrix in file("integration-tests/jackson"))
.settings(commonSettings)
.settings(
name := "integration-tests-jackson",
libraryDependencies ++= Seq(
"junit" % "junit" % junitVersion % Test,
"io.cucumber" % "cucumber-junit" % cucumberVersion % Test,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion % Test
),
publishArtifact := false
)
.dependsOn(cucumberScala % Test)
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212))
lazy val integrationTestsPicoContainer =
(projectMatrix in file("integration-tests/picocontainer"))
.settings(commonSettings)
.settings(
name := "integration-tests-picocontainer",
libraryDependencies ++= Seq(
"junit" % "junit" % junitVersion % Test,
"io.cucumber" % "cucumber-junit" % cucumberVersion % Test,
"io.cucumber" % "cucumber-picocontainer" % cucumberVersion % Test
),
publishArtifact := false
)
.dependsOn(cucumberScala % Test)
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212))
// Examples project
lazy val examples = (projectMatrix in file("examples"))
.settings(commonSettings)
.settings(
name := "scala-examples",
libraryDependencies ++= Seq(
"io.cucumber" % "cucumber-junit" % cucumberVersion % Test,
"junit" % "junit" % junitVersion % Test
),
publishArtifact := false
)
.dependsOn(cucumberScala % Test)
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212))
// Version policy check
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / versionPolicyIntention := Compatibility.BinaryAndSourceCompatible
// Release & Publish
Global / publishMavenStyle := true
Global / publishTo := sonatypePublishToBundle.value
// https://github.com/xerial/sbt-sonatype#using-with-sbt-release-plugin
releaseCrossBuild := true
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
// the 2 following steps are part of the Cucumber release process
//commitReleaseVersion,
//tagRelease,
releaseStepCommandAndRemaining("publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion
// the 2 following steps are part of the Cucumber release process
//commitNextVersion,
//pushChanges
)