Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] Throwing semantic versioning out the window with Require-Bundle/Import-Package with empty/single version

I am not sure if there is any justification to use 0.0.0. I would consider this an anti-pattern.

Open ended ranges like version=1.0 which is [1.0.0, infinity) mean you know for a fact that the thing you require will forever be backward compatible. In this case you are stating the minimal set of features you will be using. This has meaning since you will not resolve against any version that provides less. Still very few projects can give such compatibility guarantees. So I would consider this an anti-pattern as well.

99% of the time:
If version = 1.2.3
If you import to consume the API:  [1.2.0, 2)
If you import to implement the API: [1.2.3, 2)


The BND Tools project has "base lining" where it tracks your changes with respect to your last release and forces you to bump versions.
I think PDE has something similar but have not learned to use it.

Regards,
Todor
 



On Tue, Feb 20, 2018 at 4:44 AM, Mykola Nikishov <mn@xxxxxxxxx> wrote:
Hi there,

Recently I've discovered a binary incompatible change in one of p2
bundles [1] and the way p2 and Tycho specifically use version ranges
surprised me.

What is a justification, in context of OSGi and Eclipse in general, for
not using versions at all or just a specific single version when
importing bundles/packages like

    Import-Package: org.eclipse.equinox.internal.p2.core.helpers
    Import-Package: org.eclipse.equinox.app;version="1.0.0"

or

    Require-Bundle: org.eclipse.equinox.p2.metadata.repository;bundle-version="1.2.100"
    Require-Bundle: org.eclipse.equinox.p2.metadata

OSGi Specification in 3.2.5 Version, 3.2.6 Version Ranges and 3.7.3
Semantic Versioning says:

    The default value for a version is 0.0.0.

and

    Examples of version ranges
    Example Predicate
    1.2.3   1.2.3 <= x

and

    Version ranges encode the assumptions about compatibility.

Which means that for version-less requirement any version apply and for
a single version requirement any version greater than or equal apply.

How to specify plug-in requirements [2] says the same:

    Plug-ins that require other plug-ins must qualify their requirements
    with a version range since the absence of a version range means that
    any version can satisfy the dependency. ... the recommended range
    includes the minimal required version up-to but not including the
    next major release.

Version-less or single version requirement effectively throw these
assumptions about compatibility out the window. Either I'm missing
something important and there reasons for this or ...?

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=531354
[2] https://wiki.eclipse.org/Version_Numbering

--
Mykola
https://manandbytes.github.io/

_______________________________________________
cross-project-issues-dev mailing list
cross-project-issues-dev@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cross-project-issues-dev


Back to the top