Skip to content

V8.x for Cucumber Core 7.x #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ See also the [CHANGELOG](https://github.com/cucumber/cucumber-jvm/blob/master/CH
----
## [Unreleased] (In Git)

Check out the [Upgrade Guide](docs/upgrade_v8.md).

### Added

- [Scala] Added `BeforeAll` and `AfterAll` hooks. See [Hooks](docs/hooks.md).

### Changed

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

### Deprecated

### Removed

- [Scala] Remove support for Scala 2.11
- [Core] Remove deprecated `io.cucumber.scala.TL`

### Fixed

## [7.1.0] (2021-08-06)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The table below shows the compatible versions:

| Cucumber Scala version | Cucumber Core version | Scala versions |
|------------------------|-----------------------|-----------------------|
| 8.x | 7.x | 2.12, 2.13, 3.0 |
| 7.x | 6.x | 2.11, 2.12, 2.13, 3.0 |
| 6.x | 6.x | 2.11, 2.12, 2.13 |
| 5.x | 5.x | 2.11, 2.12, 2.13 |
Expand All @@ -30,6 +31,7 @@ The table below shows the compatible versions:

- [Installation](./docs/install.md)
- Upgrade notes
- [Version 8.x](docs/upgrade_v8.md)
- [Version 7.x](docs/upgrade_v7.md)
- [Version 6.x](docs/upgrade_v6.md)
- [Version 5.x](docs/upgrade_v5.md)
Expand Down
12 changes: 4 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ ThisBuild / homepage := Some(

// Scala versions

val scala211 = "2.11.12"
val scala212 = "2.12.13"
val scala213 = "2.13.5"
val scala3 = "3.0.0"
Expand All @@ -39,7 +38,7 @@ scalaVersion := scala213

// Library versions

val cucumberVersion = "6.11.0"
val cucumberVersion = "7.0.0"
val jacksonVersion = "2.12.5"
val mockitoScalaVersion = "1.16.42"
val junitVersion = "4.13.2"
Expand All @@ -50,7 +49,6 @@ lazy val commonSettings = Seq(
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 11)) => ScalacOptions.scalacOptions211
case Some((2, 12)) => ScalacOptions.scalacOptions212
case Some((2, 13)) => ScalacOptions.scalacOptions213
case Some((3, 0)) => ScalacOptions.scalacOptions3
Expand Down Expand Up @@ -86,17 +84,15 @@ lazy val cucumberScala = (projectMatrix in file("cucumber-scala"))
),
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n <= 12 =>
case Some((2, n)) if n == 12 =>
List("org.scala-lang.modules" %% "scala-collection-compat" % "2.4.4")
case _ => Nil
}
},
Compile / unmanagedSourceDirectories ++= {
val sourceDir = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n <= 11 =>
Seq(sourceDir / "scala-2", sourceDir / "scala-2.11")
case Some((2, n)) if n > 11 =>
case Some((2, n)) =>
Seq(sourceDir / "scala-2")
case Some((3, 0)) =>
Seq(sourceDir / "scala-3")
Expand All @@ -123,7 +119,7 @@ lazy val cucumberScala = (projectMatrix in file("cucumber-scala"))
Seq(file)
}.taskValue
)
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212, scala211))
.jvmPlatform(scalaVersions = Seq(scala3, scala213, scala212))

// Examples project
lazy val examples = (projectMatrix in file("examples"))
Expand Down
162 changes: 0 additions & 162 deletions cucumber-scala/src/main/scala-2.11/io/cucumber/scala/package.scala

This file was deleted.

2 changes: 2 additions & 0 deletions cucumber-scala/src/main/scala/io/cucumber/scala/Aliases.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package io.cucumber.scala
*/
object Aliases {

type StaticHookDefinitionBody = () => Unit

type HookDefinitionBody = Scenario => Unit

type StepDefinitionBody = () => Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,25 @@ class GlueAdaptor(glue: Glue) {
): Unit = {

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

registry.stepDefinitions
.map(ScalaStepDefinition(_, scenarioScoped))
.foreach(glue.addStepDefinition)

// The presence of beforeAll/afterAll hooks with scenarioScoped is checked by checkConsistency above
if (!scenarioScoped) {
registry.beforeAllHooks
.map(ScalaStaticHookDefinition(_))
.foreach(glue.addBeforeAllHook)
registry.afterAllHooks
.map(ScalaStaticHookDefinition(_))
.foreach(glue.addAfterAllHook)
}

registry.beforeHooks
.map(ScalaHookDefinition(_, scenarioScoped))
.foreach(glue.addBeforeHook)
Expand All @@ -35,6 +46,7 @@ class GlueAdaptor(glue: Glue) {
registry.afterStepHooks
.map(ScalaHookDefinition(_, scenarioScoped))
.foreach(glue.addAfterStepHook)

registry.docStringTypes
.map(ScalaDocStringTypeDefinition(_, scenarioScoped))
.foreach(glue.addDocStringType)
Expand All @@ -44,6 +56,7 @@ class GlueAdaptor(glue: Glue) {
registry.parameterTypes
.map(ScalaParameterTypeDefinition(_, scenarioScoped))
.foreach(glue.addParameterType)

registry.defaultParameterTransformers
.map(ScalaDefaultParameterTransformerDefinition(_, scenarioScoped))
.foreach(glue.addDefaultParameterTransformer)
Expand Down
Loading