Skip to content

Commit

Permalink
Don't shade jruby/jython/groovy artifacts - only for native packages …
Browse files Browse the repository at this point in the history
…(gem,egg,zip). Closes #518, #522.
  • Loading branch information
aslakhellesoy committed Jun 10, 2013
1 parent a528334 commit 6e57b38
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion History.md
Expand Up @@ -2,7 +2,7 @@


* [Core] Always cancel tomeout at the end of a stepdef, even when it fails. ([#540](https://github.com/cucumber/cucumber-jvm/issues/540) irb1s) * [Core] Always cancel tomeout at the end of a stepdef, even when it fails. ([#540](https://github.com/cucumber/cucumber-jvm/issues/540) irb1s)
* [Groovy] Updated examples to be more explanatory and groovier syntax ([#537](https://github.com/cucumber/cucumber-jvm/pull/522) Quantoid) * [Groovy] Updated examples to be more explanatory and groovier syntax ([#537](https://github.com/cucumber/cucumber-jvm/pull/522) Quantoid)
* [Core] [Picocontainer] Not shading the artifact any longer. Groovy, Jython, and Jruby are still shading it. ([#522](https://github.com/cucumber/cucumber-jvm/pull/522) Dmytro Chyzhykov) * [PicoContainer,Groovy,JRuby,Jython] Not shading maven artifacts any longer. Gem has a shaded jar though. ([#522](https://github.com/cucumber/cucumber-jvm/pull/522) [#518](https://github.com/cucumber/cucumber-jvm/issues/518) Dmytro Chyzhykov, Aslak Hellesøy)
* [Core] The `json-pretty` formatter is gone, and the `json` formatter is pretty! * [Core] The `json-pretty` formatter is gone, and the `json` formatter is pretty!
* [Spring] New awesome Spring port of The Cucumber Book's chapter 14. ([#508](https://github.com/cucumber/cucumber-jvm/pull/508), [#489](https://github.com/cucumber/cucumber-jvm/pull/489) Dmytro Chyzhykov, Pedro Antonio Souza Viegas) * [Spring] New awesome Spring port of The Cucumber Book's chapter 14. ([#508](https://github.com/cucumber/cucumber-jvm/pull/508), [#489](https://github.com/cucumber/cucumber-jvm/pull/489) Dmytro Chyzhykov, Pedro Antonio Souza Viegas)
* [Core] Added `Scenario.getSourceTagNames()`, which is needed to make Capybara work with Cucumber-JRuby ([#504](https://github.com/cucumber/cucumber-jvm/issues/504) Aslak Hellesøy) * [Core] Added `Scenario.getSourceTagNames()`, which is needed to make Capybara work with Cucumber-JRuby ([#504](https://github.com/cucumber/cucumber-jvm/issues/504) Aslak Hellesøy)
Expand Down
6 changes: 4 additions & 2 deletions groovy/README.md
Expand Up @@ -16,5 +16,7 @@ The test uses a mix of compiled and interpreted step definitions which makes the
3. `--glue cucumber/runtime/groovy` or `--glue cucumber.runtime.groovy` is required so that cucumber finds the compiled step definitions 3. `--glue cucumber/runtime/groovy` or `--glue cucumber.runtime.groovy` is required so that cucumber finds the compiled step definitions
4. the last parameter provides a feature or a path with features 4. the last parameter provides a feature or a path with features


This demonstrates that the files in the bin directory (`cucumber-jvm.groovy` and `cucumber-groovy-full.jar` are a completely standalone This demonstrates that the files in the `bin` directory (`cucumber-jvm.groovy`, `cucumber-groovy.jar` and `cucumber-core.jar`
execution environment. TODO: Figure out the best way to package and publish this as a "groovy package". Maybe just a zip file? are a completely standalone execution environment.

TODO: Figure out the best way to package and publish this as a "groovy package". Maybe just a zip file?
3 changes: 1 addition & 2 deletions groovy/bin/.gitignore
@@ -1,2 +1 @@
cucumber-groovy.jar cucumber-groovy-shaded.jar

7 changes: 4 additions & 3 deletions groovy/bin/cucumber-jvm.groovy
@@ -1,3 +1,4 @@
scriptDir = new File(getClass().protectionDomain.codeSource.location.path).getParent(); #!/usr/bin/env groovy
if (this.class.classLoader.rootLoader) this.class.classLoader.rootLoader.addURL(new File(scriptDir, "cucumber-groovy.jar").toURL()) __directory = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParent();
this.class.classLoader.loadClass("cucumber.api.cli.Main").main(args) this.class.classLoader.addURL(new File(__directory, "cucumber-groovy-shaded.jar").toURL())
this.class.classLoader.loadClass("cucumber.api.cli.Main").main(args)
4 changes: 2 additions & 2 deletions groovy/pom.xml
Expand Up @@ -129,7 +129,7 @@ I18n.all.each { i18n ->
<phase>package</phase> <phase>package</phase>
<configuration> <configuration>
<target> <target>
<copy file="${project.build.directory}/${project.build.finalName}.jar" tofile="${basedir}/bin/cucumber-groovy.jar" /> <copy file="${project.build.directory}/${project.build.finalName}-shaded.jar" tofile="${basedir}/bin/cucumber-groovy-shaded.jar" />
</target> </target>
</configuration> </configuration>
<goals> <goals>
Expand All @@ -155,7 +155,7 @@ I18n.all.each { i18n ->
<classpath> <classpath>
<pathelement location="${maven.dependency.org.codehaus.groovy.groovy-all.jar.path}" /> <pathelement location="${maven.dependency.org.codehaus.groovy.groovy-all.jar.path}" />
<pathelement location="${maven.dependency.junit.junit.jar.path}" /> <pathelement location="${maven.dependency.junit.junit.jar.path}" />
<pathelement location="${basedir}/bin/cucumber-groovy.jar" /> <pathelement location="${basedir}/bin/cucumber-groovy-shaded.jar" />
<pathelement location="target/test-classes" /> <pathelement location="target/test-classes" />
</classpath> </classpath>
<arg value="bin/cucumber-jvm.groovy" /> <arg value="bin/cucumber-jvm.groovy" />
Expand Down
4 changes: 2 additions & 2 deletions jruby/bin/cucumber-jvm
@@ -1,10 +1,10 @@
#!/usr/bin/env jruby #!/usr/bin/env jruby
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib') $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')


require 'cucumber-jruby.jar' require 'cucumber-jruby-shaded.jar'


begin begin
Java::CucumberApiCli::Main.main(ARGV) Java::CucumberApiCli::Main.main(ARGV)
rescue NativeException => e rescue NativeException => e
e.cause.printStackTrace e.cause.printStackTrace
end end
2 changes: 1 addition & 1 deletion jruby/cucumber-jvm.gemspec
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |s|
s.summary = "#{s.name}-#{s.version}" s.summary = "#{s.name}-#{s.version}"
s.email = 'cukes@googlegroups.com' s.email = 'cukes@googlegroups.com'
s.homepage = 'http://github.com/cucumber/cucumber-jvm' s.homepage = 'http://github.com/cucumber/cucumber-jvm'
s.files = ['bin/cucumber-jvm', 'lib/cucumber-jruby.jar'] s.files = ['bin/cucumber-jvm', 'lib/cucumber-jruby-shaded.jar']
s.executables = ['cucumber-jvm'] s.executables = ['cucumber-jvm']
s.require_path = 'lib' s.require_path = 'lib'
s.platform = 'java' s.platform = 'java'
Expand Down
4 changes: 2 additions & 2 deletions jruby/pom.xml
Expand Up @@ -127,8 +127,8 @@ gherkin.I18n.all.each { i18n ->
<phase>package</phase> <phase>package</phase>
<configuration> <configuration>
<target> <target>
<!-- drop it in the lib directory for great justice --> <!-- add jars to lib -->
<copy file="${project.build.directory}/${project.build.finalName}.jar" tofile="${basedir}/lib/cucumber-jruby.jar" /> <copy file="${project.build.directory}/${project.build.finalName}-shaded.jar" tofile="${basedir}/lib/cucumber-jruby-shaded.jar" />


<!-- build the gem file using jruby --> <!-- build the gem file using jruby -->
<echo message="Building Gem" /> <echo message="Building Gem" />
Expand Down
3 changes: 1 addition & 2 deletions jython/bin/.gitignore
@@ -1,2 +1 @@
cucumber-jython.jar cucumber-jython-shaded.jar

11 changes: 3 additions & 8 deletions jython/bin/cucumber-jvm.py
@@ -1,20 +1,15 @@
#!/usr/bin/env jython #!/usr/bin/env jython
import sys, inspect, os import sys, inspect, os


cucumber_jython_path = os.path.dirname(inspect.getfile(inspect.currentframe())) + "/cucumber-jython.jar" cucumber_jython_shaded_path = os.path.dirname(inspect.getfile(inspect.currentframe())) + "/cucumber-jython-shaded.jar"
sys.path.append(cucumber_jython_path) sys.path.append(cucumber_jython_shaded_path)


from java.io import File from java.io import File
from java.net import URLClassLoader from java.net import URLClassLoader
from cucumber.api.cli import Main from cucumber.api.cli import Main
from cucumber.runtime import Runtime from cucumber.runtime import Runtime
from cucumber.runtime.jython import JythonBackend from cucumber.runtime.jython import JythonBackend


cl = URLClassLoader([File(cucumber_jython_path).toURL()], Main.getClassLoader()) cl = URLClassLoader([File(cucumber_jython_shaded_path).toURL()], Main.getClassLoader())

def createRuntime(resourceLoader, gluePaths, classLoader, dryRun):
# TODO - pass in current jython runtime - PythonInterpreter
jythonBackend = JythonBackend(resourceLoader)
return Runtime(resourceLoader, gluePaths, classLoader, [jythonBackend], dryRun)


Main.run(sys.argv[1:], cl) Main.run(sys.argv[1:], cl)
2 changes: 1 addition & 1 deletion jython/pom.xml
Expand Up @@ -115,7 +115,7 @@ I18n.all.each { i18n ->
<phase>package</phase> <phase>package</phase>
<configuration> <configuration>
<target> <target>
<copy file="${project.build.directory}/${project.build.finalName}.jar" tofile="${basedir}/bin/cucumber-jython.jar" /> <copy file="${project.build.directory}/${project.build.finalName}-shaded.jar" tofile="${basedir}/bin/cucumber-jython-shaded.jar" />
<!-- todo: make an egg --> <!-- todo: make an egg -->
</target> </target>
</configuration> </configuration>
Expand Down
3 changes: 3 additions & 0 deletions pom.xml
Expand Up @@ -553,6 +553,9 @@
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
Expand Down

0 comments on commit 6e57b38

Please sign in to comment.