Skip to content

Commit 95e0aa7

Browse files
authored
Merge pull request #240 from cucumber/v8.x
V8.x for Cucumber Core 7.x
2 parents 26a6bfd + c4ecd0f commit 95e0aa7

34 files changed

+599
-287
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,23 @@ See also the [CHANGELOG](https://github.com/cucumber/cucumber-jvm/blob/master/CH
99
----
1010
## [Unreleased] (In Git)
1111

12+
Check out the [Upgrade Guide](docs/upgrade_v8.md).
13+
1214
### Added
1315

16+
- [Scala] Added `BeforeAll` and `AfterAll` hooks. See [Hooks](docs/hooks.md).
17+
1418
### Changed
1519

16-
- [Build] Upgrade sbt to 1.5.5
20+
- [Core] Updated `cucumber-core` dependency to [7.0.0](https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md)
1721

1822
### Deprecated
1923

2024
### Removed
2125

26+
- [Scala] Remove support for Scala 2.11
27+
- [Core] Remove deprecated `io.cucumber.scala.TL`
28+
2229
### Fixed
2330

2431
## [7.1.0] (2021-08-06)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The table below shows the compatible versions:
2121

2222
| Cucumber Scala version | Cucumber Core version | Scala versions |
2323
|------------------------|-----------------------|-----------------------|
24+
| 8.x | 7.x | 2.12, 2.13, 3.0 |
2425
| 7.x | 6.x | 2.11, 2.12, 2.13, 3.0 |
2526
| 6.x | 6.x | 2.11, 2.12, 2.13 |
2627
| 5.x | 5.x | 2.11, 2.12, 2.13 |
@@ -30,6 +31,7 @@ The table below shows the compatible versions:
3031

3132
- [Installation](./docs/install.md)
3233
- Upgrade notes
34+
- [Version 8.x](docs/upgrade_v8.md)
3335
- [Version 7.x](docs/upgrade_v7.md)
3436
- [Version 6.x](docs/upgrade_v6.md)
3537
- [Version 5.x](docs/upgrade_v5.md)

build.sbt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ ThisBuild / homepage := Some(
3030

3131
// Scala versions
3232

33-
val scala211 = "2.11.12"
3433
val scala212 = "2.12.13"
3534
val scala213 = "2.13.5"
3635
val scala3 = "3.0.0"
@@ -39,7 +38,7 @@ scalaVersion := scala213
3938

4039
// Library versions
4140

42-
val cucumberVersion = "6.11.0"
41+
val cucumberVersion = "7.0.0"
4342
val jacksonVersion = "2.12.5"
4443
val mockitoScalaVersion = "1.16.42"
4544
val junitVersion = "4.13.2"
@@ -50,7 +49,6 @@ lazy val commonSettings = Seq(
5049
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
5150
scalacOptions ++= {
5251
CrossVersion.partialVersion(scalaVersion.value) match {
53-
case Some((2, 11)) => ScalacOptions.scalacOptions211
5452
case Some((2, 12)) => ScalacOptions.scalacOptions212
5553
case Some((2, 13)) => ScalacOptions.scalacOptions213
5654
case Some((3, 0)) => ScalacOptions.scalacOptions3
@@ -86,17 +84,15 @@ lazy val cucumberScala = (projectMatrix in file("cucumber-scala"))
8684
),
8785
libraryDependencies ++= {
8886
CrossVersion.partialVersion(scalaVersion.value) match {
89-
case Some((2, n)) if n <= 12 =>
87+
case Some((2, n)) if n == 12 =>
9088
List("org.scala-lang.modules" %% "scala-collection-compat" % "2.4.4")
9189
case _ => Nil
9290
}
9391
},
9492
Compile / unmanagedSourceDirectories ++= {
9593
val sourceDir = (Compile / sourceDirectory).value
9694
CrossVersion.partialVersion(scalaVersion.value) match {
97-
case Some((2, n)) if n <= 11 =>
98-
Seq(sourceDir / "scala-2", sourceDir / "scala-2.11")
99-
case Some((2, n)) if n > 11 =>
95+
case Some((2, n)) =>
10096
Seq(sourceDir / "scala-2")
10197
case Some((3, 0)) =>
10298
Seq(sourceDir / "scala-3")
@@ -123,7 +119,7 @@ lazy val cucumberScala = (projectMatrix in file("cucumber-scala"))
123119
Seq(file)
124120
}.taskValue
125121
)
126-
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212, scala211))
122+
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212))
127123

128124
// Examples project
129125
lazy val examples = (projectMatrix in file("examples"))

cucumber-scala/src/main/scala-2.11/io/cucumber/scala/package.scala

Lines changed: 0 additions & 162 deletions
This file was deleted.

cucumber-scala/src/main/scala/io/cucumber/scala/Aliases.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ package io.cucumber.scala
44
*/
55
object Aliases {
66

7+
type StaticHookDefinitionBody = () => Unit
8+
79
type HookDefinitionBody = Scenario => Unit
810

911
type StepDefinitionBody = () => Unit

cucumber-scala/src/main/scala/io/cucumber/scala/GlueAdaptor.scala

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,25 @@ class GlueAdaptor(glue: Glue) {
1515
): Unit = {
1616

1717
// If the registry is not consistent, this indicates a mistake in the users definition and we want to let him know.
18-
registry.checkConsistency().left.foreach {
18+
registry.checkConsistency(scenarioScoped).left.foreach {
1919
(ex: IncorrectHookDefinitionException) =>
2020
throw ex
2121
}
2222

2323
registry.stepDefinitions
2424
.map(ScalaStepDefinition(_, scenarioScoped))
2525
.foreach(glue.addStepDefinition)
26+
27+
// The presence of beforeAll/afterAll hooks with scenarioScoped is checked by checkConsistency above
28+
if (!scenarioScoped) {
29+
registry.beforeAllHooks
30+
.map(ScalaStaticHookDefinition(_))
31+
.foreach(glue.addBeforeAllHook)
32+
registry.afterAllHooks
33+
.map(ScalaStaticHookDefinition(_))
34+
.foreach(glue.addAfterAllHook)
35+
}
36+
2637
registry.beforeHooks
2738
.map(ScalaHookDefinition(_, scenarioScoped))
2839
.foreach(glue.addBeforeHook)
@@ -35,6 +46,7 @@ class GlueAdaptor(glue: Glue) {
3546
registry.afterStepHooks
3647
.map(ScalaHookDefinition(_, scenarioScoped))
3748
.foreach(glue.addAfterStepHook)
49+
3850
registry.docStringTypes
3951
.map(ScalaDocStringTypeDefinition(_, scenarioScoped))
4052
.foreach(glue.addDocStringType)
@@ -44,6 +56,7 @@ class GlueAdaptor(glue: Glue) {
4456
registry.parameterTypes
4557
.map(ScalaParameterTypeDefinition(_, scenarioScoped))
4658
.foreach(glue.addParameterType)
59+
4760
registry.defaultParameterTransformers
4861
.map(ScalaDefaultParameterTransformerDefinition(_, scenarioScoped))
4962
.foreach(glue.addDefaultParameterTransformer)

0 commit comments

Comments
 (0)