Skip to content

Commit

Permalink
Fix Scala build. Closes #167.
Browse files Browse the repository at this point in the history
  • Loading branch information
DFUK authored and DFUK committed Jan 23, 2012
1 parent 7c4d730 commit a3b267e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
5 changes: 5 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
22 changes: 18 additions & 4 deletions core/src/test/java/cucumber/io/ClasspathIterableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
5 changes: 2 additions & 3 deletions groovy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
5 changes: 2 additions & 3 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
5 changes: 2 additions & 3 deletions scala/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit a3b267e

Please sign in to comment.