If it's backwards compatible, then there should be no problem with just replacing the current algorithm with this one in 2.1.

I think the other points will certainly need to be addressed before any other maven-artifact work.

Cheers,
Brett

On 24/12/2006, at 8:54 AM, Kenney Westerhof wrote:



FYI, I've created a Wiki page under the Maven 2.1 design documents describing
the proposal:

http://docs.codehaus.org/display/MAVEN/Versioning

FWIW,I think '1.0-alpha10' being treated as older than 1.0-alpha2 is a bug, and doesn't
warrant a pom version change.

The only incompatibility, aside from being able to support '1.2.3.4.betaX' and, generally, more version schemes, is the consideration of 1.0-xyz being considered newer than 1.0, which I've put up for debate. If my proposed behaviour is changed to match the current handling, I don't think a pom change is needed (so point B is not necessarily true).

Point A is part of the proposal too, though I feel it's not required at all; the same goes for the version conflict resolution which should be pluggable. THough we will
need to make provisions for this in a new pom model.

As for point C, I agree - we should somehow be able to use different component implementations depending on the pom version specified, although this can get pretty
complicated:

- I say different component versions since I'd hate for the maven code to be full of conditionals
depending on the pom version;
- Complication in that you'll get mixed versions in the dependency tree or reactor, and some behaviours are not confined to a single pom. I'm sure you can think of some examples.

I've seen that there's a section on this on the wiki, and it needs a lot of work (currently just the requirement of loading poms with modelVersion above 4.0.0 is stated,
although modelVersion and maven behaviour are different things to me).

What's the plan? It seems there's a ton of designing to do before we could incorporate some proposals
(including mine which is basically finished and ready to go).

-- Kenney

Jason van Zyl wrote:
On 22 Dec 06, at 5:07 PM 22 Dec 06, Brett Porter wrote:
At first blush this seems good. I haven't looked in detail.

We have some key things to put in place first though (not in this order).

a) support for selection of alternate versioning
b) since it's not backwards compatible, we need to use the old scheme for v4.0.0 POMs
c) ability to read different versions of POMs.

The last one is really a blocker to us doing anything in Maven 2.1 that might alter behaviour (changes to dependency handling, conflict resolution, versioning, lifecycle, ...)

I have a proposal for maven-artifact that I'll work on with Kenney which will complement his versioning proposal.
Jason.
I still need to take a more detailed look at this, but I've switched my brain of for the holidays unfortunately :)

- Brett

On 19/12/2006, at 9:43 AM, Kenney Westerhof wrote:


Hi,

The current versioning implementation is IMHO too 'tight'. For instance, 2.0.0alpha1 is parsed as '0.0.0.0' with a qualifier of '2.0.0alpha1', whereas this should
be parsed in the same way as 2.0.0.alpha.1 or 2.0.0-alpha-1.

Here's a proposal:

- don't use the current 4-digit limitation, but instead list with a random amount of entries
- entries are separated by dots or dashes
- entries are separated by transition to/from alpha to numeric
- sub-lists are indicated by '-'
- entries can be either: string, integer, or sublist
- versions are compared entry by entry, where we have 3 options;
 * integer <=> integer: normal numerical compare
 * integer <=> string: integers are newer
 * integer <=> list: integers are newer
* string <=> string: if it's a qualifier, qualifier compare, else lexical compare,
    taking into account if either is a qualifier.
 * string <=> list: list is newer
* list <=> list: recursion, same as a 'top-level' version compare. Where one list is shorter, '0' is assumed (so 2.0 <=> 2 == 0, 2.0-alpha <=> 2.0 => 2.0- alpha <=> 2.0.0 = -1 (2.0 = newer))

Now for some examples to explain the rules above:

(note; i'm using the following notation: [1, 0] is a list with items 1, 0; [1, 0, [2, 3]] is a list with items 1, 0, [2, 3] where the latter is a sublist)

Version parsing:

'1.0':        [1, 0]
'1.0.0.0.0'    [1, 0, 0, 0, 0]
'1.0-2.3':    [1, 0, [2, 3]]
'1.0-2-3':    [1, 0, [2, [3]]]

'1.0-alpha-1':    [1, 0, ["alpha", [1]]]
'1.0alpha1': [1, 0, ["alpha", [1]]] or [1, 0, "alpha", 1], which is the current implementation (see bottom)


String sorting (qualifiers)

SNAPSHOT < alpha < beta < gamma < rc < ga < unknown(lexical sort) < '' < sp
(ga = latest rc, final version
'' = no qualifier, final version
sp = service pack, improvement/addition on final release)

usually systems either use '' or ga, not both.

so 1.0-rc3 < 1.0-ga == 1.0 < 1.0-sp1 < 1.0.1


Comparing;

1)
 1.0-SNAPSHOT       <=>   1.0
 [1, 0, [SNAPSHOT]] <=>   [1, 0]

the first 2 items are equal, the last is assumed to be 0 for the right hand, and thus is newer.

2)
 1.0-beta-3            <=>  1.0-alpha-4

 [1, 0, ["beta", [3]]] <=> [1, 0, ["alpha", [4]]]

same here, then "beta" is newer then "alpha" so the first half wins

3)
 1.0-2.3       <=>  1.0-2-3
 [1, 0, [2, 3]]   <=>  [1, 0, [2, [3]]]
first 2 items are the same, then this is left;
 [2, 3]          <=>   [2, [3]]
first item is the same, second item: the left list wins since the right one is a sublist. So 1.0-2.3 is newer than 1.0-2-3 (which seems right: -[digit] usually indicates a maintainer update, and '.' here a bugfix version, though i doubt this will be a valid usecase).

4)
  1.0-alpha-2          <=>  1.0alpha2

  The current implementation parses this as:

  [1, 0, [alpha, [2]]] <=>  [1, 0, alpha, 2]
  The right one is newer.
If we change parsing '1.0alpha2' by using sublists on alpha<- >digit transition, both will parse
  as [1, 0, ["alpha", [2]]. I think this is preferrable.

we may need to flatten the list or assume alpha<->digit transitions create a new sublist.


So, I've given both a way to represent versions in a generic way, and an algorithm to compare versions. Replacing DefaultArtifactVersion is easy enough (see bottom), though ranges may be a bit more complicated.

This scheme will support the eclipse version numbering: http:// wiki.eclipse.org/index.php/Version_Numbering (basically: major.minor.bugfix.qualifier: [major, minor, bugfix, qualifier] and Jboss: http://docs.jboss.org/process-guide/en/html/release- procedure.html, (basically: X.YY.ZZ.Q*, for instance 1.2.3.alpha4: [1, 2, 3, "alpha", 4]

Maven:  major.minor(.bugfix)?(-(alpha|beta|rc)-X)? which will be:
[ major, minor, bugfix?, [ alpha|beta|rc, [X] ]

I'll probably miss some usecases or got some things wrong, but if we do not support some sort of <versionScheme> tag in the POM, we want to be able to accommodate versioning in a most generic way, and I think this comes close.

I've created an implementation[1] and a unit test[2].

I've had to comment out one assert: 2.0.1-xyz < 2.0.1. I think generally this is not the case. For example, the wiki guide to patching plugins states that you could patch a plugin and change it's version to 2.0-INTERNAL. In this case, 2.0 would be newer than 2.0-INTERNAL, which renders the wiki description invalid. In my sample
implementation, 2.0.1-xyz is newer than 2.0.1.
Though should this be required, the code is easily modified to reflect this.

So, WDYT?
Any additional version schemes that cannot be handled by this?

If this looks ok, then my next challenge will be to support ranges. ;)

[1] http://www.neonics.com/~forge/GenericArtifactVersion.java - put in maven-artifact/src/main/java/.../versioning/ Note: this one doesn't implement ArtifactVersion since we never know what the major/minor versions etc. will be. It could implement it and default to 0 if the item isn't an integer; [2] http://www.neonics.com/~forge/ GenericArtifactVersionTest.java - put in maven-artifact/src/test/ java/.../versioning/ Note: this test is a copy of the DefaultArtifactVersionTest, with Default replaced by Generic. The testVersionParsing is left out since the other unit test already takes care of checking if this works okay, and because GenericArtifactVersion doesn't implement ArtifactVersion. I've tested for all constructor calls that the toString() method yields the constructor argument.


-- Kenney

------------------------------------------------------------------- --
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to