Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orbit-dev] Import-Package in osgi.bnd

On Fri, 2019-12-13 at 01:12 +0000, Homer, Tony wrote:
> I’m working on a new recipe to address https://bugs.eclipse.org/bugs/show_bug.cgi?id=558284.
> I used ebr to create the recipe and am working on reviewing osgi.bnd, specifically Import-Package.
> In previous threads, IIRC, Roland Grunberg had advised me to pay special attention to Import-Package and Carston Reckord had suggested some ways to assemble the list of imports.
>  
> I used a regex search to find all of the import statements in all the java files, then trimmed from the last ‘.’ to the end of the line to get the package list (and sorted to get unique list, etc).
> I was wondering about packages vs. subpackages because in some of the existing osgi.bnd files there seems to be a mix of toplevelpackage.* and toplevelpackage.subpackage.* in the Import-Package section.
> I went to look at the bndtools doc (https://bnd.bndtools.org/heads/import_package.html) and it says “The default for this header is *, resulting in importing all referred packages. This header therefore rarely has to be specified.”
>  
> This is actually what ebr:create-recipe provides:
> Import-Package: \
> *
>  
> Can I get a refresher on what we need to have in Import-Package with regard to package vs. subpackage and why ‘*’ isn’t sufficient?


It's a good idea to know the exact dependencies of the bundle you plan
to introduce, whether they exist in Orbit already at a compatible
version, or possibly needing to be added also.

You might use '*' and have unknowingly included dependencies that are
only optional. A bundle can also gain, or shrink its set of
dependencies and it's good to be aware of this. Otherwise '*' is
generally used as a catch-all for optional dependencies.

I think it's fine to use the toplevelpackage* (I think putting a dot
there means it won't match the top level package itself) and that
should only match against the packages that are actually being used so
you shouldn't need to list each specific one out. As an example, if you
depended on the docker-client package, you could cover that with
'com.spotify.docker.client*' but you probably don't want 'com.*'

If there are some cases where there are just too many dependencies to
list out or some issues where '*' really is wanted we can take it on a
case-by-case basis.


Hope this helps,
Roland Grunberg



Back to the top