Skip to content

Commit 8f56641

Browse files
committed
[Core] Extract Gherkin compatibility layer
Gherkin 6 introduced the `Rule` keyword and a new AST structure. This poses several problems. 1. Cucumber-JVM is closely tied to the Pickle structure of Gherkin 5. 2. The HTML and JSON formatters use the Gherkin 5 parser. 3. The JSON formatter is the defacto output standard for third party tools. 4. There is no schema for the JSON formatters output. To phase out the JSON formatter we'll need an alternative. This alternative is the `message` formatter. This plugin will write the output of Cucumbers execution to protobuf or ndjson file using the schema defined in `cucumber-messages`. Because `cucumber-messages` for Gherkin can only be generated by Gherkin 8 we need a way to run both Gherkin 5 and Gherkin 8 next to each other. By extracting a compatibility layer we can use both Gherkin 5 and Gherkin 8.
1 parent 2f76520 commit 8f56641

File tree

158 files changed

+2165
-1748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+2165
-1748
lines changed

core/pom.xml

+46-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34

45
<parent>
@@ -21,9 +22,24 @@
2122
</properties>
2223

2324
<dependencies>
25+
<dependency>
26+
<groupId>io.cucumber</groupId>
27+
<artifactId>cucumber-gherkin</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>io.cucumber</groupId>
31+
<artifactId>cucumber-gherkin-vintage</artifactId>
32+
</dependency>
33+
2434
<dependency>
2535
<groupId>io.cucumber</groupId>
2636
<artifactId>gherkin</artifactId>
37+
<version>${gherkin-vintage.version}</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>io.cucumber</groupId>
41+
<artifactId>gherkin-jvm-deps</artifactId>
42+
<version>1.0.6</version>
2743
</dependency>
2844
<dependency>
2945
<groupId>io.cucumber</groupId>
@@ -125,6 +141,35 @@
125141
</archive>
126142
</configuration>
127143
</plugin>
144+
145+
<plugin>
146+
<groupId>org.apache.maven.plugins</groupId>
147+
<artifactId>maven-shade-plugin</artifactId>
148+
<version>3.1.0</version>
149+
<executions>
150+
<execution>
151+
<phase>package</phase>
152+
<goals>
153+
<goal>shade</goal>
154+
</goals>
155+
<configuration>
156+
<artifactSet>
157+
<includes>
158+
<include>io.cucumber:gherkin</include>
159+
<include>io.cucumber:gherkin-jvm-deps</include>
160+
</includes>
161+
</artifactSet>
162+
<relocations>
163+
<relocation>
164+
<pattern>gherkin</pattern>
165+
<shadedPattern>io.cucumber.core.internal.gherkin</shadedPattern>
166+
</relocation>
167+
</relocations>
168+
</configuration>
169+
</execution>
170+
</executions>
171+
</plugin>
172+
128173
</plugins>
129174
</build>
130175

core/src/main/java/io/cucumber/core/eventbus/EventBus.java

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.cucumber.core.eventbus;
22

33
import java.time.Instant;
4+
import java.util.UUID;
45

56
import io.cucumber.plugin.event.Event;
67
import io.cucumber.plugin.event.EventPublisher;
@@ -9,6 +10,8 @@ public interface EventBus extends EventPublisher {
910

1011
Instant getInstant();
1112

13+
UUID generateId();
14+
1215
void send(Event event);
1316

1417
void sendAll(Iterable<Event> queue);

core/src/main/java/io/cucumber/core/feature/Container.java

-8
This file was deleted.

core/src/main/java/io/cucumber/core/feature/CucumberExamples.java

-40
This file was deleted.

core/src/main/java/io/cucumber/core/feature/CucumberFeature.java

-85
This file was deleted.

core/src/main/java/io/cucumber/core/feature/CucumberPickle.java

-93
This file was deleted.

core/src/main/java/io/cucumber/core/feature/CucumberScenario.java

-30
This file was deleted.

core/src/main/java/io/cucumber/core/feature/CucumberScenarioDefinition.java

-4
This file was deleted.

core/src/main/java/io/cucumber/core/feature/CucumberScenarioOutline.java

-34
This file was deleted.

0 commit comments

Comments
 (0)