bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
531 stars 304 forks source link

bnd not generating service capabilities from DS XML Descriptors #2322

Closed amitjoy closed 6 years ago

amitjoy commented 6 years ago

I just noticed in Bndtools 3.5 that bundles with DS XML Descriptors do not provide osgi.service capabilities. On the other hand, the service capabilities are only included for service components annotated with DS SCR annotations.

Background: I have a test bundle that depends on bundle A which has a osgi.service requirement of service S. And none of my repository bundles provides osgi.service capability for service S. Bundle B provides the implementation of service S and exports it as a service through DS XML Descriptor but it doesn't comprise the osgi.service capability.

Duplicate of #792

Bndtools Version: 3.5.0.REL-20170929-190052-ga0d7a6b

rotty3000 commented 6 years ago

I don't think this a bug. Bnd has no work to do when DS XML descriptors exist. Since someone manually created the descriptors, why not also add the requirements to the manifest?

On Feb 25, 2018 05:11, "Amit Kumar Mondal" notifications@github.com wrote:

I just noticed in Bndtools 3.5 that bundles with DS XML Descriptors do not provide osgi.service capabilities. On the other hand, the service capabilities are only included for service components annotated with DS SCR annotations.

Background: I have a test bundle that depends on bundle A which has a osgi.service requirement of service S. And none of my repository bundles provides osgi.service capability for service S. Bundle B provides the implementation of service S and exports it as a service through DS XML Descriptor but it doesn't comprise the osgi.service capability.

Duplicate of #792 https://github.com/bndtools/bnd/issues/792

Bndtools Version: 3.5.0.REL-20170929-190052-ga0d7a6b

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bndtools/bnd/issues/2322, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI9THTrmneplcencFSmpdSPJQW56y2Oks5tYTHXgaJpZM4SSPWd .

djencks commented 6 years ago

I agree. If you need to create the xml descriptors by hand, your requirements are likely so unusual that you want to specify the service exports explicitly too. Creating service exports from xml would also tend support anti patterns such as having a bundle set up a ds component using a class from another bundle. David Jencks

Sent from my iPhone

On Feb 25, 2018, at 8:06 AM, Raymond Augé notifications@github.com wrote:

I don't think this a bug. Bnd has no work to do when DS XML descriptors exist. Since someone manually created the descriptors, why not also add the requirements to the manifest?

On Feb 25, 2018 05:11, "Amit Kumar Mondal" notifications@github.com wrote:

I just noticed in Bndtools 3.5 that bundles with DS XML Descriptors do not provide osgi.service capabilities. On the other hand, the service capabilities are only included for service components annotated with DS SCR annotations.

Background: I have a test bundle that depends on bundle A which has a osgi.service requirement of service S. And none of my repository bundles provides osgi.service capability for service S. Bundle B provides the implementation of service S and exports it as a service through DS XML Descriptor but it doesn't comprise the osgi.service capability.

Duplicate of #792 https://github.com/bndtools/bnd/issues/792

Bndtools Version: 3.5.0.REL-20170929-190052-ga0d7a6b

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bndtools/bnd/issues/2322, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI9THTrmneplcencFSmpdSPJQW56y2Oks5tYTHXgaJpZM4SSPWd .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

amitjoy commented 6 years ago

@rotty3000 @djencks Thanks for the helpful information. Do you know of any external tool through which I could add capabilities and requirements based on DS XML Descriptors? I am asking this since I have several bundles and adding capabilities and requirements manually would be cumbersome.

timothyjward commented 6 years ago

@amitjoy is there a reason that you need to provide the descriptors as XML? If you replaced the XML with annotations then bnd would auto-generate the capabilities and requirements, it would also avoid the issue of the XML and source file getting out of sync with one another.

amitjoy commented 6 years ago

@timothyjward Few of the bundles were developed a long ago and have not been adapted to the latest developments in OSGi. That's why the XML descriptors are still in place and not using DS SCR annotations. It would have been really good if I could use the annotations instead of clumsy XML Descriptors. I have experienced it myself that bnd adds the needed requirements and capabilities automatically for service components annotated with SCR annotations. And hence I thought it would be good to have my old XML descriptors converted to annotations in the component class.

bjhargrave commented 6 years ago

@pkriens has a prototype to convert XML to annotations in the source code. That, which may come in a future release, would be a better solution.