Permalink
Browse files

Fix Scala build. Closes #167.

  • Loading branch information...
1 parent 7c4d730 commit a3b267e40d22fbffd37dbb49f53402cc51d4ccd1 DFUK committed Jan 23, 2012
Showing with 29 additions and 13 deletions.
  1. +5 −0 History.md
  2. +18 −4 core/src/test/java/cucumber/io/ClasspathIterableTest.java
  3. +2 −3 groovy/pom.xml
  4. +2 −3 java/pom.xml
  5. +2 −3 scala/pom.xml
View
@@ -1,3 +1,8 @@
+## In Git
+
+* [Build] Fixed subtle path issues on Windows
+* [Build] Fixed Build Failure: Cucumber-JVM: Scala (FAILURE) ([#167](https://github.com/cucumber/cucumber-jvm/issues/167) Aslak Hellesøy)
+
## [1.0.0.RC11](https://github.com/cucumber/cucumber-jvm/compare/v1.0.0.RC6...v1.0.0.RC11)
* [Build] The build is Maven-based again. It turned out to be the best choice.
@@ -13,13 +13,27 @@
public class ClasspathIterableTest {
@Test
public void computes_file_path_for_windows_path() throws UnsupportedEncodingException, MalformedURLException {
- URL url = new URL("jar:file:/C:/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar!/cucumber/runtime");
- assertEquals(new File("C:/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar").getAbsolutePath(), filePath(url));
+ if (File.separatorChar == '\\') {
+ // Windows
+ URL url = new URL("jar:file:/C:/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar!/cucumber/runtime");
+ assertEquals(new File("C:/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar").getAbsolutePath(), filePath(url));
+ } else {
+ // POSIX
+ URL url = new URL("jar:file:/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar!/cucumber/runtime");
+ assertEquals(new File("/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar").getAbsolutePath(), filePath(url));
+ }
}
@Test
public void computes_file_path_for_windows_path_with_dots() throws UnsupportedEncodingException, MalformedURLException {
- URL url = new URL("jar:file:C:/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar!/cucumber/runtime");
- assertEquals(new File("C:/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar").getAbsolutePath(), filePath(url));
+ if (File.separatorChar == '\\') {
+ // Windows
+ URL url = new URL("jar:file:C:/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar!/cucumber/runtime");
+ assertEquals(new File("C:/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar").getAbsolutePath(), filePath(url));
+ } else {
+ // POSIX
+ URL url = new URL("jar:file:/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar!/cucumber/runtime");
+ assertEquals(new File("/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar").getAbsolutePath(), filePath(url));
+ }
}
}
View
@@ -82,14 +82,13 @@
import groovy.text.SimpleTemplateEngine
import gherkin.I18n
-def _ = File.separator
def engine = new SimpleTemplateEngine()
-def templateSource = new File(project.baseDir, "src${_}main${_}code_generator${_}I18n.groovy.txt").getText()
+def templateSource = new File(project.baseDir, "src${File.separator}main${File.separator}code_generator${File.separator}I18n.groovy.txt").getText()
I18n.all.each { i18n ->
def binding = ["i18n":i18n]
template = engine.createTemplate(templateSource).make(binding)
- def file = new File(project.baseDir, "target${_}generated-sources${_}i18n${_}java${_}cucumber${_}runtime${_}groovy${_}${i18n.underscoredIsoCode.toUpperCase()}.java")
+ def file = new File(project.baseDir, "target${File.separator}generated-sources${File.separator}i18n${File.separator}java${File.separator}cucumber${File.separator}runtime${File.separator}groovy${File.separator}${i18n.underscoredIsoCode.toUpperCase()}.java")
file.parentFile.mkdirs()
file.write(template.toString(), "UTF-8")
}
View
@@ -49,15 +49,14 @@
import groovy.text.SimpleTemplateEngine
import gherkin.I18n
-def _ = File.separator
def engine = new SimpleTemplateEngine()
-def templateSource = new File(project.baseDir, "src${_}main${_}code_generator${_}I18n.java.txt").getText()
+def templateSource = new File(project.baseDir, "src${File.separator}main${File.separator}code_generator${File.separator}I18n.java.txt").getText()
I18n.all.each { i18n ->
i18n.codeKeywords.each { kw ->
def binding = ["i18n":i18n, "kw":kw]
template = engine.createTemplate(templateSource).make(binding)
- def file = new File(project.baseDir, "target${_}generated-sources${_}i18n${_}java${_}cucumber${_}annotation${_}${i18n.underscoredIsoCode}${_}${kw}.java")
+ def file = new File(project.baseDir, "target${File.separator}generated-sources${File.separator}i18n${File.separator}java${File.separator}cucumber${File.separator}annotation${File.separator}${i18n.underscoredIsoCode}${File.separator}${kw}.java")
file.parentFile.mkdirs()
file.write(template.toString(), "UTF-8")
}
View
@@ -86,12 +86,11 @@
<groovy><![CDATA[
import groovy.text.SimpleTemplateEngine
-def _ = File.separator
def engine = new SimpleTemplateEngine()
-def templateSource = new File(project.baseDir, "src${_}main${_}code_generator${_}I18n.scala.txt").getText()
+def templateSource = new File(project.baseDir, "src${File.separator}main${File.separator}code_generator${File.separator}I18n.scala.txt").getText()
template = engine.createTemplate(templateSource).make(null)
-def file = new File(project.baseDir, "target${_}generated-sources${_}i18n${_}cucumber${_}runtime${_}I18n.scala")
+def file = new File(project.baseDir, "target${File.separator}generated-sources${File.separator}i18n${File.separator}cucumber${File.separator}runtime${File.separator}I18n.scala")
file.parentFile.mkdirs()
file.write(template.toString(), "UTF-8")
]]></groovy>

0 comments on commit a3b267e

Please sign in to comment.