You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Cristiano Costantini <cr...@gmail.com> on 2013/10/31 08:41:13 UTC

OSGIfy server jar of GWT

Hello All,

on maven central repo, there is a servicemix OSGIfized version of GWT dev
library:
http://search.maven.org/#artifactdetails%7Corg.apache.servicemix.bundles%7Corg.apache.servicemix.bundles.gwt-dev%7C2.4.0_1%7Cbundle

This is linked GWT version 2.4.0, actually the last release is 2.5.1 and
2.6.0 is going to come out as a release candidate on 4 november, with a
final 2.6.0 expected for december.

I wonder if we can propose a patch to OSGIfy GWT, so that it could be
included in the upcoming 2.6.0 release.
Generally on server side of a GWT application you only put the GWT-Servlet
artifact, so I think it could be enough to OSGIfy this jar.

I would like to do it, but I have only created bundles using the Maven
plugin, and GWT is built actually with ANT and is moving probably to Gradle
or Maven with strong preference to Gradle.

So, can someone suggest what is the best approach to put on the Ant build
the proper way to OSGIfy the Jar?

Someone has some example?
I would like to try it out and do some test if someone can help me in
filling the gap.


Me and some friends are making a demo application based on Servicemix that
we will publish on Github, and we would like to use GWT on Servicemix for
this demo.


Thank you,
Cristiano

Re: OSGIfy server jar of GWT

Posted by Cristiano Costantini <cr...@gmail.com>.
Thank you,
I'll give it a try as soon as I can :-)


2013/11/6 Gert Vanthienen <ge...@gmail.com>

> 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
> <cr...@gmail.com> 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>
>

Re: OSGIfy server jar of GWT

Posted by Cristiano Costantini <cr...@gmail.com>.
Yes, I will.
Consider GWT 2.6.0 is not yet released,
(Release is expected within next two weeks)

Cristiano

Il giorno sabato 7 dicembre 2013, Jean-Baptiste Onofré ha scritto:

> Sure, I created the Jira to track it.
>
> I will create a first bundle, feel free to review and provide your
> feedback !
>
> Thanks,
> Regards
> JB
>
> On 12/07/2013 02:05 PM, Cristiano Costantini wrote:
>
> Ok, good,
> I'll check it.
>
> I have worked a lot in the past weeks to test GWT on servicemix also by
> adapting many examples, and I have many considerations to provide, please
> take some time to take into account my feedback ;-)
>
> Cristiano
>
>
>
> Il giorno sabato 7 dicembre 2013, Jean-Baptiste Onofré ha scritto:
>
>  FYI:
>
> https://issues.apache.org/jira/browse/SMX4-1634
>
> Regards
> JB
>
> On 12/07/2013 01:45 PM, Jean-Baptiste Onofré wrote:
>
> Hi Christiano,
>
> I already did the gwt bundles in the past.
>
> I gonna create new gwt bundles (for 2.6.0) and include it in the next
> 2013.12 release.
>
> Regards
> JB
>
> On 12/07/2013 01:35 PM, Cristiano Costantini wrote:
>
> Hi All,
>
> as there is no so many interest on supporting OSGi in the GWT community
> (the related issue has only 5 votes:
> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424 and I
> know all of those who have starred it :-D ),
> I wonder if it is more appropriate to make OSGi release
> under org.apache.servicemix.bundles.
>
> It has been done in the past (for
> "org.apache.servicemix.bundles/org.apache.servicemix.
> bundles.gwt-user/2.4.0_1"
>
> and
> "org.apache.servicemix.bundles/org.apache.servicemix.
> bundles.gwt-dev/2.4.0_1").
>
>
> Now it is going to be released GWT version 2.6.0 and I believe it
> should be
> released only gwt-servlet artifact with OSGi headers (so
> "org.apache.servicemix.bundles/org.apache.servicemix.
> bundles.gwt-servlet/2.6.0_1").
>
>
>
> Could someone point me to the right process (where is the source code of
> org.apache.servicemix.bundles.*, where to open related issues, where to
> discuss them, who to involve in the approval process) so I can try to
> push
> and support for this proposal?
>
>
> Thank you!!!
> Cristiano
>
>
>
>
>
>
> 2013/11/19 Cristiano Costantini <cr...@gmail.com>
>
>   Hi all!
> Just an update about my ongoing effort to OSGIfy GWT.
>
> I did proposed a patch to GWT community and to validate it I've
> adapted 5
> significant examples from the GWT distribution to run on Apache Karaf,
> (more precisely I used ServiceMix 4.5.3 but I'm not using neither Camel,
> CXF or ActiveMQ).
>
> You can find the examples here:
> https://github.com/cristcost/gwt-karaf-examples
>
> They require GWT compiled using this patch of mine
> https://gwt-review.googlesource.com/#/c/5351/
> If someone want to try them out, I will be glad to help and give more
> detailed instructions.
>
> Actually there is no so much interest from GWT community, so I would
> like
> you all supporting me by starring the related issue:
> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424
> and if you are interested, apply to
> https://gwt-review.googlesource.com/and perform a (non binding)
> review of
> https://gwt-review.googlesource.com/#/c/5351/ so that the patch can be
> noticed more.
>
>
> The patch is not yet ideal, as the .bnd file contains some
> "workaround" to
> address complex dependencies in the GWT jar, but I hope these can be
> addressed by a refactoring in GWT package structure in next release.
> Also,
> there is a rare issue when two applications are deployed together and
> use
> "com.google.web.bindery.requestfactory.server.RequestFactoryServlet".
> Anyhow I would like it to be approved for the upcoming final release of
> GWT 2.6.0 which is expected beginning of december, so that community can
> start developing first prototype applications using this architecture.
>
> To go back to the examples, they actually don't make full use of OSGi
> capabilities (no OSGi service is used for this) but me and some
> friends are
> working on a *full* demo application that make use of the full
> ServiceMix
> stack and have a GW
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: OSGIfy server jar of GWT

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Sure, I created the Jira to track it.

I will create a first bundle, feel free to review and provide your 
feedback !

Thanks,
Regards
JB

On 12/07/2013 02:05 PM, Cristiano Costantini wrote:
> Ok, good,
> I'll check it.
>
> I have worked a lot in the past weeks to test GWT on servicemix also by
> adapting many examples, and I have many considerations to provide, please
> take some time to take into account my feedback ;-)
>
> Cristiano
>
>
>
> Il giorno sabato 7 dicembre 2013, Jean-Baptiste Onofré ha scritto:
>
>> FYI:
>>
>> https://issues.apache.org/jira/browse/SMX4-1634
>>
>> Regards
>> JB
>>
>> On 12/07/2013 01:45 PM, Jean-Baptiste Onofré wrote:
>>
>> Hi Christiano,
>>
>> I already did the gwt bundles in the past.
>>
>> I gonna create new gwt bundles (for 2.6.0) and include it in the next
>> 2013.12 release.
>>
>> Regards
>> JB
>>
>> On 12/07/2013 01:35 PM, Cristiano Costantini wrote:
>>
>> Hi All,
>>
>> as there is no so many interest on supporting OSGi in the GWT community
>> (the related issue has only 5 votes:
>> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424 and I
>> know all of those who have starred it :-D ),
>> I wonder if it is more appropriate to make OSGi release
>> under org.apache.servicemix.bundles.
>>
>> It has been done in the past (for
>> "org.apache.servicemix.bundles/org.apache.servicemix.
>> bundles.gwt-user/2.4.0_1"
>>
>> and
>> "org.apache.servicemix.bundles/org.apache.servicemix.
>> bundles.gwt-dev/2.4.0_1").
>>
>>
>> Now it is going to be released GWT version 2.6.0 and I believe it
>> should be
>> released only gwt-servlet artifact with OSGi headers (so
>> "org.apache.servicemix.bundles/org.apache.servicemix.
>> bundles.gwt-servlet/2.6.0_1").
>>
>>
>>
>> Could someone point me to the right process (where is the source code of
>> org.apache.servicemix.bundles.*, where to open related issues, where to
>> discuss them, who to involve in the approval process) so I can try to
>> push
>> and support for this proposal?
>>
>>
>> Thank you!!!
>> Cristiano
>>
>>
>>
>>
>>
>>
>> 2013/11/19 Cristiano Costantini <cr...@gmail.com>
>>
>>   Hi all!
>> Just an update about my ongoing effort to OSGIfy GWT.
>>
>> I did proposed a patch to GWT community and to validate it I've
>> adapted 5
>> significant examples from the GWT distribution to run on Apache Karaf,
>> (more precisely I used ServiceMix 4.5.3 but I'm not using neither Camel,
>> CXF or ActiveMQ).
>>
>> You can find the examples here:
>> https://github.com/cristcost/gwt-karaf-examples
>>
>> They require GWT compiled using this patch of mine
>> https://gwt-review.googlesource.com/#/c/5351/
>> If someone want to try them out, I will be glad to help and give more
>> detailed instructions.
>>
>> Actually there is no so much interest from GWT community, so I would
>> like
>> you all supporting me by starring the related issue:
>> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424
>> and if you are interested, apply to
>> https://gwt-review.googlesource.com/and perform a (non binding)
>> review of
>> https://gwt-review.googlesource.com/#/c/5351/ so that the patch can be
>> noticed more.
>>
>>
>> The patch is not yet ideal, as the .bnd file contains some
>> "workaround" to
>> address complex dependencies in the GWT jar, but I hope these can be
>> addressed by a refactoring in GWT package structure in next release.
>> Also,
>> there is a rare issue when two applications are deployed together and
>> use
>> "com.google.web.bindery.requestfactory.server.RequestFactoryServlet".
>> Anyhow I would like it to be approved for the upcoming final release of
>> GWT 2.6.0 which is expected beginning of december, so that community can
>> start developing first prototype applications using this architecture.
>>
>> To go back to the examples, they actually don't make full use of OSGi
>> capabilities (no OSGi service is used for this) but me and some
>> friends are
>> working on a *full* demo application that make use of the full
>> ServiceMix
>> stack and have a GWT front-end deployed on ServiceMix. For this demo,
>> stay
>> tuned on this other github project
>> https://github.com/cristcost/sensormix
>> We would like to have it working on next version of GWT (2.6.0) and also
>> next version of ServiceMix (4.6.0). We would like to finish it before
>> mid
>> december, and we will present it at next "GDG Firenze Happy Hour"
>> meeting
>> that should b
>>
>>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OSGIfy server jar of GWT

Posted by Cristiano Costantini <cr...@gmail.com>.
Ok, good,
I'll check it.

I have worked a lot in the past weeks to test GWT on servicemix also by
adapting many examples, and I have many considerations to provide, please
take some time to take into account my feedback ;-)

Cristiano



Il giorno sabato 7 dicembre 2013, Jean-Baptiste Onofré ha scritto:

> FYI:
>
> https://issues.apache.org/jira/browse/SMX4-1634
>
> Regards
> JB
>
> On 12/07/2013 01:45 PM, Jean-Baptiste Onofré wrote:
>
> Hi Christiano,
>
> I already did the gwt bundles in the past.
>
> I gonna create new gwt bundles (for 2.6.0) and include it in the next
> 2013.12 release.
>
> Regards
> JB
>
> On 12/07/2013 01:35 PM, Cristiano Costantini wrote:
>
> Hi All,
>
> as there is no so many interest on supporting OSGi in the GWT community
> (the related issue has only 5 votes:
> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424 and I
> know all of those who have starred it :-D ),
> I wonder if it is more appropriate to make OSGi release
> under org.apache.servicemix.bundles.
>
> It has been done in the past (for
> "org.apache.servicemix.bundles/org.apache.servicemix.
> bundles.gwt-user/2.4.0_1"
>
> and
> "org.apache.servicemix.bundles/org.apache.servicemix.
> bundles.gwt-dev/2.4.0_1").
>
>
> Now it is going to be released GWT version 2.6.0 and I believe it
> should be
> released only gwt-servlet artifact with OSGi headers (so
> "org.apache.servicemix.bundles/org.apache.servicemix.
> bundles.gwt-servlet/2.6.0_1").
>
>
>
> Could someone point me to the right process (where is the source code of
> org.apache.servicemix.bundles.*, where to open related issues, where to
> discuss them, who to involve in the approval process) so I can try to
> push
> and support for this proposal?
>
>
> Thank you!!!
> Cristiano
>
>
>
>
>
>
> 2013/11/19 Cristiano Costantini <cr...@gmail.com>
>
>  Hi all!
> Just an update about my ongoing effort to OSGIfy GWT.
>
> I did proposed a patch to GWT community and to validate it I've
> adapted 5
> significant examples from the GWT distribution to run on Apache Karaf,
> (more precisely I used ServiceMix 4.5.3 but I'm not using neither Camel,
> CXF or ActiveMQ).
>
> You can find the examples here:
> https://github.com/cristcost/gwt-karaf-examples
>
> They require GWT compiled using this patch of mine
> https://gwt-review.googlesource.com/#/c/5351/
> If someone want to try them out, I will be glad to help and give more
> detailed instructions.
>
> Actually there is no so much interest from GWT community, so I would
> like
> you all supporting me by starring the related issue:
> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424
> and if you are interested, apply to
> https://gwt-review.googlesource.com/and perform a (non binding)
> review of
> https://gwt-review.googlesource.com/#/c/5351/ so that the patch can be
> noticed more.
>
>
> The patch is not yet ideal, as the .bnd file contains some
> "workaround" to
> address complex dependencies in the GWT jar, but I hope these can be
> addressed by a refactoring in GWT package structure in next release.
> Also,
> there is a rare issue when two applications are deployed together and
> use
> "com.google.web.bindery.requestfactory.server.RequestFactoryServlet".
> Anyhow I would like it to be approved for the upcoming final release of
> GWT 2.6.0 which is expected beginning of december, so that community can
> start developing first prototype applications using this architecture.
>
> To go back to the examples, they actually don't make full use of OSGi
> capabilities (no OSGi service is used for this) but me and some
> friends are
> working on a *full* demo application that make use of the full
> ServiceMix
> stack and have a GWT front-end deployed on ServiceMix. For this demo,
> stay
> tuned on this other github project
> https://github.com/cristcost/sensormix
> We would like to have it working on next version of GWT (2.6.0) and also
> next version of ServiceMix (4.6.0). We would like to finish it before
> mid
> december, and we will present it at next "GDG Firenze Happy Hour"
> meeting
> that should b
>
>

Re: OSGIfy server jar of GWT

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
FYI:

https://issues.apache.org/jira/browse/SMX4-1634

Regards
JB

On 12/07/2013 01:45 PM, Jean-Baptiste Onofré wrote:
> Hi Christiano,
>
> I already did the gwt bundles in the past.
>
> I gonna create new gwt bundles (for 2.6.0) and include it in the next
> 2013.12 release.
>
> Regards
> JB
>
> On 12/07/2013 01:35 PM, Cristiano Costantini wrote:
>> Hi All,
>>
>> as there is no so many interest on supporting OSGi in the GWT community
>> (the related issue has only 5 votes:
>> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424 and I
>> know all of those who have starred it :-D ),
>> I wonder if it is more appropriate to make OSGi release
>> under org.apache.servicemix.bundles.
>>
>> It has been done in the past (for
>> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-user/2.4.0_1"
>>
>> and
>> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-dev/2.4.0_1").
>>
>>
>> Now it is going to be released GWT version 2.6.0 and I believe it
>> should be
>> released only gwt-servlet artifact with OSGi headers (so
>> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-servlet/2.6.0_1").
>>
>>
>>
>> Could someone point me to the right process (where is the source code of
>> org.apache.servicemix.bundles.*, where to open related issues, where to
>> discuss them, who to involve in the approval process) so I can try to
>> push
>> and support for this proposal?
>>
>>
>> Thank you!!!
>> Cristiano
>>
>>
>>
>>
>>
>>
>> 2013/11/19 Cristiano Costantini <cr...@gmail.com>
>>
>>> Hi all!
>>> Just an update about my ongoing effort to OSGIfy GWT.
>>>
>>> I did proposed a patch to GWT community and to validate it I've
>>> adapted 5
>>> significant examples from the GWT distribution to run on Apache Karaf,
>>> (more precisely I used ServiceMix 4.5.3 but I'm not using neither Camel,
>>> CXF or ActiveMQ).
>>>
>>> You can find the examples here:
>>> https://github.com/cristcost/gwt-karaf-examples
>>>
>>> They require GWT compiled using this patch of mine
>>> https://gwt-review.googlesource.com/#/c/5351/
>>> If someone want to try them out, I will be glad to help and give more
>>> detailed instructions.
>>>
>>> Actually there is no so much interest from GWT community, so I would
>>> like
>>> you all supporting me by starring the related issue:
>>> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424
>>> and if you are interested, apply to
>>> https://gwt-review.googlesource.com/and perform a (non binding)
>>> review of
>>> https://gwt-review.googlesource.com/#/c/5351/ so that the patch can be
>>> noticed more.
>>>
>>>
>>> The patch is not yet ideal, as the .bnd file contains some
>>> "workaround" to
>>> address complex dependencies in the GWT jar, but I hope these can be
>>> addressed by a refactoring in GWT package structure in next release.
>>> Also,
>>> there is a rare issue when two applications are deployed together and
>>> use
>>> "com.google.web.bindery.requestfactory.server.RequestFactoryServlet".
>>> Anyhow I would like it to be approved for the upcoming final release of
>>> GWT 2.6.0 which is expected beginning of december, so that community can
>>> start developing first prototype applications using this architecture.
>>>
>>> To go back to the examples, they actually don't make full use of OSGi
>>> capabilities (no OSGi service is used for this) but me and some
>>> friends are
>>> working on a *full* demo application that make use of the full
>>> ServiceMix
>>> stack and have a GWT front-end deployed on ServiceMix. For this demo,
>>> stay
>>> tuned on this other github project
>>> https://github.com/cristcost/sensormix
>>> We would like to have it working on next version of GWT (2.6.0) and also
>>> next version of ServiceMix (4.6.0). We would like to finish it before
>>> mid
>>> december, and we will present it at next "GDG Firenze Happy Hour"
>>> meeting
>>> that should be next 11th of December (you are welcome to join if you
>>> make a
>>> stop in Italy).
>>>
>>> I hope this topic interests you and if you like it I will be glad to
>>> have
>>> feedback about this so to encourage me and my friends ;-)
>>> Finally, we are open to any suggestion.
>>>
>>> Thank you
>>>
>>> Cristiano
>>>
>>>
>>>
>>>
>>> 2013/11/8 Cristiano Costantini <cr...@gmail.com>
>>>
>>>> Hi all,
>>>> I have followed Gert suggestion and I have a small patch that integrate
>>>> osgi-fication of GWT-Servlet in the GWT ant build.
>>>>
>>>> I have one question before submitting the patch. The bnd property files
>>>> looks like this:
>>>>
>>>> Bundle-Name: Google Web Toolkit :: Servlet
>>>> Bundle-SymbolicName: gwt-servlet
>>>> Bundle-Version: @version@
>>>> Export-Package: *;version=@version@
>>>> Import-Package: javax.servlet.*, !com.google.gwt.*,
>>>> *;resolution:=optional
>>>>
>>>> the instruction !com.google.gwt.* generates the header
>>>> "Ignore-Package:",
>>>> and I have never seen it header before,
>>>> but if I leave the configuration with just "Import-Package:
>>>> *;resolution:=optional", I get a manifest with a huge list of optional
>>>> package imports.
>>>>
>>>> I'm confident that the bundle really don't need to import packages
>>>> inside
>>>> com.google.gwt.* so excluding them seems more optimized.
>>>> But I was not expecting the Ignore-Package header, and I don't know how
>>>> to interpret it.
>>>>
>>>> So, which one of the two configuration should I use?
>>>> Import-Package: *;resolution:=optional  ==> more conservative solution
>>>> Import-Package: javax.servlet.*, !com.google.gwt.*,
>>>> *;resolution:=optional  ==> probably more optimized
>>>>
>>>> both options works on my test (but it is a simple one).
>>>>
>>>> Thank you again.
>>>> Cristiano
>>>>
>>>>
>>>>
>>>>
>>>> 2013/11/6 Gert Vanthienen <ge...@gmail.com>
>>>>
>>>>> 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
>>>>> <cr...@gmail.com> 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>
>>>>>
>>>>
>>>>
>>>
>>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OSGIfy server jar of GWT

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Christiano,

I already did the gwt bundles in the past.

I gonna create new gwt bundles (for 2.6.0) and include it in the next 
2013.12 release.

Regards
JB

On 12/07/2013 01:35 PM, Cristiano Costantini wrote:
> Hi All,
>
> as there is no so many interest on supporting OSGi in the GWT community
> (the related issue has only 5 votes:
> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424 and I
> know all of those who have starred it :-D ),
> I wonder if it is more appropriate to make OSGi release
> under org.apache.servicemix.bundles.
>
> It has been done in the past (for
> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-user/2.4.0_1"
> and
> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-dev/2.4.0_1").
>
> Now it is going to be released GWT version 2.6.0 and I believe it should be
> released only gwt-servlet artifact with OSGi headers (so
> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-servlet/2.6.0_1").
>
>
> Could someone point me to the right process (where is the source code of
> org.apache.servicemix.bundles.*, where to open related issues, where to
> discuss them, who to involve in the approval process) so I can try to push
> and support for this proposal?
>
>
> Thank you!!!
> Cristiano
>
>
>
>
>
>
> 2013/11/19 Cristiano Costantini <cr...@gmail.com>
>
>> Hi all!
>> Just an update about my ongoing effort to OSGIfy GWT.
>>
>> I did proposed a patch to GWT community and to validate it I've adapted 5
>> significant examples from the GWT distribution to run on Apache Karaf,
>> (more precisely I used ServiceMix 4.5.3 but I'm not using neither Camel,
>> CXF or ActiveMQ).
>>
>> You can find the examples here:
>> https://github.com/cristcost/gwt-karaf-examples
>>
>> They require GWT compiled using this patch of mine
>> https://gwt-review.googlesource.com/#/c/5351/
>> If someone want to try them out, I will be glad to help and give more
>> detailed instructions.
>>
>> Actually there is no so much interest from GWT community, so I would like
>> you all supporting me by starring the related issue:
>> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424
>> and if you are interested, apply to https://gwt-review.googlesource.com/and perform a (non binding) review of
>> https://gwt-review.googlesource.com/#/c/5351/ so that the patch can be
>> noticed more.
>>
>>
>> The patch is not yet ideal, as the .bnd file contains some "workaround" to
>> address complex dependencies in the GWT jar, but I hope these can be
>> addressed by a refactoring in GWT package structure in next release. Also,
>> there is a rare issue when two applications are deployed together and use
>> "com.google.web.bindery.requestfactory.server.RequestFactoryServlet".
>> Anyhow I would like it to be approved for the upcoming final release of
>> GWT 2.6.0 which is expected beginning of december, so that community can
>> start developing first prototype applications using this architecture.
>>
>> To go back to the examples, they actually don't make full use of OSGi
>> capabilities (no OSGi service is used for this) but me and some friends are
>> working on a *full* demo application that make use of the full ServiceMix
>> stack and have a GWT front-end deployed on ServiceMix. For this demo, stay
>> tuned on this other github project https://github.com/cristcost/sensormix
>> We would like to have it working on next version of GWT (2.6.0) and also
>> next version of ServiceMix (4.6.0). We would like to finish it before mid
>> december, and we will present it at next "GDG Firenze Happy Hour" meeting
>> that should be next 11th of December (you are welcome to join if you make a
>> stop in Italy).
>>
>> I hope this topic interests you and if you like it I will be glad to have
>> feedback about this so to encourage me and my friends ;-)
>> Finally, we are open to any suggestion.
>>
>> Thank you
>>
>> Cristiano
>>
>>
>>
>>
>> 2013/11/8 Cristiano Costantini <cr...@gmail.com>
>>
>>> Hi all,
>>> I have followed Gert suggestion and I have a small patch that integrate
>>> osgi-fication of GWT-Servlet in the GWT ant build.
>>>
>>> I have one question before submitting the patch. The bnd property files
>>> looks like this:
>>>
>>> Bundle-Name: Google Web Toolkit :: Servlet
>>> Bundle-SymbolicName: gwt-servlet
>>> Bundle-Version: @version@
>>> Export-Package: *;version=@version@
>>> Import-Package: javax.servlet.*, !com.google.gwt.*, *;resolution:=optional
>>>
>>> the instruction !com.google.gwt.* generates the header "Ignore-Package:",
>>> and I have never seen it header before,
>>> but if I leave the configuration with just "Import-Package:
>>> *;resolution:=optional", I get a manifest with a huge list of optional
>>> package imports.
>>>
>>> I'm confident that the bundle really don't need to import packages inside
>>> com.google.gwt.* so excluding them seems more optimized.
>>> But I was not expecting the Ignore-Package header, and I don't know how
>>> to interpret it.
>>>
>>> So, which one of the two configuration should I use?
>>> Import-Package: *;resolution:=optional  ==> more conservative solution
>>> Import-Package: javax.servlet.*, !com.google.gwt.*,
>>> *;resolution:=optional  ==> probably more optimized
>>>
>>> both options works on my test (but it is a simple one).
>>>
>>> Thank you again.
>>> Cristiano
>>>
>>>
>>>
>>>
>>> 2013/11/6 Gert Vanthienen <ge...@gmail.com>
>>>
>>>> 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
>>>> <cr...@gmail.com> 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>
>>>>
>>>
>>>
>>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OSGIfy server jar of GWT

Posted by Cristiano Costantini <cr...@gmail.com>.
Hi All,

as there is no so many interest on supporting OSGi in the GWT community
(the related issue has only 5 votes:
https://code.google.com/p/google-web-toolkit/issues/detail?id=8424 and I
know all of those who have starred it :-D ),
I wonder if it is more appropriate to make OSGi release
under org.apache.servicemix.bundles.

It has been done in the past (for
"org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-user/2.4.0_1"
and
"org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-dev/2.4.0_1").

Now it is going to be released GWT version 2.6.0 and I believe it should be
released only gwt-servlet artifact with OSGi headers (so
"org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-servlet/2.6.0_1").


Could someone point me to the right process (where is the source code of
org.apache.servicemix.bundles.*, where to open related issues, where to
discuss them, who to involve in the approval process) so I can try to push
and support for this proposal?


Thank you!!!
Cristiano






2013/11/19 Cristiano Costantini <cr...@gmail.com>

> Hi all!
> Just an update about my ongoing effort to OSGIfy GWT.
>
> I did proposed a patch to GWT community and to validate it I've adapted 5
> significant examples from the GWT distribution to run on Apache Karaf,
> (more precisely I used ServiceMix 4.5.3 but I'm not using neither Camel,
> CXF or ActiveMQ).
>
> You can find the examples here:
> https://github.com/cristcost/gwt-karaf-examples
>
> They require GWT compiled using this patch of mine
> https://gwt-review.googlesource.com/#/c/5351/
> If someone want to try them out, I will be glad to help and give more
> detailed instructions.
>
> Actually there is no so much interest from GWT community, so I would like
> you all supporting me by starring the related issue:
> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424
> and if you are interested, apply to https://gwt-review.googlesource.com/and perform a (non binding) review of
> https://gwt-review.googlesource.com/#/c/5351/ so that the patch can be
> noticed more.
>
>
> The patch is not yet ideal, as the .bnd file contains some "workaround" to
> address complex dependencies in the GWT jar, but I hope these can be
> addressed by a refactoring in GWT package structure in next release. Also,
> there is a rare issue when two applications are deployed together and use
> "com.google.web.bindery.requestfactory.server.RequestFactoryServlet".
> Anyhow I would like it to be approved for the upcoming final release of
> GWT 2.6.0 which is expected beginning of december, so that community can
> start developing first prototype applications using this architecture.
>
> To go back to the examples, they actually don't make full use of OSGi
> capabilities (no OSGi service is used for this) but me and some friends are
> working on a *full* demo application that make use of the full ServiceMix
> stack and have a GWT front-end deployed on ServiceMix. For this demo, stay
> tuned on this other github project https://github.com/cristcost/sensormix
> We would like to have it working on next version of GWT (2.6.0) and also
> next version of ServiceMix (4.6.0). We would like to finish it before mid
> december, and we will present it at next "GDG Firenze Happy Hour" meeting
> that should be next 11th of December (you are welcome to join if you make a
> stop in Italy).
>
> I hope this topic interests you and if you like it I will be glad to have
> feedback about this so to encourage me and my friends ;-)
> Finally, we are open to any suggestion.
>
> Thank you
>
> Cristiano
>
>
>
>
> 2013/11/8 Cristiano Costantini <cr...@gmail.com>
>
>> Hi all,
>> I have followed Gert suggestion and I have a small patch that integrate
>> osgi-fication of GWT-Servlet in the GWT ant build.
>>
>> I have one question before submitting the patch. The bnd property files
>> looks like this:
>>
>> Bundle-Name: Google Web Toolkit :: Servlet
>> Bundle-SymbolicName: gwt-servlet
>> Bundle-Version: @version@
>> Export-Package: *;version=@version@
>> Import-Package: javax.servlet.*, !com.google.gwt.*, *;resolution:=optional
>>
>> the instruction !com.google.gwt.* generates the header "Ignore-Package:",
>> and I have never seen it header before,
>> but if I leave the configuration with just "Import-Package:
>> *;resolution:=optional", I get a manifest with a huge list of optional
>> package imports.
>>
>> I'm confident that the bundle really don't need to import packages inside
>> com.google.gwt.* so excluding them seems more optimized.
>> But I was not expecting the Ignore-Package header, and I don't know how
>> to interpret it.
>>
>> So, which one of the two configuration should I use?
>> Import-Package: *;resolution:=optional  ==> more conservative solution
>> Import-Package: javax.servlet.*, !com.google.gwt.*,
>> *;resolution:=optional  ==> probably more optimized
>>
>> both options works on my test (but it is a simple one).
>>
>> Thank you again.
>> Cristiano
>>
>>
>>
>>
>> 2013/11/6 Gert Vanthienen <ge...@gmail.com>
>>
>>> 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
>>> <cr...@gmail.com> 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>
>>>
>>
>>
>

Re: OSGIfy server jar of GWT

Posted by Cristiano Costantini <cr...@gmail.com>.
Hi all!
Just an update about my ongoing effort to OSGIfy GWT.

I did proposed a patch to GWT community and to validate it I've adapted 5
significant examples from the GWT distribution to run on Apache Karaf,
(more precisely I used ServiceMix 4.5.3 but I'm not using neither Camel,
CXF or ActiveMQ).

You can find the examples here:
https://github.com/cristcost/gwt-karaf-examples

They require GWT compiled using this patch of mine
https://gwt-review.googlesource.com/#/c/5351/
If someone want to try them out, I will be glad to help and give more
detailed instructions.

Actually there is no so much interest from GWT community, so I would like
you all supporting me by starring the related issue:
https://code.google.com/p/google-web-toolkit/issues/detail?id=8424
and if you are interested, apply to
https://gwt-review.googlesource.com/and perform a (non binding) review
of
https://gwt-review.googlesource.com/#/c/5351/ so that the patch can be
noticed more.


The patch is not yet ideal, as the .bnd file contains some "workaround" to
address complex dependencies in the GWT jar, but I hope these can be
addressed by a refactoring in GWT package structure in next release. Also,
there is a rare issue when two applications are deployed together and use
"com.google.web.bindery.requestfactory.server.RequestFactoryServlet".
Anyhow I would like it to be approved for the upcoming final release of GWT
2.6.0 which is expected beginning of december, so that community can start
developing first prototype applications using this architecture.

To go back to the examples, they actually don't make full use of OSGi
capabilities (no OSGi service is used for this) but me and some friends are
working on a *full* demo application that make use of the full ServiceMix
stack and have a GWT front-end deployed on ServiceMix. For this demo, stay
tuned on this other github project https://github.com/cristcost/sensormix
We would like to have it working on next version of GWT (2.6.0) and also
next version of ServiceMix (4.6.0). We would like to finish it before mid
december, and we will present it at next "GDG Firenze Happy Hour" meeting
that should be next 11th of December (you are welcome to join if you make a
stop in Italy).

I hope this topic interests you and if you like it I will be glad to have
feedback about this so to encourage me and my friends ;-)
Finally, we are open to any suggestion.

Thank you

Cristiano




2013/11/8 Cristiano Costantini <cr...@gmail.com>

> Hi all,
> I have followed Gert suggestion and I have a small patch that integrate
> osgi-fication of GWT-Servlet in the GWT ant build.
>
> I have one question before submitting the patch. The bnd property files
> looks like this:
>
> Bundle-Name: Google Web Toolkit :: Servlet
> Bundle-SymbolicName: gwt-servlet
> Bundle-Version: @version@
> Export-Package: *;version=@version@
> Import-Package: javax.servlet.*, !com.google.gwt.*, *;resolution:=optional
>
> the instruction !com.google.gwt.* generates the header "Ignore-Package:",
> and I have never seen it header before,
> but if I leave the configuration with just "Import-Package:
> *;resolution:=optional", I get a manifest with a huge list of optional
> package imports.
>
> I'm confident that the bundle really don't need to import packages inside
> com.google.gwt.* so excluding them seems more optimized.
> But I was not expecting the Ignore-Package header, and I don't know how to
> interpret it.
>
> So, which one of the two configuration should I use?
> Import-Package: *;resolution:=optional  ==> more conservative solution
> Import-Package: javax.servlet.*, !com.google.gwt.*, *;resolution:=optional
>  ==> probably more optimized
>
> both options works on my test (but it is a simple one).
>
> Thank you again.
> Cristiano
>
>
>
>
> 2013/11/6 Gert Vanthienen <ge...@gmail.com>
>
>> 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
>> <cr...@gmail.com> 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>
>>
>
>

Re: OSGIfy server jar of GWT

Posted by Cristiano Costantini <cr...@gmail.com>.
Hi all,
I have followed Gert suggestion and I have a small patch that integrate
osgi-fication of GWT-Servlet in the GWT ant build.

I have one question before submitting the patch. The bnd property files
looks like this:

Bundle-Name: Google Web Toolkit :: Servlet
Bundle-SymbolicName: gwt-servlet
Bundle-Version: @version@
Export-Package: *;version=@version@
Import-Package: javax.servlet.*, !com.google.gwt.*, *;resolution:=optional

the instruction !com.google.gwt.* generates the header "Ignore-Package:",
and I have never seen it header before,
but if I leave the configuration with just "Import-Package:
*;resolution:=optional", I get a manifest with a huge list of optional
package imports.

I'm confident that the bundle really don't need to import packages inside
com.google.gwt.* so excluding them seems more optimized.
But I was not expecting the Ignore-Package header, and I don't know how to
interpret it.

So, which one of the two configuration should I use?
Import-Package: *;resolution:=optional  ==> more conservative solution
Import-Package: javax.servlet.*, !com.google.gwt.*, *;resolution:=optional
 ==> probably more optimized

both options works on my test (but it is a simple one).

Thank you again.
Cristiano




2013/11/6 Gert Vanthienen <ge...@gmail.com>

> 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
> <cr...@gmail.com> 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>
>

Re: OSGIfy server jar of GWT

Posted by Gert Vanthienen <ge...@gmail.com>.
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
<cr...@gmail.com> 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>

Re: OSGIfy server jar of GWT

Posted by Cristiano Costantini <cr...@gmail.com>.
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>

Re: OSGIfy server jar of GWT

Posted by Cristiano Costantini <cr...@gmail.com>.
Hi all,
thank you for your interest,

I've made a post on GWT contributor website to better ask about their plan
on migration from Ant.

If GWT 2.6.0 will use Ant, I will try to integrate BND into the build (if
it will be Gradle I will need to study the tool before! BTW I'm a fan of
Maven and I will be disappointed if GWT adopts gradle instead of Maven)

I will make some test after I have a clear picture and in case I need help
I will ask you here.
Thank you for your support!

Cristiano





2013/10/31 Gert Vanthienen <ge...@gmail.com>

> Cristiano,
>
>
> I have used neither of them myself, but it looks like the aQute
> website itself has some info on how to do this with Ant
> (http://www.aqute.biz/Bnd/Ant) and for Gradle, there seems to be a
> plugin as well (
> http://www.gradle.org/docs/current/userguide/osgi_plugin.html)
>
> If you get any of those solutions working and would do a blog post or
> something, be sure to let us know. We do recommend Maven to our users,
> but we're bound to get these questions about other build systems
> occasionally as well.
>
>
> Regards,
>
> Gert Vanthienen
>
>
> On Thu, Oct 31, 2013 at 8:41 AM, Cristiano Costantini
> <cr...@gmail.com> wrote:
> > Hello All,
> >
> > on maven central repo, there is a servicemix OSGIfized version of GWT dev
> > library:
> >
> http://search.maven.org/#artifactdetails%7Corg.apache.servicemix.bundles%7Corg.apache.servicemix.bundles.gwt-dev%7C2.4.0_1%7Cbundle
> >
> > This is linked GWT version 2.4.0, actually the last release is 2.5.1 and
> > 2.6.0 is going to come out as a release candidate on 4 november, with a
> > final 2.6.0 expected for december.
> >
> > I wonder if we can propose a patch to OSGIfy GWT, so that it could be
> > included in the upcoming 2.6.0 release.
> > Generally on server side of a GWT application you only put the
> GWT-Servlet
> > artifact, so I think it could be enough to OSGIfy this jar.
> >
> > I would like to do it, but I have only created bundles using the Maven
> > plugin, and GWT is built actually with ANT and is moving probably to
> Gradle
> > or Maven with strong preference to Gradle.
> >
> > So, can someone suggest what is the best approach to put on the Ant build
> > the proper way to OSGIfy the Jar?
> >
> > Someone has some example?
> > I would like to try it out and do some test if someone can help me in
> > filling the gap.
> >
> >
> > Me and some friends are making a demo application based on Servicemix
> that
> > we will publish on Github, and we would like to use GWT on Servicemix for
> > this demo.
> >
> >
> > Thank you,
> > Cristiano
>

Re: OSGIfy server jar of GWT

Posted by Gert Vanthienen <ge...@gmail.com>.
Cristiano,


I have used neither of them myself, but it looks like the aQute
website itself has some info on how to do this with Ant
(http://www.aqute.biz/Bnd/Ant) and for Gradle, there seems to be a
plugin as well (http://www.gradle.org/docs/current/userguide/osgi_plugin.html)

If you get any of those solutions working and would do a blog post or
something, be sure to let us know. We do recommend Maven to our users,
but we're bound to get these questions about other build systems
occasionally as well.


Regards,

Gert Vanthienen


On Thu, Oct 31, 2013 at 8:41 AM, Cristiano Costantini
<cr...@gmail.com> wrote:
> Hello All,
>
> on maven central repo, there is a servicemix OSGIfized version of GWT dev
> library:
> http://search.maven.org/#artifactdetails%7Corg.apache.servicemix.bundles%7Corg.apache.servicemix.bundles.gwt-dev%7C2.4.0_1%7Cbundle
>
> This is linked GWT version 2.4.0, actually the last release is 2.5.1 and
> 2.6.0 is going to come out as a release candidate on 4 november, with a
> final 2.6.0 expected for december.
>
> I wonder if we can propose a patch to OSGIfy GWT, so that it could be
> included in the upcoming 2.6.0 release.
> Generally on server side of a GWT application you only put the GWT-Servlet
> artifact, so I think it could be enough to OSGIfy this jar.
>
> I would like to do it, but I have only created bundles using the Maven
> plugin, and GWT is built actually with ANT and is moving probably to Gradle
> or Maven with strong preference to Gradle.
>
> So, can someone suggest what is the best approach to put on the Ant build
> the proper way to OSGIfy the Jar?
>
> Someone has some example?
> I would like to try it out and do some test if someone can help me in
> filling the gap.
>
>
> Me and some friends are making a demo application based on Servicemix that
> we will publish on Github, and we would like to use GWT on Servicemix for
> this demo.
>
>
> Thank you,
> Cristiano

Re: OSGIfy server jar of GWT

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Cristiano,

you can call bnd from ant. bnd will create the MANIFEST for you.

It's likely that the Felix maven-bundle-plugin does.

Ping me if you need help about that.

Regards
JB

On 10/31/2013 08:41 AM, Cristiano Costantini wrote:
> Hello All,
>
> on maven central repo, there is a servicemix OSGIfized version of GWT dev
> library:
> http://search.maven.org/#artifactdetails%7Corg.apache.servicemix.bundles%7Corg.apache.servicemix.bundles.gwt-dev%7C2.4.0_1%7Cbundle
>
> This is linked GWT version 2.4.0, actually the last release is 2.5.1 and
> 2.6.0 is going to come out as a release candidate on 4 november, with a
> final 2.6.0 expected for december.
>
> I wonder if we can propose a patch to OSGIfy GWT, so that it could be
> included in the upcoming 2.6.0 release.
> Generally on server side of a GWT application you only put the GWT-Servlet
> artifact, so I think it could be enough to OSGIfy this jar.
>
> I would like to do it, but I have only created bundles using the Maven
> plugin, and GWT is built actually with ANT and is moving probably to Gradle
> or Maven with strong preference to Gradle.
>
> So, can someone suggest what is the best approach to put on the Ant build
> the proper way to OSGIfy the Jar?
>
> Someone has some example?
> I would like to try it out and do some test if someone can help me in
> filling the gap.
>
>
> Me and some friends are making a demo application based on Servicemix that
> we will publish on Github, and we would like to use GWT on Servicemix for
> this demo.
>
>
> Thank you,
> Cristiano
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com