This repository has been archived by the owner on Jun 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpom.xml
268 lines (249 loc) · 11.6 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jruby</artifactId>
<version>2.0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Cucumber-JVM: JRuby</name>
<prerequisites>
<maven>${minimum.maven.version}</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<minimum.maven.version>3.3</minimum.maven.version>
<outputDirectory>${project.build.directory}</outputDirectory>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<cucumber.version>2.0.1</cucumber.version>
<groovy.version>2.4.12</groovy.version>
<gherkin.version>4.1.3</gherkin.version>
<junit.version>4.12</junit.version>
<jruby.version>9.1.12.0</jruby.version>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>${jruby.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>lib</directory>
<includes>
<include>**/*.*</include>
</includes>
</fileset>
<fileset>
<directory>.</directory>
<includes>
<include>*.gem</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>${gherkin.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-i18n-sources</id>
<goals>
<goal>run</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<target>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="maven.plugin.classpath" />
<groovy><![CDATA[
def template = """\
module Cucumber
module Runtime
module JRuby
module Dsl
<% i18n.stepKeywords.findAll { !it.contains('*') && !it.matches("^\\\\d.*") }.unique().each { kw -> %>
def \${java.text.Normalizer.normalize(kw.replaceAll("[\\\\s',!]", ""), java.text.Normalizer.Form.NFC)}(regexp, &proc)
register_stepdef(regexp, proc)
end
<% } %>
end
end
end
end
"""
def dialectProvider = new gherkin.GherkinDialectProvider()
gherkin.GherkinDialectProvider.DIALECTS.keySet().each { language ->
def dialect = dialectProvider.getDialect(language, null)
def normalized_language = dialect.language.replaceAll("[\\s-]", "_").toLowerCase()
def engine = new groovy.text.SimpleTemplateEngine()
def binding = ["i18n":dialect]
def source = engine.createTemplate(template).make(binding).toString()
def file = new File(project.baseDir, "target${File.separator}generated-resources${File.separator}i18n${File.separator}cucumber${File.separator}api${File.separator}jruby${File.separator}${normalized_language}.rb")
file.parentFile.mkdirs()
file.write(source, "UTF-8")
}
]]></groovy>
</target>
</configuration>
</execution>
<execution>
<id>package-gem</id>
<phase>package</phase>
<configuration>
<target>
<!-- add jars to lib -->
<copy file="${project.build.directory}/${project.build.finalName}-shaded.jar" tofile="${basedir}/lib/cucumber-jruby-shaded.jar" />
<!-- build the gem file using jruby -->
<echo message="Building Gem" />
<java jar="${maven.dependency.org.jruby.jruby-complete.jar.path}" failonerror="true" fork="true">
<!-- clobber PATH to prevent `gem` on the PATH from being picked up -->
<env key="PATH" value="" />
<sysproperty key="cucumber-jvm.version" value="${project.version}" />
<arg value="-S" />
<arg value="gem" />
<arg value="build" />
<arg value="cucumber-jvm.gemspec" />
</java>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>jruby-cli-test</id>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- also run the CLI test to ensure that stuff works via the CLI as well -->
<echo message="Running cucumber via the CLI..." />
<java jar="${maven.dependency.org.jruby.jruby-complete.jar.path}" fork="true" failonerror="true" newenvironment="true" maxmemory="512m">
<env key="PATH" value="" />
<arg value="-S" />
<arg value="bin/cucumber-jvm" />
<arg value="--glue" />
<arg value="src/test/resources" />
<arg value="src/test/resources" />
</java>
</target>
</configuration>
</execution>
<execution>
<id>deploy-gem</id>
<phase>deploy</phase>
<configuration>
<target unless="no.gem.deploy">
<!-- install the jruby-openssl gem first! -->
<echo message="installing jruby-openssl..." />
<java jar="${maven.dependency.org.jruby.jruby-complete.jar.path}" failonerror="true" fork="true">
<env key="PATH" value="" />
<arg value="-S" />
<arg value="gem" />
<arg value="install" />
<arg value="jruby-openssl" />
<arg value="--no-rdoc" />
<arg value="--no-ri" />
<arg value="-i" />
<arg value="${basedir}/target/gems" />
</java>
<!-- publish the gem to rubygems.org -->
<echo message="Publishing Gem" />
<java jar="${maven.dependency.org.jruby.jruby-complete.jar.path}" failonerror="true" fork="true">
<env key="PATH" value="" />
<env key="GEM_PATH" value="${basedir}/target/gems" />
<arg value="-S" />
<arg value="gem" />
<arg value="push" />
<arg value="cucumber-jvm-${project.parent.version}-java.gem" />
</java>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${basedir}/target/generated-resources/i18n</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>