requirements added by code in Conditional-Package

8 views
Skip to first unread message

Ferry Huberts

unread,
Aug 23, 2016, 4:28:54 AM8/23/16
to bndtool...@googlegroups.com
Hi

Is it possible to let code (that is added to a bundle through
Condition-Package) add requirements in the bundle?

For example: I want to add
Require-Capability: osgi.native;filter:="(osgi.native.osname=Linux)"


--
Ferry Huberts

Neil Bartlett

unread,
Aug 23, 2016, 9:06:31 AM8/23/16
to bndtool...@googlegroups.com
Hmm possibly if the code being added via Conditional-Package is annotated with @RequireCapability from aQute.bnd.annotation.headers. Haven’t tried but it might work.
> --
> You received this message because you are subscribed to the Google Groups "bndtools-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Ferry Huberts

unread,
Aug 23, 2016, 9:10:16 AM8/23/16
to bndtool...@googlegroups.com
Can I find an example somewhere of such an annotation?
--
Ferry Huberts

Neil Bartlett

unread,
Aug 23, 2016, 9:20:54 AM8/23/16
to bndtool...@googlegroups.com
Hmm it’s used extensively in enRoute, you might have to dig through the tutorials… unless Peter can point you somewhere more specific.

It can be used directly as an annotation on your classes, or as a meta-annotation, i.e. you can define an annotation such as @RequireFoobar and annotate THAT annotation with @RequireCapability(ns=“foobar”…). Then whenever somebody uses @RequireFoobar, they get the foobar requirement in their manifest.

So perhaps you can define your own @RequireNative annotation?

Peter Kriens

unread,
Aug 23, 2016, 9:52:29 AM8/23/16
to bndtool...@googlegroups.com
I guess if you add a RequireCapability annotation in that code somewhere then it should work.

Kind regards,

Peter Kriens
Reply all
Reply to author
Forward
0 new messages