Improve default support for version schemes
The current implementation for version schemes is rather limited. It only supports 5 properties:
...
- It only supports the following schemes:
- 'positiveInteger-buildnumber' where buildnumber doesn't start with '0' and has to be
- 'positiveinteger-qualifier'
- positiveInteger(.positiveInteger(.positiveInteger))-(buildNr|qualifier)
- Inconsistent/unintuitive parsing:
Wiki Markup in something-X, where X is \[1..9\], X will be a buildnumber
- in something-0X, where X is any string, '0X' will be a qualifier
- something.0something will yield 0.0.0.0-something.0something
- something.NaN will also yield 0.0.0.0-something.NaN
- getBuildNumber returns '0' when no buildnumber is specified, yet you can never specify 0 as a buildnumber
- qualifiers are sorted lexically
- if a qualifier is a prefix of another, the shorter one is considered newer (example:'1.0-alpha10' is considered older than '1.0-alpha1')
The unit tests that are there to test comparison only check for a few cases with snapshots. When all tests
(version A < version B) are expanded to also test for SNAPSHOTs (version A-SNAPSHOT < version B-SNAPSHOT) a
lot of the tests fail.
...
As an example here's an XSD you could use to describe versions:
No Format |
---|
<xs:schema> <xs:element name="versionSchemeDefinition"> <xs:complexType> <xs:sequence> <!-- the order of qualifierDefinitions is from oldest to newest --> <xs:element ref="qualifierDefinition" minOccurs="0" maxOccurs="unbounded"/> <xs:choice maxOccurs="unbounded" minOccurs="0"> <xs:element ref="stringComponent"/> <xs:element ref="numberComponent"/> <xs:element ref="subComponent"/> </xs:choice> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="qualifierDefinition"> <xs:complexType> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="caseSensitive" type="xs:boolean" default="false"/> </xs:complexType> </xs:element> <xs:element name="stringComponent"> <xs:complexType> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="prefix" type="xs:string" default="."/> </xs:complexType> </xs:element> <xs:element name="numberComponent" type="xs:int"> <xs:complexType> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="prefix" type="xs:string" default="."/> <xs:attribute name="optional" type="xs:boolean" default="false"/> </xs:complexType> </xs:element> <xs:element name="subComponent"> <xs:complexType> <xs:choice maxOccurs="unbounded" minOccurs="0"> <xs:element ref="stringComponent"/> <xs:element ref="numberComponent"/> <xs:element ref="subComponent"/> </xs:choice> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="prefix" type="xs:string" default="-"/> </xs:complexType> </xs:element> </xs:schema> |
...