Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace crappy VersionNumber with better implementation. #153

Merged
merged 2 commits into from
Jun 7, 2011

Conversation

stephenc
Copy link
Member

@stephenc stephenc commented Jun 7, 2011

replace old CDDL+GPLv2 Version Number comparator with one that is both ASL and has a better understanding of Maven version numbers (with some tweaks for wildcard support)

  • Had to change the logic of two test cases (2.0 is now newer than 2.0.ea and 1.12-SNAPSHOT is no longer equal to 1.11.*) both of which make more sense than the original test cases
  • Should now allow custom builds with text/alpha qualifiers in the version number.

Signature of new version (based on the Mercury Version Number comparison code developed at Apache Maven):

public class hudson.util.VersionNumber extends java.lang.Object implements java.lang.Comparable{
public hudson.util.VersionNumber(java.lang.String); public int compareTo(hudson.util.VersionNumber);
public java.lang.String toString();
public boolean equals(java.lang.Object);
public int hashCode();
public boolean isOlderThan(hudson.util.VersionNumber);
public boolean isNewerThan(hudson.util.VersionNumber);
public int digit(int);
public int compareTo(java.lang.Object);
}

Signature of original version:

public class hudson.util.VersionNumber extends java.lang.Object implements java.lang.Comparable{
public hudson.util.VersionNumber(java.lang.String);
public int digit(int);
public java.lang.String toString();
public boolean isOlderThan(hudson.util.VersionNumber);
public boolean isNewerThan(hudson.util.VersionNumber);
public boolean equals(java.lang.Object);
public int hashCode();
public int compareTo(hudson.util.VersionNumber);
public int compareTo(java.lang.Object);
}

…h ASL and has a better understanding of Maven version numbers (with some tweaks for wildcard support)

o Had to change the logic of two test cases (2.0 is now newer than 2.0.ea and 1.12-SNAPSHOT is no longer equal to 1.11.*) both of which make more sense than the original test cases

o Should now allow custom builds with text/alpha qualifiers in the version number.
ALIASES.put("ga", "");
ALIASES.put("final", "");
ALIASES.put("cr", "rc");
ALIASES.put("ea", "rc");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This alias is added to the Mercury ruleset to keep the results ordered correctly

@olamy
Copy link
Member

olamy commented Jun 7, 2011

kohsuke added a commit that referenced this pull request Jun 7, 2011
Replace crappy VersionNumber with better implementation.
@kohsuke kohsuke merged commit 285741a into jenkinsci:master Jun 7, 2011
@stephenc
Copy link
Member Author

stephenc commented Jun 7, 2011

@olamy: wildcard support is the killer on that

EstherAF pushed a commit to EstherAF/jenkins that referenced this pull request May 13, 2020
[PRD-1389] Enable release only on branches (not via PR builders)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants