Discussion:
[jruby-dev] OSGi build pull request
(too old to reply)
Anthony Juckel
2013-09-17 14:01:34 UTC
Permalink
I submitted a pull request [1] to try reenabling OSGi metadata in the maven
build. I haven't had much time to fully test the resulting bundle, but I'm
unlikely to have more time to work on it before the weekend so thought I'd
throw what I've got out there to see if any one else can put it through its
paces.

There are some diffs in the resulting jar/bundle [2] with respect to the
last release I downloaded from the CI server. I'm not certain whether these
would be acceptable. In particular, it appears some bouncy castle jars are
being bundled, which may not be the desired result.

If anyone has time to check it out and let me know what works and what
doesn't, I'd greatly appreciate it.

[1] https://github.com/jruby/jruby/pull/1020
[2] https://gist.github.com/ajuckel/8300e295f326818d5e4a
christian
2013-09-17 14:35:27 UTC
Permalink
great that there is someone with osgi knowhow looking at that ;)

but I have the feeling you missed the current state of osgi:

$ mvn -Pcomplete

will run the osgi IT which is now in maven/jruby-complete/src/it/osgi-test
which is just copy and paste of the old code with some adjustments to get
it pass. whether passing that test means a lot I do not know.

the bouncy-castle jars are bundled within the META-INF/jruby.home along
with a number of other jars - not sure what the issue there is but any gem
with jars will have the same issue - the jruby-classloader loading a
vendored jar.


so it would be great to use the integration test from jruby-complete as a
starting point.

- christian
Anthony Juckel
2013-09-17 15:49:40 UTC
Permalink
Ah, very right. Now I see your commits from last week. I am surprised that
Felix 2 is apparently broken now. I can try looking at that, time
permitting, but that's pretty low on my list.

I believe the OSGi jruby classloader will handle embedded jars just fine,
but if there's a particular class or gem you'd like tested, I could add
that. The current test simply ensures we can:

1) Load OSGiScriptingContainer
2) Can java_import a class not shipped with JRuby (as long as a bundle
that can see it was given as a parameter to the scripting container).
3) Can actually call a method on that imported class.

Also, the profiles on the original jruby-osgi-test allowed running the
tests under either equinox, felix4 or felix2.
Post by christian
great that there is someone with osgi knowhow looking at that ;)
$ mvn -Pcomplete
will run the osgi IT which is now in maven/jruby-complete/src/it/osgi-test
which is just copy and paste of the old code with some adjustments to get
it pass. whether passing that test means a lot I do not know.
the bouncy-castle jars are bundled within the META-INF/jruby.home along
with a number of other jars - not sure what the issue there is but any gem
with jars will have the same issue - the jruby-classloader loading a
vendored jar.
so it would be great to use the integration test from jruby-complete as a
starting point.
- christian
christian
2013-09-17 15:58:59 UTC
Permalink
hi

is there a chance to get the modular jruby artifacts running on osgi - do
all the dependent jar be osgi for that ? I am rather new to osgi ;) so
excuse my ignorance !
Post by Anthony Juckel
Ah, very right. Now I see your commits from last week. I am surprised
that Felix 2 is apparently broken now. I can try looking at that, time
permitting, but that's pretty low on my list.
I am happy to add felix2 and equinox to the ITs

the equinox not sure if I just deleted it or whether it was still there
when I touched the pom.xml
Post by Anthony Juckel
I believe the OSGi jruby classloader will handle embedded jars just fine,
but if there's a particular class or gem you'd like tested, I could add
that.
the helloworld test just "require 'openssl'" to ensure the ssl stuff is in
place - might me an addition to the osgi test as well

- christian
Post by Anthony Juckel
1) Load OSGiScriptingContainer
2) Can java_import a class not shipped with JRuby (as long as a bundle
that can see it was given as a parameter to the scripting container).
3) Can actually call a method on that imported class.
Also, the profiles on the original jruby-osgi-test allowed running the
tests under either equinox, felix4 or felix2.
Post by christian
great that there is someone with osgi knowhow looking at that ;)
$ mvn -Pcomplete
will run the osgi IT which is now in
maven/jruby-complete/src/it/osgi-test
which is just copy and paste of the old code with some adjustments to get
it pass. whether passing that test means a lot I do not know.
the bouncy-castle jars are bundled within the META-INF/jruby.home along
with a number of other jars - not sure what the issue there is but any gem
with jars will have the same issue - the jruby-classloader loading a
vendored jar.
so it would be great to use the integration test from jruby-complete as a
starting point.
- christian
Anthony Juckel
2013-09-22 18:43:03 UTC
Permalink
First, to answer our question, we don't need any OSGi metadata in any jars
embedded in jruby-complete in order for it to be a well-behaved bundle.
Even so, my require 'openssl' test is failing under OSGi, and I think it's
because a bundle:// URI is getting passed through to RubyInstanceConfig,
but I'm having trouble rebuilding jruby-complete with my changes. The
jruby-core artifact in my maven repository has my changes to
RubyInstanceConfig, but somehow in the building of jruby-complete, my
updated RubyInstanceConfig is not being used.

What am I missing in the build to make sure that updated jruby-core classes
are included in the jruby-complete build?

$ jar xf $MVN_REPO/org/jruby/jruby-core/1.7.5.dev/jruby-core-1.7.5.dev.jar
org/jruby/RubyInstanceConfig.class
$ mv org/jruby/RubyInstanceConfig.class
org/jruby/RubyInstanceConfig_core.class
$ jar xf
$JRUBY_SRC/maven/jruby-complete/target/jruby-complete-1.7.5.dev.jar
org/jruby/RubyInstanceConfig.class
$ diff org/jruby/RubyInstanceConfig_core.class
org/jruby/RubyInstanceConfig.class
Binary files org/jruby/RubyInstanceConfig_core.class and
org/jruby/RubyInstanceConfig.class differ

Using javap to disassemble the two classes, I see that the jruby-core
artifact does have my changes, but the jruby-complete artifact does not.
Post by christian
hi
is there a chance to get the modular jruby artifacts running on osgi - do
all the dependent jar be osgi for that ? I am rather new to osgi ;) so
excuse my ignorance !
Post by Anthony Juckel
Ah, very right. Now I see your commits from last week. I am surprised
that Felix 2 is apparently broken now. I can try looking at that, time
permitting, but that's pretty low on my list.
I am happy to add felix2 and equinox to the ITs
the equinox not sure if I just deleted it or whether it was still there
when I touched the pom.xml
Post by Anthony Juckel
I believe the OSGi jruby classloader will handle embedded jars just fine,
but if there's a particular class or gem you'd like tested, I could add
that.
the helloworld test just "require 'openssl'" to ensure the ssl stuff is in
place - might me an addition to the osgi test as well
- christian
Post by Anthony Juckel
1) Load OSGiScriptingContainer
2) Can java_import a class not shipped with JRuby (as long as a bundle
that can see it was given as a parameter to the scripting container).
3) Can actually call a method on that imported class.
Also, the profiles on the original jruby-osgi-test allowed running the
tests under either equinox, felix4 or felix2.
Post by christian
great that there is someone with osgi knowhow looking at that ;)
$ mvn -Pcomplete
will run the osgi IT which is now in
maven/jruby-complete/src/it/osgi-test
which is just copy and paste of the old code with some adjustments to
get it pass. whether passing that test means a lot I do not know.
the bouncy-castle jars are bundled within the META-INF/jruby.home along
with a number of other jars - not sure what the issue there is but any gem
with jars will have the same issue - the jruby-classloader loading a
vendored jar.
so it would be great to use the integration test from jruby-complete as
a starting point.
- christian
christian
2013-09-22 20:26:03 UTC
Permalink
not sure but
$ mvn clean install -Pcomplete
from the main directory should work (and works for me).

-christian
Post by Anthony Juckel
First, to answer our question, we don't need any OSGi metadata in any jars
embedded in jruby-complete in order for it to be a well-behaved bundle.
Even so, my require 'openssl' test is failing under OSGi, and I think it's
because a bundle:// URI is getting passed through to RubyInstanceConfig,
but I'm having trouble rebuilding jruby-complete with my changes. The
jruby-core artifact in my maven repository has my changes to
RubyInstanceConfig, but somehow in the building of jruby-complete, my
updated RubyInstanceConfig is not being used.
What am I missing in the build to make sure that updated jruby-core
classes are included in the jruby-complete build?
$ jar xf $MVN_REPO/org/jruby/jruby-core/1.7.5.dev/jruby-core-1.7.5.dev.jar
org/jruby/RubyInstanceConfig.class
$ mv org/jruby/RubyInstanceConfig.class
org/jruby/RubyInstanceConfig_core.class
$ jar xf
$JRUBY_SRC/maven/jruby-complete/target/jruby-complete-1.7.5.dev.jar
org/jruby/RubyInstanceConfig.class
$ diff org/jruby/RubyInstanceConfig_core.class
org/jruby/RubyInstanceConfig.class
Binary files org/jruby/RubyInstanceConfig_core.class and
org/jruby/RubyInstanceConfig.class differ
Using javap to disassemble the two classes, I see that the jruby-core
artifact does have my changes, but the jruby-complete artifact does not.
Post by christian
hi
is there a chance to get the modular jruby artifacts running on osgi - do
all the dependent jar be osgi for that ? I am rather new to osgi ;) so
excuse my ignorance !
Post by Anthony Juckel
Ah, very right. Now I see your commits from last week. I am surprised
that Felix 2 is apparently broken now. I can try looking at that, time
permitting, but that's pretty low on my list.
I am happy to add felix2 and equinox to the ITs
the equinox not sure if I just deleted it or whether it was still there
when I touched the pom.xml
Post by Anthony Juckel
I believe the OSGi jruby classloader will handle embedded jars just
fine, but if there's a particular class or gem you'd like tested, I could
add that.
the helloworld test just "require 'openssl'" to ensure the ssl stuff is
in place - might me an addition to the osgi test as well
- christian
Post by Anthony Juckel
1) Load OSGiScriptingContainer
2) Can java_import a class not shipped with JRuby (as long as a bundle
that can see it was given as a parameter to the scripting container).
3) Can actually call a method on that imported class.
Also, the profiles on the original jruby-osgi-test allowed running the
tests under either equinox, felix4 or felix2.
Post by christian
great that there is someone with osgi knowhow looking at that ;)
$ mvn -Pcomplete
will run the osgi IT which is now in
maven/jruby-complete/src/it/osgi-test
which is just copy and paste of the old code with some adjustments to
get it pass. whether passing that test means a lot I do not know.
the bouncy-castle jars are bundled within the META-INF/jruby.home along
with a number of other jars - not sure what the issue there is but any gem
with jars will have the same issue - the jruby-classloader loading a
vendored jar.
so it would be great to use the integration test from jruby-complete as
a starting point.
- christian
Anthony Juckel
2013-09-25 02:37:46 UTC
Permalink
Man, I really wish I had more time to work on all this, but I can at least
provide a bit more of an info dump on the current state, and what I'm
working on to improve it for the future.

So, I mentioned that the require 'openssl' test is failing. It's failing
with felix, because we currently assume we can translate an OSGi Bundle
Entry into a File that can be used in RubyInstanceConfig as JRubyHome.
There's a comment indicating belief that earlier versions of Felix simply
returned file:// URLs for bundle entries anyway, but that doesn't appear to
be the case with either our felix2 or felix4 profiles. There's some kludge
code in place that still appears to work with recent versions of Equinox to
translate their bundle*:// URLs to Files.

The fix that I want to work on is giving RubyInstanceConfig an additional
setJRubyHome(URL) method. If we could simply use the URLs returned from
OSGi directly, a simple URL#openStream() would allow us to read the
contents, rather than needing JRuby to figure out how to translate OSGi
URLs to paths. And, turning simple File objects into URLs strikes me as
easier than trying to figure out how to properly map arbitrary bundle*://
URLs to Files.

All of this is a very long winded way of saying that loading embedded gems
is a bit broken on non-Equinox OSGi containers currently, but the fix (at
least the fix that I have in mind) is non-trivial.
Post by christian
not sure but
$ mvn clean install -Pcomplete
from the main directory should work (and works for me).
-christian
Post by Anthony Juckel
First, to answer our question, we don't need any OSGi metadata in any
jars embedded in jruby-complete in order for it to be a well-behaved
bundle. Even so, my require 'openssl' test is failing under OSGi, and I
think it's because a bundle:// URI is getting passed through to
RubyInstanceConfig, but I'm having trouble rebuilding jruby-complete with
my changes. The jruby-core artifact in my maven repository has my changes
to RubyInstanceConfig, but somehow in the building of jruby-complete, my
updated RubyInstanceConfig is not being used.
What am I missing in the build to make sure that updated jruby-core
classes are included in the jruby-complete build?
$ jar xf
$MVN_REPO/org/jruby/jruby-core/1.7.5.dev/jruby-core-1.7.5.dev.jar
org/jruby/RubyInstanceConfig.class
$ mv org/jruby/RubyInstanceConfig.class
org/jruby/RubyInstanceConfig_core.class
$ jar xf
$JRUBY_SRC/maven/jruby-complete/target/jruby-complete-1.7.5.dev.jar
org/jruby/RubyInstanceConfig.class
$ diff org/jruby/RubyInstanceConfig_core.class
org/jruby/RubyInstanceConfig.class
Binary files org/jruby/RubyInstanceConfig_core.class and
org/jruby/RubyInstanceConfig.class differ
Using javap to disassemble the two classes, I see that the jruby-core
artifact does have my changes, but the jruby-complete artifact does not.
Post by christian
hi
is there a chance to get the modular jruby artifacts running on osgi -
do all the dependent jar be osgi for that ? I am rather new to osgi ;) so
excuse my ignorance !
Post by Anthony Juckel
Ah, very right. Now I see your commits from last week. I am surprised
that Felix 2 is apparently broken now. I can try looking at that, time
permitting, but that's pretty low on my list.
I am happy to add felix2 and equinox to the ITs
the equinox not sure if I just deleted it or whether it was still there
when I touched the pom.xml
Post by Anthony Juckel
I believe the OSGi jruby classloader will handle embedded jars just
fine, but if there's a particular class or gem you'd like tested, I could
add that.
the helloworld test just "require 'openssl'" to ensure the ssl stuff is
in place - might me an addition to the osgi test as well
- christian
Post by Anthony Juckel
1) Load OSGiScriptingContainer
2) Can java_import a class not shipped with JRuby (as long as a bundle
that can see it was given as a parameter to the scripting container).
3) Can actually call a method on that imported class.
Also, the profiles on the original jruby-osgi-test allowed running the
tests under either equinox, felix4 or felix2.
Post by christian
great that there is someone with osgi knowhow looking at that ;)
$ mvn -Pcomplete
will run the osgi IT which is now in
maven/jruby-complete/src/it/osgi-test
which is just copy and paste of the old code with some adjustments to
get it pass. whether passing that test means a lot I do not know.
the bouncy-castle jars are bundled within the META-INF/jruby.home
along with a number of other jars - not sure what the issue there is but
any gem with jars will have the same issue - the jruby-classloader loading
a vendored jar.
so it would be great to use the integration test from jruby-complete
as a starting point.
- christian
Loading...