Thank you,
I'll give it a try as soon as I can :-)

2013/11/6 Gert Vanthienen <[email protected]>

> Hi Cristiano,
>
>
> For the Import-Package, you should be able to append the resolution
> directive with a ;, just like you do with the maven-bundle-plugin
> instructions.  Something like *;resolution:=optional should work fine,
> I think.
>
> For the properties, my first suggestion would be to just use plain Ant
> to copy the file into a working directory and filter those property
> values first and then point <bnd> to the filtered file, but it looks
> like there's a <bndexpand> task as well that might be helpful, cfr.
>
> https://github.com/bndtools/bnd/wiki/%5Bant%5D-Loading-and-Expanding-Shared-Headers-or-Properties
>
>
> Regards,
>
> Gert Vanthienen
>
>
> On Wed, Nov 6, 2013 at 10:14 AM, Cristiano Costantini
> <[email protected]> wrote:
> > Hi all
> >
> > Short story:
> > - Using "Import-Package: *" generates mandatory imports,
> > do you know how to instruct bnd tool in the .bnd property file to scan
> > imports and set them as with "resolution:=optional"?
> >
> > - "Bundle-Version: 2.6.0.rc1" is hard coded,
> > do you know how to use external Ant variables in a .bnd property file
> when
> > using Ant tasks?
> >
> >
> > Long story:
> > I have made a GWT demo project that works into Servicemix 4.5.3 (I will
> > publish it as soon as I have some more time),
> > by now it resolves the dependency with gwt-servlet by installing the
> > following bundle:
> >     install -s
> >
> wrap:mvn:com.google.gwt/gwt-servlet/${gwt.version}$Bundle-SymbolicName=gwt-servlet
> >
> > It creates a huge manifest for the GWT-Servlet, it heavily make use of
> > optional imports, the demo is just a simple example with 1 server side
> GWT
> > Rpc Service (-> a servlet), but it works.
> >
> > I then tried to automate the generation of OSGi Manifest into the build
> > lifecycle of GWT so that the original Jar in the GWT distribution is
> ready
> > for deployment to OSGi without wrapping it, but here things get a little
> > harder.
> >
> > The "bnd" ant task is hard to fit GWT lifecycle as the GWT-Servlet Jar
> is a
> > subset of classes extracted from GWT-User and GWT-Dev.
> > I think using "bndwrap" ant task and post process GWT-Servlet is
> > preferable.
> >
> > I tried first by wrapping the Jar on the command line and I made a simple
> > .bnd file with the following options contents:
> >    Bundle-Name: Google Web Toolkit :: Servlet
> >    Bundle-SymbolicName: gwt-servlet
> >    Bundle-Version: 2.6.0.rc1
> >    Export-Package: *
> >    Import-Package: *
> >
> > I got an osgi-fied bundle, I deployed it replacing the one created with
> > wrap: deployer but this new one does not get resolved:
> > the difference is that the made with wrap deployer sets all Imports as
> > optional.
> > It sound reasonable to me, as the classes in the GWT-Servlet have been
> > accurately selected by GWT committers (remember GWT-Servlet comes from a
> > subset of GWT-Dev and GWT-User) and may have many java imports of classes
> > not required on the server but are still referenced in the bytecode.
> >
> > Ideally, we should create a .bnd file that only specify the right Package
> > Imports and Exports, but I don't have ideas on how to make it simple.
> >
> > I guess the best would be to make a first step and achieve having an
> > initial bundle with imports as optional but I don't know how to specify
> > this to bnd for Import-Packages... (see initial question).
> > Anyone can suggest me how to do it?
> >
> >
> > Here, if someone is interested, are the headers of the two bundles:
> > This one works
> >
> >
> https://gist.github.com/cristcost/7332635#file-gwt-servlet-osgi-headers-with-wrap
> >
> > This one don't
> >
> >
> https://gist.github.com/cristcost/7332635#file-gwt-servlet-osgi-headers-from-command-line-bnd
> >
> > I'll keep you updated as I try to progress further.
> > ;-)
> >
> > Cristiano
> >
> >
> > PS. Here are the Ant rules for selecting what to put inside the
> GWT-Servlet
> > JAR. Any Idea on how to create more fine tuned .bnd files from these
> rules?
> >
> >       <fileset dir="${gwt.dev.bin}">
> >         <include name="com/google/gwt/dev/asm/**" />
> >         <include name="com/google/gwt/dev/util/Name*.class" />
> >         <include name="com/google/gwt/dev/util/StringKey.class" />
> >         <include name="com/google/gwt/util/tools/shared/**" />
> >         <include name="com/google/gwt/core/shared/**" />
> >       </fileset>
> >       <fileset dir="${gwt.user.bin}">
> >         <exclude name="**/rebind/**" />
> >         <exclude name="**/tools/**" />
> >         <exclude name="**/super/**" />
> >         <exclude name="com/google/gwt/json/**" />
> >         <exclude name="com/google/gwt/junit/*" />
> >         <exclude name="com/google/gwt/junit/client/GWTTestCase.*" />
> >         <exclude name="com/google/gwt/junit/remote/**" />
> >         <exclude name="com/google/gwt/junit/server/**" />
> >         <exclude name="com/google/gwt/benchmarks/*" />
> >         <exclude name="**/*.gwtar" />
> >       </fileset>
>

Reply via email to