Skip to content

Commit 2eb9c57

Browse files
committed
WIP
1 parent 062758b commit 2eb9c57

File tree

13 files changed

+210
-177
lines changed

13 files changed

+210
-177
lines changed

examples/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<module>java-calculator</module>
1818
<module>java-calculator-testng</module>
1919
<module>groovy-calculator</module>
20-
<module>scala-calculator</module>
2120
<module>pax-exam</module>
2221
</modules>
2322

@@ -28,6 +27,7 @@
2827
<jdk>1.8</jdk>
2928
</activation>
3029
<modules>
30+
<module>scala-calculator</module>
3131
<module>java-wicket</module>
3232
<module>java-webbit-websockets-selenium</module>
3333
</modules>

examples/scala-calculator/pom.xml

+15-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
<parent>
55
<groupId>io.cucumber</groupId>
6-
<artifactId>cucumber-jvm</artifactId>
7-
<relativePath>../../pom.xml</relativePath>
6+
<artifactId>cucumber-examples</artifactId>
87
<version>2.0.0-SNAPSHOT</version>
98
</parent>
109

@@ -20,7 +19,8 @@
2019
</dependency>
2120
<dependency>
2221
<groupId>io.cucumber</groupId>
23-
<artifactId>cucumber-scala_2.11</artifactId>
22+
<artifactId>cucumber-scala_2.12</artifactId>
23+
<version>${project.version}</version>
2424
<scope>test</scope>
2525
</dependency>
2626
<dependency>
@@ -36,23 +36,28 @@
3636
<dependency>
3737
<groupId>org.scala-lang</groupId>
3838
<artifactId>scala-library</artifactId>
39-
<version>${scala.latest.version}</version>
40-
<scope>test</scope>
39+
<version>${scala.2.12.version}</version>
4140
</dependency>
4241
<dependency>
4342
<groupId>org.scala-lang</groupId>
4443
<artifactId>scala-compiler</artifactId>
45-
<version>${scala.latest.version}</version>
46-
<scope>test</scope>
44+
<version>${scala.2.12.version}</version>
4745
</dependency>
4846
</dependencies>
4947

5048
<build>
5149
<plugins>
5250
<plugin>
53-
<groupId>org.scala-tools</groupId>
54-
<artifactId>maven-scala-plugin</artifactId>
55-
<version>2.15.2</version>
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-compiler-plugin</artifactId>
53+
<configuration>
54+
<source>1.8</source>
55+
<target>1.8</target>
56+
</configuration>
57+
</plugin>
58+
<plugin>
59+
<groupId>net.alchim31.maven</groupId>
60+
<artifactId>scala-maven-plugin</artifactId>
5661
<configuration>
5762
<!--encoding>UTF-8</encoding-->
5863
<excludes>

examples/scala-calculator/src/main/scala/cucumber/examples/scalacalculator/RpnCalculator.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cucumber.examples.scalacalculator
22

3-
import collection.mutable.Stack
3+
import scala.collection.mutable.Queue
4+
45

56
sealed trait Arg
67

@@ -13,18 +14,18 @@ case class Op(value: String) extends Arg
1314
case class Val(value: Double) extends Arg
1415

1516
class RpnCalculator {
16-
private val stack = new Stack[Double]
17+
private val stack = new Queue[Double]
1718

1819
private def op(f: (Double, Double) => Double) =
19-
stack push f(stack.pop(), stack.pop())
20+
stack += f(stack.dequeue(), stack.dequeue())
2021

2122
def push(arg: Arg) {
2223
arg match {
2324
case Op("+") => op(_ + _)
2425
case Op("-") => op(_ - _)
2526
case Op("*") => op(_ * _)
2627
case Op("/") => op(_ / _)
27-
case Val(value) => stack push value
28+
case Val(value) => stack += value
2829
}
2930
}
3031

pom.xml

+3-7
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
<guice.version>4.0</guice.version>
3535
<!-- Remember to bounce version in examples/clojure_cukes/project.clj as well -->
3636
<clojure.version>1.8.0</clojure.version>
37-
<!-- This is only here for the example project to use, the 3 scala projects maintain their own versions -->
38-
<scala.latest.version>2.11.8</scala.latest.version>
37+
<scala.2.12.version>2.12.2</scala.2.12.version>
38+
<scala.2.11.version>2.11.11</scala.2.11.version>
39+
<scala.2.10.version>2.10.6</scala.2.10.version>
3940
<gosu.version>1.14.6</gosu.version>
4041
<rhino.version>1.7.7.1</rhino.version>
4142
<jsoup.version>1.9.2</jsoup.version>
@@ -163,11 +164,6 @@
163164
<artifactId>cucumber-picocontainer</artifactId>
164165
<version>${project.version}</version>
165166
</dependency>
166-
<dependency>
167-
<groupId>io.cucumber</groupId>
168-
<artifactId>cucumber-scala_2.11</artifactId>
169-
<version>${project.version}</version>
170-
</dependency>
171167
<dependency>
172168
<groupId>info.cukes</groupId>
173169
<artifactId>cucumber-html</artifactId>

scala/pom.xml

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
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"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24
<modelVersion>4.0.0</modelVersion>
35

46
<parent>
@@ -15,9 +17,20 @@
1517
<modules>
1618
<module>scala_2.11</module>
1719
<module>scala_2.10</module>
18-
<module>scala_2.12</module>
1920
</modules>
2021

22+
<profiles>
23+
<profile>
24+
<id>java8</id>
25+
<activation>
26+
<jdk>1.8</jdk>
27+
</activation>
28+
<modules>
29+
<module>scala_2.12</module>
30+
</modules>
31+
</profile>
32+
</profiles>
33+
2134
<dependencies>
2235
<dependency>
2336
<groupId>io.cucumber</groupId>
@@ -104,7 +117,9 @@
104117
<phase>generate-sources</phase>
105118
<configuration>
106119
<target>
107-
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="maven.plugin.classpath" />
120+
<taskdef name="groovy"
121+
classname="org.codehaus.groovy.ant.Groovy"
122+
classpathref="maven.plugin.classpath"/>
108123

109124
<groovy><![CDATA[
110125
import groovy.text.SimpleTemplateEngine

scala/scala_2.10/pom.xml

+2-6
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,18 @@
1212
<packaging>jar</packaging>
1313
<name>Cucumber-JVM: Scala (2.10)</name>
1414

15-
<properties>
16-
<scala.version>2.10.6</scala.version>
17-
</properties>
18-
1915
<dependencies>
2016
<dependency>
2117
<groupId>org.scala-lang</groupId>
2218
<artifactId>scala-compiler</artifactId>
23-
<version>${scala.version}</version>
19+
<version>${scala.2.10.version}</version>
2420
<scope>provided</scope>
2521
</dependency>
2622

2723
<dependency>
2824
<groupId>org.scala-lang</groupId>
2925
<artifactId>scala-library</artifactId>
30-
<version>${scala.version}</version>
26+
<version>${scala.2.10.version}</version>
3127
<scope>test</scope>
3228
</dependency>
3329
</dependencies>

scala/scala_2.11/pom.xml

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,19 @@
1212
<packaging>jar</packaging>
1313
<name>Cucumber-JVM: Scala (2.11)</name>
1414

15-
<properties>
16-
<scala.version>2.11.8</scala.version>
17-
</properties>
1815

1916
<dependencies>
2017
<dependency>
2118
<groupId>org.scala-lang</groupId>
2219
<artifactId>scala-compiler</artifactId>
23-
<version>${scala.version}</version>
20+
<version>${scala.2.11.version}</version>
2421
<scope>provided</scope>
2522
</dependency>
2623

2724
<dependency>
2825
<groupId>org.scala-lang</groupId>
2926
<artifactId>scala-library</artifactId>
30-
<version>${scala.version}</version>
27+
<version>${scala.2.11.version}</version>
3128
<scope>test</scope>
3229
</dependency>
3330
</dependencies>

scala/scala_2.12/pom.xml

+10-10
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,18 @@
1212
<packaging>jar</packaging>
1313
<name>Cucumber-JVM: Scala (2.12)</name>
1414

15-
<properties>
16-
<!--
17-
Upgrading to 2.12.0-M2 or higher causes:
18-
19-
initializationError(cucumber.runtime.scala.test.RunCukesTest) Time elapsed: 0.006 sec <<< ERROR! java.util.NoSuchElementException: next on empty iterator [no stack trace] -->
20-
<scala.version>2.12.0-M1</scala.version>
21-
</properties>
22-
2315
<dependencies>
2416
<dependency>
2517
<groupId>org.scala-lang</groupId>
2618
<artifactId>scala-compiler</artifactId>
27-
<version>${scala.version}</version>
19+
<version>${scala.2.12.version}</version>
2820
<scope>provided</scope>
2921
</dependency>
3022

3123
<dependency>
3224
<groupId>org.scala-lang</groupId>
3325
<artifactId>scala-library</artifactId>
34-
<version>${scala.version}</version>
26+
<version>${scala.2.12.version}</version>
3527
<scope>test</scope>
3628
</dependency>
3729
</dependencies>
@@ -45,6 +37,14 @@
4537
</testResource>
4638
</testResources>
4739
<plugins>
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-compiler-plugin</artifactId>
43+
<configuration>
44+
<source>1.8</source>
45+
<target>1.8</target>
46+
</configuration>
47+
</plugin>
4848
<plugin>
4949
<groupId>net.alchim31.maven</groupId>
5050
<artifactId>scala-maven-plugin</artifactId>

scala/sources/gen.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ for (i <- 1 to 22) {
77
val f = "(" + ts + ") => Any"
88
val p1 = "def apply[" + ts + "](f: " + f + ")"
99
val p2 = "(implicit " + (1 to i).map(n => "m" + n + ":Manifest[T" + n + "]").mkString(", ") + ")"
10-
val register = "\n register(functionParams(f)) {\n"
10+
val register = "\n register(functionParams(" +(1 to i).map(n => "m" + n).mkString(", ") + ")) {\n"
1111
val pf = " case List(" + (1 to i).map("a" + _ + ":AnyRef").mkString(", ") + ") => \n f(" + (1 to i).map(n => "a" + n + ".asInstanceOf[T" + n + "]").mkString(",\n ") + ")"
1212
val closeRegister = "\n }\n}"
1313

0 commit comments

Comments
 (0)