[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [equinox-dev] Exporting packages without a version
|
Thank’s a lot to all for your answers! Now I know what goes wrong.
@Thomas As you said our org.eclipse.xtend.lib.macro bundle still has a version constraint set to > 2.7.0. Loaded 2.7.3 xbase.lib and reexported the dependency. :( That seems to be a cause of the strange wiring.
I will try to summarize what was said: 1. If other clients works with package imports instead of require bundle they have no chance to get the right version of our exported packages loaded. 2. The only solution to prevent such kind of errors is to export packages with a version defined or stop reexport other dependencies.
If so, I wonder, why PDE didn’t provide a tool, which automatically updates exported package version, when the bundle version was changed. Are there any build tools (tycho?) that has such an autoupdate package versions feature?
To be clear, exporting a package without
a version is against best practices of OSGi. I know Eclipse projects
(including some bundles in Equinox) do not follow this best practice. That
is largely due to the historical way most Eclipse projects declare their
dependencies (at the bundle level using Require-Bundle). The practice
of using require-bundle puts the API declaration/contract at the bundle
symbolic name and version level instead of the OSGi package level. If
that type of dependency is the only way consumers wire to your API then
there is not a strong need to version your packages individually. I
don't want to use this thread to debate best practices though. So
to answer you questions:
"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?"
The bundle will get wired to the 2.8.0
bundle for the packages exported by the 2.8.0 version. What is confusing
about your example is that you have the packages listed twice:
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]>
This indicates that we have a case where
these two package versions are being treated as split packages. I
seriously doubt that was your intention. I see from the console output
it states this:
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"
The first entry for "org.eclipse.xtext.xbase.lib"
explains why you see the exported packages from that bundle. I have
to assume the other bundle "org.eclipse.xtend.lib.macro"
is wired to the old version "org.eclipse.xtext.xbase.lib_2.7.3.v201411190455"
and is re-exporting the bundle. I think more of these issues of inconsistent
wiring is happening because of a change in the Luna framework to no longer
auto-refresh bundles of the same symbolic name when p2 installs and resolves/refreshes
the new versions. I am pretty sure that if you ran with -clean this
strange wiring situation would disappear. I have opened p2 bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=449365
to have p2 detect the need to refresh older versions of a bundle when installing
new ones.
Tom
From:
Dennis Hübner <dennis.huebner@xxxxxxxxx>
To:
equinox-dev@xxxxxxxxxxx
Date:
12/11/2014 08:10 AM
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.
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?
[attachment "signature.asc" deleted by Thomas Watson/Austin/IBM]
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________ equinox-dev mailing list equinox-dev@xxxxxxxxxxxTo change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/equinox-dev
|
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail