Version PolicyPage edited by Felix MeschbergerVersion PolicyThis page is about how we assign versions to exported packages and bundles and defines when to increase which part of the version number. IntroductionIn comments to SLING-1176 Ian Boston wrote:
I agree, that this is a problem. So Let me reasonate on this a bit As a reference you might want to read my latest blog post and also what the Eclipse guys have to say (great read, btw). So for Sling, we have three kinds of version numbers:
For Big Sling releases we have already an ample solution in that we just use a single number which is increased from release to release. Just remember that a Big Sling release is a convenience release of existing released Sling bundles. For Sling bundles version numbers are just defined as the <version> element of the bundle's POM. The only restriction here is, that we decided to use even numbers for releases and odd numbers for SNAPSHOTs. Whether and when which version part is increased is not explicitly defined yet. For Package exports the situation is more problematic since there are a number of places to set exported package version number: In a packageinfo file inside the package (picked up by the Maven Bundle Plugin to set the export version) or explicitly in the <Export-Package> element of the Maven Bundle Plugin configuration or by reference to the bundle version number using the ${pom.version} variable. Upto now, we mostly used the ${pom.version notation linking the exported package version to the bundle version. This works well for bundles with simple exports. For more complicated bundles, specifically for bundles with multiple exported packages which may evolve independently, this does not work well. Additionally it also links the reasons for the bundle version changes and the reasons for exported package versions. Finally, it increases the exported package version without the package having any changes thus potentially confusing users. Consider for example the Sling API bundle, which exports 7 packages. Each of which may evolve independently. Now the resource package is extended causing a minor version increase. Should the version numbers of the other exports also be increased ? Thus acting as if there was some API change ? I would say, no. Particularly if some API implementation bundle is restricting the import version of the API implemented. Such an implementation would immediately stop working because the version has been increased. But since there has been no change, the implementation would still be correct. So, I think, we should evolve the exported package versions independently from each other and even independently from the bundle version. This places more burden on the developer when deciding on the exported package version - in fact this requires such a decision as compared to have Maven take the decision by just setting the bundle version. The only problem is: Where shall this be noted ? In the POM or in the packageinfo file ? If we would place the packageinfo file just beneath the class source files, I would say, in the packageinfo file. But this would require defining the class source locations as resource location in the POM (at least for packageinfo) files. I am not sure .... This has not been discussed at large, but I would assume, that the POM is still the correct place to take note of the version of the exported packages. Version Number SyntaxAs a small reminder, this is how a version number is constructed: In OSGi version numbers are composed of four (4) segments: 3 integers and a string respectively named major.minor.micro.qualifier. Each segment captures a different intent:
Evolution of Exported Package VersionsVersion numbers of exported packages evolve independently from each other. Depending on the changes applied, the micro, minor, or major segement is increased. Whenever the major segment is increased, the minor and micro segments are reset to zero. Whenever the minor segment is increased, the micro segment is reset to zero. Segments are increased according to the above listing. This requires committers to think well about changes they apply to exported packages:
JavaDoc updates generally do not constitute a reason to evolve the version number. The exception is that if the JavaDoc update is caused by a API limitation, it might be conceivable to increase the version number of the exported package. A decision on this will probably have to be taken on a case-by-case basis. Evolution of Bundle VersionsVersion numbers of bundles evolve depending on the evolution of the exported packages but also depending on the evolution of the private code, which is not exported. As a rule of thumb, the following reasons apply for increasing the segments of bundle version numbers:
Note, that this definition does not require the bundle and epxorted package version numbers to be synchronized in any way. While doing so might help in a first or second step, over time it will become close to impossible to keep the versions in sync. So rather than trying to keep the versions in sync, we should make sure, we increase the versions correctly. ExamplesPure API BundleAn example of an almost Pure API Bundle is the Sling API bundle. This bundle exports 7 packages. Some are really quiet – e.g. the org.apache.sling.api package or the org.apache.sling.wrappers package – and some are being worked on at the moment – e.g. the org.apache.sling.resource package. To not break existing users of the quiet packages, the exported versions of these packages must not be increased. To signal to users of evolving packages, that there might be new and interesting functionality, the version number must be increased according to above definition. This also conveys to the implementor(s) of the API, that they have to take some action. A hypothetical evolution of version numbers shown on two packages and the bundle version might be as follows
Implementation Bundle providing APIAn example of such a hybrid bundle is the Sling Engine bundle. This bundle exports three packages themselves defining API and contains a number of internal packages which actually implement parts of the Sling API. A hypothetical evolution of version numbers shown on one exported package and the bundle version might be as follows
Pure Implementation BundleFor Pure Implementation Bundles only the bundle version numbers are maintained because there is no exported package whose version number needs to be managed. This makes the decision process of version number evolution very simple. Importing PackagesWhen importing packages a version number will automatically be generated by the Maven Bundle Plugin as follows:
For example if importing the api package exported at version 1.2.3, the Import-Package statement is generated as Import-Package: api;version=[1.2.3,2.0.0)
Change Notification Preferences
View Online
|
View Change
|
Add Comment
|
- [CONF] Apache Sling Website > Version Policy confluence
- [CONF] Apache Sling Website > Version Policy confluence
- [CONF] Apache Sling Website > Version Policy confluence
- [CONF] Apache Sling Website > Version Policy confluence
