Permalink
Browse files

Don't shade jruby/jython/groovy artifacts - only for native packages …

…(gem,egg,zip). Closes #518, #522.
  • Loading branch information...
1 parent a528334 commit 6e57b38d95179ce6cb94afd15751a5e5650937f2 @aslakhellesoy aslakhellesoy committed Jun 10, 2013
View
@@ -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)
* [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!
* [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)
View
@@ -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
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
-execution environment. TODO: Figure out the best way to package and publish this as a "groovy package". Maybe just a zip file?
+This demonstrates that the files in the `bin` directory (`cucumber-jvm.groovy`, `cucumber-groovy.jar` and `cucumber-core.jar`
+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?
@@ -1,2 +1 @@
-cucumber-groovy.jar
-
+cucumber-groovy-shaded.jar
@@ -1,3 +1,4 @@
-scriptDir = new File(getClass().protectionDomain.codeSource.location.path).getParent();
-if (this.class.classLoader.rootLoader) this.class.classLoader.rootLoader.addURL(new File(scriptDir, "cucumber-groovy.jar").toURL())
-this.class.classLoader.loadClass("cucumber.api.cli.Main").main(args)
+#!/usr/bin/env groovy
+__directory = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParent();
+this.class.classLoader.addURL(new File(__directory, "cucumber-groovy-shaded.jar").toURL())
+this.class.classLoader.loadClass("cucumber.api.cli.Main").main(args)
View
@@ -129,7 +129,7 @@ I18n.all.each { i18n ->
<phase>package</phase>
<configuration>
<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>
</configuration>
<goals>
@@ -155,7 +155,7 @@ I18n.all.each { i18n ->
<classpath>
<pathelement location="${maven.dependency.org.codehaus.groovy.groovy-all.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" />
</classpath>
<arg value="bin/cucumber-jvm.groovy" />
@@ -1,10 +1,10 @@
#!/usr/bin/env jruby
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
-require 'cucumber-jruby.jar'
+require 'cucumber-jruby-shaded.jar'
begin
Java::CucumberApiCli::Main.main(ARGV)
rescue NativeException => e
e.cause.printStackTrace
-end
+end
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
s.summary = "#{s.name}-#{s.version}"
s.email = 'cukes@googlegroups.com'
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.require_path = 'lib'
s.platform = 'java'
View
@@ -127,8 +127,8 @@ gherkin.I18n.all.each { i18n ->
<phase>package</phase>
<configuration>
<target>
- <!-- drop it in the lib directory for great justice -->
- <copy file="${project.build.directory}/${project.build.finalName}.jar" tofile="${basedir}/lib/cucumber-jruby.jar" />
+ <!-- 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" />
@@ -1,2 +1 @@
-cucumber-jython.jar
-
+cucumber-jython-shaded.jar
@@ -1,20 +1,15 @@
#!/usr/bin/env jython
import sys, inspect, os
-cucumber_jython_path = os.path.dirname(inspect.getfile(inspect.currentframe())) + "/cucumber-jython.jar"
-sys.path.append(cucumber_jython_path)
+cucumber_jython_shaded_path = os.path.dirname(inspect.getfile(inspect.currentframe())) + "/cucumber-jython-shaded.jar"
+sys.path.append(cucumber_jython_shaded_path)
from java.io import File
from java.net import URLClassLoader
from cucumber.api.cli import Main
from cucumber.runtime import Runtime
from cucumber.runtime.jython import JythonBackend
-cl = URLClassLoader([File(cucumber_jython_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)
+cl = URLClassLoader([File(cucumber_jython_shaded_path).toURL()], Main.getClassLoader())
Main.run(sys.argv[1:], cl)
View
@@ -115,7 +115,7 @@ I18n.all.each { i18n ->
<phase>package</phase>
<configuration>
<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 -->
</target>
</configuration>
View
@@ -553,6 +553,9 @@
<goals>
<goal>shade</goal>
</goals>
+ <configuration>
+ <shadedArtifactAttached>true</shadedArtifactAttached>
+ </configuration>
</execution>
</executions>
</plugin>

0 comments on commit 6e57b38

Please sign in to comment.