Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Exporting packages without a version

equinox-dev-bounces@xxxxxxxxxxx wrote on 2014/12/11 09:08:19:

> From: Dennis Hübner <dennis.huebner@xxxxxxxxx>

> To: equinox-dev@xxxxxxxxxxx
> Date: 2014/12/11 09:10
> Subject: [equinox-dev] Exporting packages without a version
> Sent by: equinox-dev-bounces@xxxxxxxxxxx
>
> Hi equinox-dev team,
>
> I have a question regarding exporting an unversioned package.
> If I look over the bundles in eclipse, the most of them (expect of
> some orbit bundles) exports packages without a version.
> We do it likewise e.g.:
>
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: Xbase Runtime Library
> Bundle-SymbolicName: org.eclipse.xtext.xbase.lib
> Bundle-Version: 2.8.0.qualifier
> Bundle-RequiredExecutionEnvironment: J2SE-1.5
> Export-Package: org.eclipse.xtend2.lib,
>  org.eclipse.xtext.xbase.lib,
>  org.eclipse.xtext.xbase.lib.internal;x-internal:=true,
>  org.eclipse.xtext.xbase.lib.util
>
> In an osqi container I see that this packages are exported with 0.0.
> 0 it doesn’t care what the bundle-version is:
> osgi>  b 584
> org.eclipse.xtext.xbase.lib_2.7.3.v201411190455 [584]
>   Id=584, Status=RESOLVED    Data Root=/Users/dhuebner/Entwicklung/
> xtext-new/eclipse/configuration/org.eclipse.osgi/584/data
>   "No registered services."
>   No services in use.
>   Exported packages
>     org.eclipse.xtend2.lib; version="0.0.0"[exported]
>     org.eclipse.xtext.xbase.lib; version="0.0.0"[exported]
>     org.eclipse.xtext.xbase.lib.internal; version="0.0.0"[exported]
>     org.eclipse.xtext.xbase.lib.util; version="0.0.0"[exported]
>   Imported packages
>     com.google.common.annotations; version="15.0.0"
> <com.google.guava_15.0.0.v201403281430 [4]>
>     co
>
> osgi>  b 626
> org.eclipse.xtext.xbase.lib_2.8.0.v201411111037 [626]
>   Id=626, Status=RESOLVED    Data Root=/Users/dhuebner/Entwicklung/
> xtext-new/eclipse/configuration/org.eclipse.osgi/626/data
>   "No registered services."
>   No services in use.
>   Exported packages
>     org.eclipse.xtend2.lib; version="0.0.0"[exported]
>     org.eclipse.xtext.xbase.lib; version="0.0.0"[exported]
>     org.eclipse.xtext.xbase.lib.internal; version="0.0.0"[exported]
>     org.eclipse.xtext.xbase.lib.util; version="0.0.0"[exported]
>   Imported packages
>     com.google.common.annotations; version="15.0.0"
> <com.google.guava_15.0.0.v201403281430 [4]>
>     com.goo
>
> I thought, that if my bundle exports a package without a version, it
> means, that the version is the same as a Bundle-Version. But from
> what I see in the osgi console it seems that I’m wrong.


If the manifest file in the bundle does not export packages with a version, then the version of the packages is 0.0.0. http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Version.html#emptyVersion

Some tools which take input for the manifest may put the bundle version on the exported packages if no version is specified (in the generated bundle). But that is a tool choice and not part of the OSGi specifications.

>
> osgi> b org.eclipse.xtend.lib
> org.eclipse.xtend.lib_2.8.0.v201411111037 [544]
>   Id=544, Status=RESOLVED    Data Root=/Users/dhuebner/Entwicklung/
> xtext-new/eclipse/configuration/org.eclipse.osgi/544/data
>   "No registered services."
>   No services in use.
>   Exported packages
>     org.eclipse.xtend.lib; version="0.0.0"[exported]
>     org.eclipse.xtend.lib.annotations; version="0.0.0"[exported]
>   Imported packages
>     com.google.common.annotations; version="15.0.0"
> <com.google.guava_15.0.0.v201403281430 [4]>
> ...
>     org.eclipse.xtext.xbase.lib; version="0.0.0"
> <org.eclipse.xtext.xbase.lib_2.8.0.v201411111037 [626]>
>     org.eclipse.xtext.xbase.lib; version="0.0.0"
> <org.eclipse.xtext.xbase.lib_2.7.3.v201411190455 [584]>
>     org.eclipse.xtext.xbase.lib.internal; version="0.0.0"
> <org.eclipse.xtext.xbase.lib_2.8.0.v201411111037 [626]>
>     org.eclipse.xtext.xbase.lib.internal; version="0.0.0"
> <org.eclipse.xtext.xbase.lib_2.7.3.v201411190455 [584]>
>     org.eclipse.xtext.xbase.lib.util; version="0.0.0"
> <org.eclipse.xtext.xbase.lib_2.8.0.v201411111037 [626]>
>     org.eclipse.xtext.xbase.lib.util; version="0.0.0"
> <org.eclipse.xtext.xbase.lib_2.7.3.v201411190455 [584]>
>   No fragment bundles
>   Required bundles
>     osgi.identity; osgi.identity="org.eclipse.xtext.xbase.lib";
> type="osgi.bundle"; version:Version="2.8.0.v201411111037"
>     osgi.identity; osgi.identity="org.eclipse.xtend.lib.macro";
> type="osgi.bundle"; version:Version="2.8.0.v201411111037"
>
> My question is, which package will be wired if an another bundle
> require (using Require-Bundle) an xbase.lib bundle with version
> constraint 2.8.0?
>
>


No one should use Require-Bundles. It is so messy. But if you require a bundle, you get the package in the actual bundle that is required.

--

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the
OSGi Alliance
hargrave@xxxxxxxxxx

office: +1 386 848 1781
mobile: +1 386 848 3788


Back to the top