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.hueb...@itemis.de>
To:     equinox-dev@eclipse.org
Date:   12/11/2014 08:10 AM
Subject:        [equinox-dev] Exporting packages without a version
Sent by:        equinox-dev-boun...@eclipse.org



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@eclipse.org
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@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to