frjaeger220 / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Make guice jars OSGi bundles #121

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For inclusion into RCP applications, or running in any OSGi container, it
would lower the barrier of entry if the jars were proper OSGi bundles. 
Issue 16 hints at this as a solution to the problem described but it
doesn't seem like the goal end goal.

Original issue reported on code.google.com by bradleyj...@gmail.com on 28 Jun 2007 at 11:58

GoogleCodeExporter commented 9 years ago
Related to issue 94, "Support OSGi classloading in Guice":

  http://code.google.com/p/google-guice/issues/detail?id=94
  http://wiki.ops4j.org/confluence/display/ops4j/Guice-OSGi

Original comment by mccu...@gmail.com on 29 Jun 2007 at 5:10

GoogleCodeExporter commented 9 years ago
Here is an initial patch that updates the Ant build files to add OSGi manifests.

Overview of the patch:

  common.bnd
    -  common Bnd settings for Guice detailing the name, license, etc.
       Marks the primary package (and sub-packages) as exported and
       tweaks the calculated imports to version any Guice packages with
       the current version and mark any javax.* imports as optional

  guice*.bnd files
    -  sub-project specific settings (mainly the primary package name)

  aopalliance.bnd
    -  the Bnd settings I used to re-bundle the aopalliance jar (attached)

  For the main Guice jar, it first creates a basic bundle of the core classes
  using Bnd, then extracts the manifest and uses this file when creating the
  distributable jar using jarjar (as this creates a more optimal/smaller jar)

  The various extensions now use Bnd (instead of jar) to create their jars.

The two attached jars are the Bnd ant task (place in lib/build) and an updated
version of the aopalliance jar with OSGi headers (copy over existing version).

I'm still tweaking the Bnd settings to make sure the build is robust - but 
initial
tests show I can now load the distributable jars into an OSGi framework and
they all resolve as expected.

The com.google.inject.internal package is currently exported because a few
extensions use classes from it (mainly the Objects utility class) - ideally this
should be moved to the util package, so we can keep internal  private to the
core Guice bundle.

Original comment by mccu...@gmail.com on 2 Jun 2008 at 3:55

Attachments:

GoogleCodeExporter commented 9 years ago
The attached patch is based on the latest trunk (r503) and replaces the 
Knopflerfish
ant task with Bnd...

M      servlet/build.properties
M      struts2/plugin/build.properties
M      common.xml
M      build.properties
M      extensions/throwingproviders/build.properties
M      extensions/commands/build.properties
M      extensions/multibindings/build.properties
M      extensions/assistedinject/build.properties
M      spring/build.properties
D      lib/build/OSGiBundleInfo.jar
A      lib/build/bnd-0.0.255.jar

Original comment by mccu...@gmail.com on 3 Jun 2008 at 2:17

Attachments:

GoogleCodeExporter commented 9 years ago
I've committed Stuart's patch. Guice now builds as an OSGi module! when we do 
dists, we now need to make sure 
that the OSGi version number is properly updated (ie. set to 2.0.0.final)

Original comment by limpbizkit on 8 Jun 2008 at 11:22