From 6e57b38d95179ce6cb94afd15751a5e5650937f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aslak=20Helles=C3=B8y?= Date: Mon, 10 Jun 2013 15:43:21 -0500 Subject: [PATCH] Don't shade jruby/jython/groovy artifacts - only for native packages (gem,egg,zip). Closes #518, #522. --- History.md | 2 +- groovy/README.md | 6 ++++-- groovy/bin/.gitignore | 3 +-- groovy/bin/cucumber-jvm.groovy | 7 ++++--- groovy/pom.xml | 4 ++-- jruby/bin/cucumber-jvm | 4 ++-- jruby/cucumber-jvm.gemspec | 2 +- jruby/pom.xml | 4 ++-- jython/bin/.gitignore | 3 +-- jython/bin/cucumber-jvm.py | 11 +++-------- jython/pom.xml | 2 +- pom.xml | 3 +++ 12 files changed, 25 insertions(+), 26 deletions(-) diff --git a/History.md b/History.md index fb37186513..5f9d4e1f00 100644 --- a/History.md +++ b/History.md @@ -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) diff --git a/groovy/README.md b/groovy/README.md index 05c50bb63d..ee0b768dca 100644 --- a/groovy/README.md +++ b/groovy/README.md @@ -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? diff --git a/groovy/bin/.gitignore b/groovy/bin/.gitignore index d0969d83a2..2b2d3039bb 100644 --- a/groovy/bin/.gitignore +++ b/groovy/bin/.gitignore @@ -1,2 +1 @@ -cucumber-groovy.jar - +cucumber-groovy-shaded.jar diff --git a/groovy/bin/cucumber-jvm.groovy b/groovy/bin/cucumber-jvm.groovy index 79e5cd3186..c8c7eee9c6 100644 --- a/groovy/bin/cucumber-jvm.groovy +++ b/groovy/bin/cucumber-jvm.groovy @@ -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) \ No newline at end of file +#!/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) diff --git a/groovy/pom.xml b/groovy/pom.xml index ad484ec886..7f0f4335d6 100644 --- a/groovy/pom.xml +++ b/groovy/pom.xml @@ -129,7 +129,7 @@ I18n.all.each { i18n -> package - + @@ -155,7 +155,7 @@ I18n.all.each { i18n -> - + diff --git a/jruby/bin/cucumber-jvm b/jruby/bin/cucumber-jvm index 4f81b3891e..df8175c306 100755 --- a/jruby/bin/cucumber-jvm +++ b/jruby/bin/cucumber-jvm @@ -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 \ No newline at end of file +end diff --git a/jruby/cucumber-jvm.gemspec b/jruby/cucumber-jvm.gemspec index 1d6ecc8321..a56a032e37 100644 --- a/jruby/cucumber-jvm.gemspec +++ b/jruby/cucumber-jvm.gemspec @@ -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' diff --git a/jruby/pom.xml b/jruby/pom.xml index 82e1f5f1c8..9dfc993e70 100644 --- a/jruby/pom.xml +++ b/jruby/pom.xml @@ -127,8 +127,8 @@ gherkin.I18n.all.each { i18n -> package - - + + diff --git a/jython/bin/.gitignore b/jython/bin/.gitignore index b89580154f..0bfe3195e5 100644 --- a/jython/bin/.gitignore +++ b/jython/bin/.gitignore @@ -1,2 +1 @@ -cucumber-jython.jar - +cucumber-jython-shaded.jar diff --git a/jython/bin/cucumber-jvm.py b/jython/bin/cucumber-jvm.py index 4648b2d916..0a707c29f4 100644 --- a/jython/bin/cucumber-jvm.py +++ b/jython/bin/cucumber-jvm.py @@ -1,8 +1,8 @@ #!/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 @@ -10,11 +10,6 @@ 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) diff --git a/jython/pom.xml b/jython/pom.xml index 94629c0a77..691662cede 100755 --- a/jython/pom.xml +++ b/jython/pom.xml @@ -115,7 +115,7 @@ I18n.all.each { i18n -> package - + diff --git a/pom.xml b/pom.xml index 16b3d32088..381ff2561e 100644 --- a/pom.xml +++ b/pom.xml @@ -553,6 +553,9 @@ shade + + true +