Skip to content

Commit 738df7f

Browse files
committed
[Scala] Compile cucumber-scala_2.12 against java8
- cucumber-scala_2.12 and scala-calculator are compiled to java8 byte code - Scala versions have been updated - 2.12.0-M1 to 2.12.2 - 2.11.8 to 2.11.11 - Manifest is used instead of Java reflection to provide type information Related issues: - #1087 - #1091 Fixes #1087
1 parent 947448d commit 738df7f

File tree

12 files changed

+285
-239
lines changed

12 files changed

+285
-239
lines changed

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_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_2.11/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.11)</name>
1414

15-
<properties>
16-
<scala.version>2.11.8</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.11.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.11.version}</version>
3127
<scope>test</scope>
3228
</dependency>
3329
</dependencies>

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>

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(" +(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)